Skip to content

Commit

Permalink
fav icon -> favicon. Pass 11: rest of chrome/browser/ui
Browse files Browse the repository at this point in the history
BUG=76073
TEST=none; no visible change

Review URL: http://codereview.chromium.org/6698052

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78360 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
avi@chromium.org committed Mar 16, 2011
1 parent 9740d6e commit 16835e6
Show file tree
Hide file tree
Showing 28 changed files with 86 additions and 86 deletions.
4 changes: 2 additions & 2 deletions chrome/browser/extensions/extension_function_dispatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -392,10 +392,10 @@ ExtensionFunctionDispatcher::ExtensionFunctionDispatcher(
render_view_host->process()->id());

// If the extension has permission to load chrome://favicon/ resources we need
// to make sure that the FavIconSource is registered with the
// to make sure that the FaviconSource is registered with the
// ChromeURLDataManager.
if (extension->HasHostPermission(GURL(chrome::kChromeUIFavIconURL))) {
FavIconSource* favicon_source = new FavIconSource(profile_);
FaviconSource* favicon_source = new FaviconSource(profile_);
profile_->GetChromeURLDataManager()->AddDataSource(favicon_source);
}

Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/possible_url_model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ SkBitmap PossibleURLModel::GetIcon(int row) {
CancelableRequestProvider::Handle h =
favicon_service->GetFaviconForURL(
result.url, &consumer_,
NewCallback(this, &PossibleURLModel::OnFavIconAvailable));
NewCallback(this, &PossibleURLModel::OnFaviconAvailable));
consumer_.SetClientData(favicon_service, h, result.index);
// Add an entry to the map so that we don't attempt to request the
// favicon again.
Expand All @@ -182,7 +182,7 @@ int PossibleURLModel::CompareValues(int row1, int row2, int column_id) {
return ui::TableModel::CompareValues(row1, row2, column_id);
}

void PossibleURLModel::OnFavIconAvailable(
void PossibleURLModel::OnFaviconAvailable(
FaviconService::Handle h,
bool favicon_available,
scoped_refptr<RefCountedMemory> data,
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/possible_url_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class PossibleURLModel : public ui::TableModel {
const GURL& GetURL(int row);
const std::wstring& GetTitle(int row);

virtual void OnFavIconAvailable(FaviconService::Handle h,
virtual void OnFaviconAvailable(FaviconService::Handle h,
bool favicon_available,
scoped_refptr<RefCountedMemory> data,
bool expired,
Expand Down
28 changes: 14 additions & 14 deletions chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const int kTopPadding = 6;
const int kRightPadding = 15;
const int kBottomPadding = 5;
const int kDropShadowHeight = 2;
const int kFavIconTitleSpacing = 4;
const int kFaviconTitleSpacing = 4;
const int kTitleCloseButtonSpacing = 5;
const int kStandardTitleWidth = 175;
const int kDropShadowOffset = 2;
Expand Down Expand Up @@ -208,14 +208,14 @@ void TabRendererGtk::LoadingAnimation::Observe(
// FaviconCrashAnimation
//
// A custom animation subclass to manage the favicon crash animation.
class TabRendererGtk::FavIconCrashAnimation : public ui::LinearAnimation,
class TabRendererGtk::FaviconCrashAnimation : public ui::LinearAnimation,
public ui::AnimationDelegate {
public:
explicit FavIconCrashAnimation(TabRendererGtk* target)
explicit FaviconCrashAnimation(TabRendererGtk* target)
: ALLOW_THIS_IN_INITIALIZER_LIST(ui::LinearAnimation(1000, 25, this)),
target_(target) {
}
virtual ~FavIconCrashAnimation() {}
virtual ~FaviconCrashAnimation() {}

// ui::Animation overrides:
virtual void AnimateToState(double state) {
Expand All @@ -225,7 +225,7 @@ class TabRendererGtk::FavIconCrashAnimation : public ui::LinearAnimation,
target_->SetFaviconHidingOffset(
static_cast<int>(floor(kHidingOffset * 2.0 * state)));
} else {
target_->DisplayCrashedFavIcon();
target_->DisplayCrashedFavicon();
target_->SetFaviconHidingOffset(
static_cast<int>(
floor(kHidingOffset - ((state - .5) * 2.0 * kHidingOffset))));
Expand All @@ -240,7 +240,7 @@ class TabRendererGtk::FavIconCrashAnimation : public ui::LinearAnimation,
private:
TabRendererGtk* target_;

DISALLOW_COPY_AND_ASSIGN(FavIconCrashAnimation);
DISALLOW_COPY_AND_ASSIGN(FaviconCrashAnimation);
};

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -327,7 +327,7 @@ void TabRendererGtk::UpdateFromModel() {
} else {
if (IsPerformingCrashAnimation())
StopCrashAnimation();
ResetCrashedFavIcon();
ResetCrashedFavicon();
}
}

Expand Down Expand Up @@ -364,7 +364,7 @@ bool TabRendererGtk::ValidateLoadingAnimation(AnimationState animation_state) {
return loading_animation_.ValidateLoadingAnimation(animation_state);
}

void TabRendererGtk::PaintFavIconArea(GdkEventExpose* event) {
void TabRendererGtk::PaintFaviconArea(GdkEventExpose* event) {
DCHECK(ShouldShowIcon());

// The paint area is the favicon bounds, but we're painting into the gdk
Expand Down Expand Up @@ -457,7 +457,7 @@ gfx::Size TabRendererGtk::GetMinimumSelectedSize() {
// static
gfx::Size TabRendererGtk::GetStandardSize() {
gfx::Size standard_size = GetMinimumUnselectedSize();
standard_size.Enlarge(kFavIconTitleSpacing + kStandardTitleWidth, 0);
standard_size.Enlarge(kFaviconTitleSpacing + kStandardTitleWidth, 0);
return standard_size;
}

Expand Down Expand Up @@ -589,7 +589,7 @@ void TabRendererGtk::AnimationEnded(const ui::Animation* animation) {

void TabRendererGtk::StartCrashAnimation() {
if (!crash_animation_.get())
crash_animation_.reset(new FavIconCrashAnimation(this));
crash_animation_.reset(new FaviconCrashAnimation(this));
crash_animation_->Stop();
crash_animation_->Start();
}
Expand All @@ -609,11 +609,11 @@ void TabRendererGtk::SetFaviconHidingOffset(int offset) {
SchedulePaint();
}

void TabRendererGtk::DisplayCrashedFavIcon() {
void TabRendererGtk::DisplayCrashedFavicon() {
should_display_crashed_favicon_ = true;
}

void TabRendererGtk::ResetCrashedFavIcon() {
void TabRendererGtk::ResetCrashedFavicon() {
should_display_crashed_favicon_ = false;
}

Expand Down Expand Up @@ -719,7 +719,7 @@ void TabRendererGtk::Layout() {

if (!mini() || width() >= kMiniTabRendererAsNormalTabWidth) {
// Size the Title text to fill the remaining space.
int title_left = favicon_bounds_.right() + kFavIconTitleSpacing;
int title_left = favicon_bounds_.right() + kFaviconTitleSpacing;
int title_top = kTopPadding;

// If the user has big fonts, the title will appear rendered too far down
Expand Down Expand Up @@ -826,7 +826,7 @@ void TabRendererGtk::PaintIcon(gfx::Canvas* canvas) {
PaintLoadingAnimation(canvas);
} else {
canvas->Save();
canvas->ClipRectInt(0, 0, width(), height() - kFavIconTitleSpacing);
canvas->ClipRectInt(0, 0, width(), height() - kFaviconTitleSpacing);
if (should_display_crashed_favicon_) {
canvas->DrawBitmapInt(*crashed_favicon, 0, 0,
crashed_favicon->width(),
Expand Down
10 changes: 5 additions & 5 deletions chrome/browser/ui/gtk/tabs/tab_renderer_gtk.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class TabRendererGtk : public ui::AnimationDelegate,
bool ValidateLoadingAnimation(AnimationState animation_state);

// Repaint only the area of the tab that contains the favicon.
void PaintFavIconArea(GdkEventExpose* event);
void PaintFaviconArea(GdkEventExpose* event);

// Returns whether the Tab should display a favicon.
bool ShouldShowIcon() const;
Expand Down Expand Up @@ -239,7 +239,7 @@ class TabRendererGtk : public ui::AnimationDelegate,
GdkEventCrossing*);

private:
class FavIconCrashAnimation;
class FaviconCrashAnimation;

// The data structure used to hold cached bitmaps. We need to manually free
// the bitmap in CachedBitmap when we remove it from |cached_bitmaps_|. We
Expand Down Expand Up @@ -306,8 +306,8 @@ class TabRendererGtk : public ui::AnimationDelegate,
// Set the temporary offset for the favicon. This is used during animation.
void SetFaviconHidingOffset(int offset);

void DisplayCrashedFavIcon();
void ResetCrashedFavIcon();
void DisplayCrashedFavicon();
void ResetCrashedFavicon();

// Generates the bounds for the interior items of the tab.
void Layout();
Expand Down Expand Up @@ -410,7 +410,7 @@ class TabRendererGtk : public ui::AnimationDelegate,
int favicon_hiding_offset_;

// The animation object used to swap the favicon with the sad tab icon.
scoped_ptr<FavIconCrashAnimation> crash_animation_;
scoped_ptr<FaviconCrashAnimation> crash_animation_;

// Set when the crashed favicon should be displayed.
bool should_display_crashed_favicon_;
Expand Down
14 changes: 7 additions & 7 deletions chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ int CompareGdkRectangles(const void* p1, const void* p2) {
return 1;
}

bool GdkRectMatchesTabFavIconBounds(const GdkRectangle& gdk_rect, TabGtk* tab) {
bool GdkRectMatchesTabFaviconBounds(const GdkRectangle& gdk_rect, TabGtk* tab) {
gfx::Rect favicon_bounds = tab->favicon_bounds();
return gdk_rect.x == favicon_bounds.x() + tab->x() &&
gdk_rect.y == favicon_bounds.y() + tab->y() &&
Expand Down Expand Up @@ -1874,8 +1874,8 @@ gboolean TabStripGtk::OnExpose(GtkWidget* widget, GdkEventExpose* event) {
qsort(rects, num_rects, sizeof(GdkRectangle), CompareGdkRectangles);
std::vector<int> tabs_to_repaint;
if (!IsDragSessionActive() &&
CanPaintOnlyFavIcons(rects, num_rects, &tabs_to_repaint)) {
PaintOnlyFavIcons(event, tabs_to_repaint);
CanPaintOnlyFavicons(rects, num_rects, &tabs_to_repaint)) {
PaintOnlyFavicons(event, tabs_to_repaint);
g_free(rects);
return TRUE;
}
Expand Down Expand Up @@ -2025,15 +2025,15 @@ void TabStripGtk::SetTabBounds(TabGtk* tab, const gfx::Rect& bounds) {
bds.x(), bds.y());
}

bool TabStripGtk::CanPaintOnlyFavIcons(const GdkRectangle* rects,
bool TabStripGtk::CanPaintOnlyFavicons(const GdkRectangle* rects,
int num_rects, std::vector<int>* tabs_to_paint) {
// |rects| are sorted so we just need to scan from left to right and compare
// it to the tab favicon positions from left to right.
int t = 0;
for (int r = 0; r < num_rects; ++r) {
while (t < GetTabCount()) {
TabGtk* tab = GetTabAt(t);
if (GdkRectMatchesTabFavIconBounds(rects[r], tab) &&
if (GdkRectMatchesTabFaviconBounds(rects[r], tab) &&
tab->ShouldShowIcon()) {
tabs_to_paint->push_back(t);
++t;
Expand All @@ -2045,10 +2045,10 @@ bool TabStripGtk::CanPaintOnlyFavIcons(const GdkRectangle* rects,
return static_cast<int>(tabs_to_paint->size()) == num_rects;
}

void TabStripGtk::PaintOnlyFavIcons(GdkEventExpose* event,
void TabStripGtk::PaintOnlyFavicons(GdkEventExpose* event,
const std::vector<int>& tabs_to_paint) {
for (size_t i = 0; i < tabs_to_paint.size(); ++i)
GetTabAt(tabs_to_paint[i])->PaintFavIconArea(event);
GetTabAt(tabs_to_paint[i])->PaintFaviconArea(event);
}

CustomDrawButton* TabStripGtk::MakeNewTabButton() {
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/ui/gtk/tabs/tab_strip_gtk.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,12 @@ class TabStripGtk : public TabStripModelObserver,
// Returns true if |rects| are all areas that match up with tab favicons.
// |rects| must be sorted from left to right. |tabs_to_paint| are the tab
// positions that match the rects.
bool CanPaintOnlyFavIcons(const GdkRectangle* rects,
bool CanPaintOnlyFavicons(const GdkRectangle* rects,
int num_rects,
std::vector<int>* tabs_to_paint);

// Paints the tab favicon areas for tabs in |tabs_to_paint|.
void PaintOnlyFavIcons(GdkEventExpose* event,
void PaintOnlyFavicons(GdkEventExpose* event,
const std::vector<int>& tabs_to_paint);

// Initializes the new tab button.
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/ui/search_engines/template_url_table_model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class ModelEntry {
load_state_ = LOADED;
if (know_favicon && data.get() &&
gfx::PNGCodec::Decode(data->front(), data->size(), &favicon_)) {
model_->FavIconAvailable(this);
model_->FaviconAvailable(this);
}
}

Expand Down Expand Up @@ -369,7 +369,7 @@ void TemplateURLTableModel::NotifyChanged(int index) {
}
}

void TemplateURLTableModel::FavIconAvailable(ModelEntry* entry) {
void TemplateURLTableModel::FaviconAvailable(ModelEntry* entry) {
std::vector<ModelEntry*>::iterator i =
find(entries_.begin(), entries_.end(), entry);
DCHECK(i != entries_.end());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class TemplateURLTableModel : public ui::TableModel,
friend class ModelEntry;

// Notification that a model entry has fetched its icon.
void FavIconAvailable(ModelEntry* entry);
void FaviconAvailable(ModelEntry* entry);

// TemplateURLModelObserver notification.
virtual void OnTemplateURLModelChanged();
Expand Down
8 changes: 4 additions & 4 deletions chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ static const int kButtonPadding = 0;
static const int kAlwaysShowCommandID = 1;

// Icon to display when one isn't found for the page.
static SkBitmap* kDefaultFavIcon = NULL;
static SkBitmap* kDefaultFavicon = NULL;

// Icon used for folders.
static SkBitmap* kFolderIcon = NULL;
Expand Down Expand Up @@ -860,8 +860,8 @@ void BookmarkBarView::Init() {

ResourceBundle& rb = ResourceBundle::GetSharedInstance();

if (!kDefaultFavIcon)
kDefaultFavIcon = rb.GetBitmapNamed(IDR_DEFAULT_FAVICON);
if (!kDefaultFavicon)
kDefaultFavicon = rb.GetBitmapNamed(IDR_DEFAULT_FAVICON);

// Child views are traversed in the order they are added. Make sure the order
// they are added matches the visual order.
Expand Down Expand Up @@ -1268,7 +1268,7 @@ void BookmarkBarView::ConfigureButton(const BookmarkNode* node,
if (model_->GetFavicon(node).width() != 0)
button->SetIcon(model_->GetFavicon(node));
else
button->SetIcon(*kDefaultFavIcon);
button->SetIcon(*kDefaultFavicon);
}
button->set_max_width(kMaxButtonWidth);
}
Expand Down
6 changes: 3 additions & 3 deletions chrome/browser/ui/views/tab_icon_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void TabIconView::PaintThrobber(gfx::Canvas* canvas) {
image_size, false);
}

void TabIconView::PaintFavIcon(gfx::Canvas* canvas, const SkBitmap& bitmap) {
void TabIconView::PaintFavicon(gfx::Canvas* canvas, const SkBitmap& bitmap) {
PaintIcon(canvas, bitmap, 0, 0, bitmap.width(), bitmap.height(), true);
}

Expand Down Expand Up @@ -142,12 +142,12 @@ void TabIconView::OnPaint(gfx::Canvas* canvas) {
SkBitmap favicon = model_->GetFaviconForTabIconView();
if (!favicon.isNull()) {
rendered = true;
PaintFavIcon(canvas, favicon);
PaintFavicon(canvas, favicon);
}
}

if (!rendered)
PaintFavIcon(canvas, *g_default_favicon);
PaintFavicon(canvas, *g_default_favicon);
}

gfx::Size TabIconView::GetPreferredSize() {
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/ui/views/tab_icon_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class TabIconView : public views::View {

private:
void PaintThrobber(gfx::Canvas* canvas);
void PaintFavIcon(gfx::Canvas* canvas, const SkBitmap& bitmap);
void PaintFavicon(gfx::Canvas* canvas, const SkBitmap& bitmap);
void PaintIcon(gfx::Canvas* canvas,
const SkBitmap& bitmap,
int src_x,
Expand Down
Loading

0 comments on commit 16835e6

Please sign in to comment.