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

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

Issue 10914244: Remove support for page_action.icons, and the legacy code surrounding it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: constants removed 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 53292773ca13789b7274c1c2df3b310b3054abc7..4027e9753c772c4f4a89ec9822ea5f0b04be7f32 100644
--- a/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm
@@ -60,15 +60,9 @@ PageActionDecoration::PageActionDecoration(
GetExtensionById(page_action->extension_id(), 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),
+ 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);
@@ -144,19 +138,7 @@ bool PageActionDecoration::ActivatePageAction(NSRect frame) {
void PageActionDecoration::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);
+ page_action_->CacheIcon(image);
// If we have no owner, that means this class is still being constructed.
TabContents* tab_contents = owner_ ? owner_->GetTabContents() : NULL;
« no previous file with comments | « chrome/browser/ui/cocoa/extensions/browser_action_button.mm ('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