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

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, 9 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/extensions/image_loader.h" 10 #include "chrome/browser/extensions/image_loader.h"
11 #include "chrome/browser/platform_util.h" 11 #include "chrome/browser/platform_util.h"
12 #include "chrome/browser/ui/views/frame/browser_view.h" 12 #include "chrome/browser/ui/views/frame/browser_view.h"
13 #include "chrome/common/extensions/api/icons/icons_handler.h"
13 #include "chrome/common/extensions/extension.h" 14 #include "chrome/common/extensions/extension.h"
14 #include "chrome/common/extensions/extension_constants.h" 15 #include "chrome/common/extensions/extension_constants.h"
15 #include "chrome/common/extensions/extension_icon_set.h" 16 #include "chrome/common/extensions/extension_icon_set.h"
16 #include "chrome/common/extensions/extension_resource.h" 17 #include "chrome/common/extensions/extension_resource.h"
17 #include "grit/theme_resources.h" 18 #include "grit/theme_resources.h"
18 #include "ui/base/animation/slide_animation.h" 19 #include "ui/base/animation/slide_animation.h"
19 #include "ui/base/resource/resource_bundle.h" 20 #include "ui/base/resource/resource_bundle.h"
20 #include "ui/gfx/canvas.h" 21 #include "ui/gfx/canvas.h"
21 #include "ui/gfx/image/canvas_image_source.h" 22 #include "ui/gfx/image/canvas_image_source.h"
22 #include "ui/gfx/image/image.h" 23 #include "ui/gfx/image/image.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 // This must happen after adding all other children so InfoBarView can ensure 139 // This must happen after adding all other children so InfoBarView can ensure
139 // the close button is the last child. 140 // the close button is the last child.
140 InfoBarView::ViewHierarchyChanged(is_add, parent, child); 141 InfoBarView::ViewHierarchyChanged(is_add, parent, child);
141 142
142 // This must happen after adding all children because it can trigger layout, 143 // This must happen after adding all children because it can trigger layout,
143 // which assumes that particular children (e.g. the close button) have already 144 // which assumes that particular children (e.g. the close button) have already
144 // been added. 145 // been added.
145 const extensions::Extension* extension = extension_host->extension(); 146 const extensions::Extension* extension = extension_host->extension();
146 extension_misc::ExtensionIcons image_size = 147 extension_misc::ExtensionIcons image_size =
147 extension_misc::EXTENSION_ICON_BITTY; 148 extension_misc::EXTENSION_ICON_BITTY;
148 ExtensionResource icon_resource = extension->GetIconResource( 149 ExtensionResource icon_resource = extensions::IconsInfo::GetIconResource(
149 image_size, ExtensionIconSet::MATCH_EXACTLY); 150 extension, image_size, ExtensionIconSet::MATCH_EXACTLY);
150 extensions::ImageLoader* loader = 151 extensions::ImageLoader* loader =
151 extensions::ImageLoader::Get(extension_host->profile()); 152 extensions::ImageLoader::Get(extension_host->profile());
152 loader->LoadImageAsync( 153 loader->LoadImageAsync(
153 extension, 154 extension,
154 icon_resource, 155 icon_resource,
155 gfx::Size(image_size, image_size), 156 gfx::Size(image_size, image_size),
156 base::Bind(&ExtensionInfoBar::OnImageLoaded, 157 base::Bind(&ExtensionInfoBar::OnImageLoaded,
157 weak_ptr_factory_.GetWeakPtr())); 158 weak_ptr_factory_.GetWeakPtr()));
158 } 159 }
159 160
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 } 207 }
207 208
208 infobar_icon_->SetVisible(true); 209 infobar_icon_->SetVisible(true);
209 210
210 Layout(); 211 Layout();
211 } 212 }
212 213
213 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() { 214 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() {
214 return delegate_ ? delegate_->AsExtensionInfoBarDelegate() : NULL; 215 return delegate_ ? delegate_->AsExtensionInfoBarDelegate() : NULL;
215 } 216 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698