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

Unified Diff: chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm

Issue 10905005: Change browser/page action default icon defined in manifest to support hidpi. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: disable unittest on android Created 8 years, 3 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
Index: chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm
diff --git a/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm b/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm
index 4027e9753c772c4f4a89ec9822ea5f0b04be7f32..2866f959623099226b486cc303c9c3b08ca7ecaa 100644
--- a/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm
@@ -49,7 +49,6 @@ PageActionDecoration::PageActionDecoration(
: owner_(NULL),
browser_(browser),
page_action_(page_action),
- tracker_(this),
current_tab_id_(-1),
preview_enabled_(false),
ALLOW_THIS_IN_INITIALIZER_LIST(scoped_icon_animation_observer_(
@@ -60,13 +59,8 @@ PageActionDecoration::PageActionDecoration(
GetExtensionById(page_action->extension_id(), false);
DCHECK(extension);
- std::string path = page_action_->default_icon_path();
- if (!path.empty()) {
- tracker_.LoadImage(extension, extension->GetResource(path),
- gfx::Size(Extension::kPageActionIconMaxSize,
- Extension::kPageActionIconMaxSize),
- ImageLoadingTracker::DONT_CACHE);
- }
+ icon_factory_.reset(
+ new ExtensionActionIconFactory(extension, page_action, this));
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE,
content::Source<Profile>(browser_->profile()));
@@ -135,11 +129,7 @@ bool PageActionDecoration::ActivatePageAction(NSRect frame) {
return true;
}
-void PageActionDecoration::OnImageLoaded(const gfx::Image& image,
- const std::string& extension_id,
- int index) {
- page_action_->CacheIcon(image);
-
+void PageActionDecoration::OnIconUpdated() {
// If we have no owner, that means this class is still being constructed.
TabContents* tab_contents = owner_ ? owner_->GetTabContents() : NULL;
if (tab_contents) {
@@ -161,7 +151,7 @@ void PageActionDecoration::UpdateVisibility(WebContents* contents,
SetToolTip(page_action_->GetTitle(current_tab_id_));
// Set the image.
- gfx::Image icon = page_action_->GetIcon(current_tab_id_);
+ gfx::Image icon = icon_factory_->GetIcon(current_tab_id_);
if (!icon.IsEmpty()) {
SetImage(icon.ToNSImage());
} else if (!GetImage()) {
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/page_action_decoration.h ('k') | chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698