Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Unified Diff: chrome/browser/views/location_bar_view.cc

Issue 269079: Implement new page action API. (Closed)
Patch Set: compile fixes Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/location_bar_view.cc
diff --git a/chrome/browser/views/location_bar_view.cc b/chrome/browser/views/location_bar_view.cc
index 324cf6006a6da4b334f94604b5ff8bf23e14ead5..437862f2ff9cbbeac407a1f378d4e1552b613ecd 100644
--- a/chrome/browser/views/location_bar_view.cc
+++ b/chrome/browser/views/location_bar_view.cc
@@ -1245,19 +1245,24 @@ void LocationBarView::PageActionImageView::UpdateVisibility(
const ExtensionActionState* state =
contents->GetPageActionState(page_action_);
- bool visible = state != NULL;
+ bool visible = state && !state->hidden();
if (visible) {
// Set the tooltip.
if (state->title().empty())
tooltip_ = page_action_->title();
else
tooltip_ = state->title();
+
// Set the image.
- int index = state->icon_index();
- // The image index (if not within bounds) will be set to the first image.
- if (index < 0 || index >= static_cast<int>(page_action_icons_.size()))
- index = 0;
- ImageView::SetImage(page_action_icons_[index]);
+ SkBitmap* icon = state->icon();
+ if (!icon) {
+ int index = state->icon_index();
+ // The image index (if not within bounds) will be set to the first image.
+ if (index < 0 || index >= static_cast<int>(page_action_icons_.size()))
+ index = 0;
+ icon = &page_action_icons_[index];
+ }
+ ImageView::SetImage(icon);
}
SetVisible(visible);
}
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698