OLD | NEW |
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/gtk/infobars/extension_infobar_gtk.h" | 5 #include "chrome/browser/ui/gtk/infobars/extension_infobar_gtk.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "chrome/browser/extensions/extension_context_menu_model.h" | 8 #include "chrome/browser/extensions/extension_context_menu_model.h" |
9 #include "chrome/browser/extensions/extension_host.h" | 9 #include "chrome/browser/extensions/extension_host.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/gtk/browser_window_gtk.h" | 12 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
13 #include "chrome/browser/ui/gtk/custom_button.h" | 13 #include "chrome/browser/ui/gtk/custom_button.h" |
14 #include "chrome/browser/ui/gtk/gtk_chrome_button.h" | 14 #include "chrome/browser/ui/gtk/gtk_chrome_button.h" |
15 #include "chrome/browser/ui/gtk/gtk_util.h" | 15 #include "chrome/browser/ui/gtk/gtk_util.h" |
16 #include "chrome/browser/ui/gtk/infobars/infobar_container_gtk.h" | 16 #include "chrome/browser/ui/gtk/infobars/infobar_container_gtk.h" |
17 #include "chrome/common/extensions/api/icons/icons_handler.h" | 17 #include "chrome/common/extensions/api/icons/icons_handler.h" |
18 #include "chrome/common/extensions/extension.h" | 18 #include "chrome/common/extensions/extension.h" |
19 #include "chrome/common/extensions/extension_constants.h" | 19 #include "chrome/common/extensions/extension_constants.h" |
20 #include "chrome/common/extensions/extension_icon_set.h" | 20 #include "chrome/common/extensions/extension_icon_set.h" |
21 #include "chrome/common/extensions/extension_resource.h" | |
22 #include "content/public/browser/render_view_host.h" | 21 #include "content/public/browser/render_view_host.h" |
23 #include "content/public/browser/render_widget_host_view.h" | 22 #include "content/public/browser/render_widget_host_view.h" |
| 23 #include "extensions/common/extension_resource.h" |
24 #include "grit/theme_resources.h" | 24 #include "grit/theme_resources.h" |
25 #include "ui/base/gtk/gtk_signal_registrar.h" | 25 #include "ui/base/gtk/gtk_signal_registrar.h" |
26 #include "ui/base/resource/resource_bundle.h" | 26 #include "ui/base/resource/resource_bundle.h" |
27 #include "ui/gfx/canvas.h" | 27 #include "ui/gfx/canvas.h" |
28 #include "ui/gfx/gtk_util.h" | 28 #include "ui/gfx/gtk_util.h" |
29 #include "ui/gfx/image/image.h" | 29 #include "ui/gfx/image/image.h" |
30 | 30 |
31 ExtensionInfoBarGtk::ExtensionInfoBarGtk(InfoBarService* owner, | 31 ExtensionInfoBarGtk::ExtensionInfoBarGtk(InfoBarService* owner, |
32 ExtensionInfoBarDelegate* delegate) | 32 ExtensionInfoBarDelegate* delegate) |
33 : InfoBarGtk(owner, delegate), | 33 : InfoBarGtk(owner, delegate), |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 g_object_set_data(G_OBJECT(button_), "left-align-popup", | 123 g_object_set_data(G_OBJECT(button_), "left-align-popup", |
124 reinterpret_cast<void*>(true)); | 124 reinterpret_cast<void*>(true)); |
125 | 125 |
126 gtk_button_set_image(GTK_BUTTON(button_), icon_); | 126 gtk_button_set_image(GTK_BUTTON(button_), icon_); |
127 gtk_util::CenterWidgetInHBox(hbox_, button_, false, 0); | 127 gtk_util::CenterWidgetInHBox(hbox_, button_, false, 0); |
128 } else { | 128 } else { |
129 gtk_util::CenterWidgetInHBox(hbox_, icon_, false, 0); | 129 gtk_util::CenterWidgetInHBox(hbox_, icon_, false, 0); |
130 } | 130 } |
131 | 131 |
132 // Start loading the image for the menu button. | 132 // Start loading the image for the menu button. |
133 ExtensionResource icon_resource = extensions::IconsInfo::GetIconResource( | 133 extensions::ExtensionResource icon_resource = |
134 extension, | 134 extensions::IconsInfo::GetIconResource( |
135 extension_misc::EXTENSION_ICON_BITTY, | 135 extension, |
136 ExtensionIconSet::MATCH_EXACTLY); | 136 extension_misc::EXTENSION_ICON_BITTY, |
| 137 ExtensionIconSet::MATCH_EXACTLY); |
137 // Load image asynchronously, calling back OnImageLoaded. | 138 // Load image asynchronously, calling back OnImageLoaded. |
138 extensions::ImageLoader* loader = | 139 extensions::ImageLoader* loader = |
139 extensions::ImageLoader::Get(delegate_->extension_host()->profile()); | 140 extensions::ImageLoader::Get(delegate_->extension_host()->profile()); |
140 loader->LoadImageAsync(extension, icon_resource, | 141 loader->LoadImageAsync(extension, icon_resource, |
141 gfx::Size(extension_misc::EXTENSION_ICON_BITTY, | 142 gfx::Size(extension_misc::EXTENSION_ICON_BITTY, |
142 extension_misc::EXTENSION_ICON_BITTY), | 143 extension_misc::EXTENSION_ICON_BITTY), |
143 base::Bind(&ExtensionInfoBarGtk::OnImageLoaded, | 144 base::Bind(&ExtensionInfoBarGtk::OnImageLoaded, |
144 weak_ptr_factory_.GetWeakPtr())); | 145 weak_ptr_factory_.GetWeakPtr())); |
145 | 146 |
146 // Pad the bottom of the infobar by one pixel for the border. | 147 // Pad the bottom of the infobar by one pixel for the border. |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 // We also need to draw our infobar arrows over the renderer. | 231 // We also need to draw our infobar arrows over the renderer. |
231 static_cast<InfoBarContainerGtk*>(container())-> | 232 static_cast<InfoBarContainerGtk*>(container())-> |
232 PaintInfobarBitsOn(sender, event, this); | 233 PaintInfobarBitsOn(sender, event, this); |
233 | 234 |
234 return FALSE; | 235 return FALSE; |
235 } | 236 } |
236 | 237 |
237 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarService* owner) { | 238 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarService* owner) { |
238 return new ExtensionInfoBarGtk(owner, this); | 239 return new ExtensionInfoBarGtk(owner, this); |
239 } | 240 } |
OLD | NEW |