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

Unified Diff: chrome/browser/ui/gtk/location_bar_view_gtk.cc

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: . Created 8 years, 4 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/gtk/location_bar_view_gtk.cc
diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.cc b/chrome/browser/ui/gtk/location_bar_view_gtk.cc
index edf23a6f18569438412fed5d2dcad216732ba0d0..60084eaf6c28b16784e0fce194e03ff129f40186 100644
--- a/chrome/browser/ui/gtk/location_bar_view_gtk.cc
+++ b/chrome/browser/ui/gtk/location_bar_view_gtk.cc
@@ -1799,7 +1799,6 @@ LocationBarViewGtk::PageActionViewGtk::PageActionViewGtk(
ExtensionAction* page_action)
: owner_(NULL),
page_action_(page_action),
- tracker_(this),
current_tab_id_(-1),
window_(NULL),
accel_group_(NULL),
@@ -1830,19 +1829,7 @@ LocationBarViewGtk::PageActionViewGtk::PageActionViewGtk(
false);
DCHECK(extension);
- // Load all the icons declared in the manifest. This is the contents of the
- // icons array, plus the default_icon property, if any.
- std::vector<std::string> icon_paths(*page_action->icon_paths());
- if (!page_action_->default_icon_path().empty())
- icon_paths.push_back(page_action_->default_icon_path());
-
- for (std::vector<std::string>::iterator iter = icon_paths.begin();
- iter != icon_paths.end(); ++iter) {
- tracker_.LoadImage(extension, extension->GetResource(*iter),
- gfx::Size(Extension::kPageActionIconMaxSize,
- Extension::kPageActionIconMaxSize),
- ImageLoadingTracker::DONT_CACHE);
- }
+ icon_factory_.reset(new ExtensionActionIconFactory(extension, this));
// We set the owner last of all so that we can determine whether we are in
// the process of initializing this class or not.
@@ -1875,7 +1862,8 @@ void LocationBarViewGtk::PageActionViewGtk::UpdateVisibility(
page_action_->GetTitle(current_tab_id_).c_str());
// Set the image.
- gfx::Image icon = page_action_->GetIcon(current_tab_id_);
+ gfx::Image icon =
+ page_action_->GetIcon(current_tab_id_, icon_factory_.get());
if (!icon.IsEmpty()) {
GdkPixbuf* pixbuf = icon.ToGdkPixbuf();
DCHECK(pixbuf);
@@ -1897,24 +1885,7 @@ void LocationBarViewGtk::PageActionViewGtk::UpdateVisibility(
}
}
-void LocationBarViewGtk::PageActionViewGtk::OnImageLoaded(
- const gfx::Image& image,
- const std::string& extension_id,
- int index) {
- // We loaded icons()->size() icons, plus one extra if the page action had
- // a default icon.
- int total_icons = static_cast<int>(page_action_->icon_paths()->size());
- if (!page_action_->default_icon_path().empty())
- total_icons++;
- DCHECK(index < total_icons);
-
- // Map the index of the loaded image back to its name. If we ever get an
- // index greater than the number of icons, it must be the default icon.
- if (index < static_cast<int>(page_action_->icon_paths()->size()))
- page_action_->CacheIcon(page_action_->icon_paths()->at(index), image);
- else
- page_action_->CacheIcon(page_action_->default_icon_path(), image);
-
+void LocationBarViewGtk::PageActionViewGtk::OnIconUpdated() {
// If we have no owner, that means this class is still being constructed.
TabContents* tab_contents = owner_ ? owner_->GetTabContents() : NULL;
if (tab_contents)

Powered by Google App Engine
This is Rietveld 408576698