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

Side by Side Diff: chrome/browser/ui/views/infobars/extension_infobar.cc

Issue 11786003: Move Icons out of Extension class (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_unref_browser_action
Patch Set: Created 7 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/infobars/extension_infobar.h" 5 #include "chrome/browser/ui/views/infobars/extension_infobar.h"
6 6
7 #include "chrome/browser/extensions/extension_context_menu_model.h" 7 #include "chrome/browser/extensions/extension_context_menu_model.h"
8 #include "chrome/browser/extensions/extension_host.h" 8 #include "chrome/browser/extensions/extension_host.h"
9 #include "chrome/browser/extensions/extension_infobar_delegate.h" 9 #include "chrome/browser/extensions/extension_infobar_delegate.h"
10 #include "chrome/browser/platform_util.h" 10 #include "chrome/browser/platform_util.h"
11 #include "chrome/browser/ui/views/frame/browser_view.h" 11 #include "chrome/browser/ui/views/frame/browser_view.h"
12 #include "chrome/common/extensions/api/icons/icons_handler.h"
12 #include "chrome/common/extensions/extension.h" 13 #include "chrome/common/extensions/extension.h"
13 #include "chrome/common/extensions/extension_constants.h" 14 #include "chrome/common/extensions/extension_constants.h"
14 #include "chrome/common/extensions/extension_icon_set.h" 15 #include "chrome/common/extensions/extension_icon_set.h"
15 #include "chrome/common/extensions/extension_resource.h" 16 #include "chrome/common/extensions/extension_resource.h"
16 #include "grit/theme_resources.h" 17 #include "grit/theme_resources.h"
17 #include "ui/base/animation/slide_animation.h" 18 #include "ui/base/animation/slide_animation.h"
18 #include "ui/base/resource/resource_bundle.h" 19 #include "ui/base/resource/resource_bundle.h"
19 #include "ui/gfx/canvas.h" 20 #include "ui/gfx/canvas.h"
20 #include "ui/gfx/image/canvas_image_source.h" 21 #include "ui/gfx/image/canvas_image_source.h"
21 #include "ui/gfx/image/image.h" 22 #include "ui/gfx/image/image.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // This must happen after adding all other children so InfoBarView can ensure 126 // This must happen after adding all other children so InfoBarView can ensure
126 // the close button is the last child. 127 // the close button is the last child.
127 InfoBarView::ViewHierarchyChanged(is_add, parent, child); 128 InfoBarView::ViewHierarchyChanged(is_add, parent, child);
128 129
129 // This must happen after adding all children because it can trigger layout, 130 // This must happen after adding all children because it can trigger layout,
130 // which assumes that particular children (e.g. the close button) have already 131 // which assumes that particular children (e.g. the close button) have already
131 // been added. 132 // been added.
132 const extensions::Extension* extension = extension_host->extension(); 133 const extensions::Extension* extension = extension_host->extension();
133 extension_misc::ExtensionIcons image_size = 134 extension_misc::ExtensionIcons image_size =
134 extension_misc::EXTENSION_ICON_BITTY; 135 extension_misc::EXTENSION_ICON_BITTY;
135 ExtensionResource icon_resource = extension->GetIconResource( 136 ExtensionResource icon_resource = extensions::IconsInfo::GetIconResource(
136 image_size, ExtensionIconSet::MATCH_EXACTLY); 137 extension, image_size, ExtensionIconSet::MATCH_EXACTLY);
137 tracker_.LoadImage(extension, icon_resource, 138 tracker_.LoadImage(extension, icon_resource,
138 gfx::Size(image_size, image_size), ImageLoadingTracker::DONT_CACHE); 139 gfx::Size(image_size, image_size), ImageLoadingTracker::DONT_CACHE);
139 } 140 }
140 141
141 int ExtensionInfoBar::ContentMinimumWidth() const { 142 int ExtensionInfoBar::ContentMinimumWidth() const {
142 return menu_->GetPreferredSize().width() + kMenuHorizontalMargin; 143 return menu_->GetPreferredSize().width() + kMenuHorizontalMargin;
143 } 144 }
144 145
145 void ExtensionInfoBar::OnImageLoaded(const gfx::Image& image, 146 void ExtensionInfoBar::OnImageLoaded(const gfx::Image& image,
146 const std::string& extension_id, 147 const std::string& extension_id,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 183
183 scoped_refptr<ExtensionContextMenuModel> options_menu_contents = 184 scoped_refptr<ExtensionContextMenuModel> options_menu_contents =
184 new ExtensionContextMenuModel(extension, browser_); 185 new ExtensionContextMenuModel(extension, browser_);
185 DCHECK_EQ(menu_, source); 186 DCHECK_EQ(menu_, source);
186 RunMenuAt(options_menu_contents.get(), menu_, views::MenuItemView::TOPLEFT); 187 RunMenuAt(options_menu_contents.get(), menu_, views::MenuItemView::TOPLEFT);
187 } 188 }
188 189
189 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() { 190 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() {
190 return delegate_ ? delegate_->AsExtensionInfoBarDelegate() : NULL; 191 return delegate_ ? delegate_->AsExtensionInfoBarDelegate() : NULL;
191 } 192 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698