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

Side by Side Diff: chrome/browser/ui/gtk/infobars/extension_infobar_gtk.cc

Issue 10824030: Move ExtensionHost into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Latest master for cq 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 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/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/platform_util.h" 10 #include "chrome/browser/platform_util.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 gtk_chrome_button_set_use_gtk_rendering(GTK_CHROME_BUTTON(button_), FALSE); 102 gtk_chrome_button_set_use_gtk_rendering(GTK_CHROME_BUTTON(button_), FALSE);
103 g_object_set_data(G_OBJECT(button_), "left-align-popup", 103 g_object_set_data(G_OBJECT(button_), "left-align-popup",
104 reinterpret_cast<void*>(true)); 104 reinterpret_cast<void*>(true));
105 105
106 icon_ = gtk_image_new(); 106 icon_ = gtk_image_new();
107 gtk_misc_set_alignment(GTK_MISC(icon_), 0.5, 0.5); 107 gtk_misc_set_alignment(GTK_MISC(icon_), 0.5, 0.5);
108 gtk_button_set_image(GTK_BUTTON(button_), icon_); 108 gtk_button_set_image(GTK_BUTTON(button_), icon_);
109 gtk_util::CenterWidgetInHBox(hbox_, button_, false, 0); 109 gtk_util::CenterWidgetInHBox(hbox_, button_, false, 0);
110 110
111 // Start loading the image for the menu button. 111 // Start loading the image for the menu button.
112 const extensions::Extension* extension = delegate_->extension_host()-> 112 const extensions::Extension* extension =
113 extension(); 113 delegate_->extension_host()->extension();
114 ExtensionResource icon_resource = extension->GetIconResource( 114 ExtensionResource icon_resource = extension->GetIconResource(
115 ExtensionIconSet::EXTENSION_ICON_BITTY, ExtensionIconSet::MATCH_EXACTLY); 115 ExtensionIconSet::EXTENSION_ICON_BITTY, ExtensionIconSet::MATCH_EXACTLY);
116 // Create a tracker to load the image. It will report back on OnImageLoaded. 116 // Create a tracker to load the image. It will report back on OnImageLoaded.
117 tracker_.LoadImage(extension, icon_resource, 117 tracker_.LoadImage(extension, icon_resource,
118 gfx::Size(ExtensionIconSet::EXTENSION_ICON_BITTY, 118 gfx::Size(ExtensionIconSet::EXTENSION_ICON_BITTY,
119 ExtensionIconSet::EXTENSION_ICON_BITTY), 119 ExtensionIconSet::EXTENSION_ICON_BITTY),
120 ImageLoadingTracker::DONT_CACHE); 120 ImageLoadingTracker::DONT_CACHE);
121 121
122 // Pad the bottom of the infobar by one pixel for the border. 122 // Pad the bottom of the infobar by one pixel for the border.
123 alignment_ = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); 123 alignment_ = gtk_alignment_new(0.0, 0.0, 1.0, 1.0);
124 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment_), 0, 1, 0, 0); 124 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment_), 0, 1, 0, 0);
125 gtk_box_pack_start(GTK_BOX(hbox_), alignment_, TRUE, TRUE, 0); 125 gtk_box_pack_start(GTK_BOX(hbox_), alignment_, TRUE, TRUE, 0);
126 126
127 ExtensionHost* extension_host = delegate_->extension_host(); 127 extensions::ExtensionHost* extension_host = delegate_->extension_host();
128 view_ = extension_host->view(); 128 view_ = extension_host->view();
129 129
130 if (gtk_widget_get_parent(view_->native_view())) { 130 if (gtk_widget_get_parent(view_->native_view())) {
131 gtk_widget_reparent(view_->native_view(), alignment_); 131 gtk_widget_reparent(view_->native_view(), alignment_);
132 } else { 132 } else {
133 gtk_container_add(GTK_CONTAINER(alignment_), view_->native_view()); 133 gtk_container_add(GTK_CONTAINER(alignment_), view_->native_view());
134 } 134 }
135 135
136 Signals()->Connect(button_, "button-press-event", 136 Signals()->Connect(button_, "button-press-event",
137 G_CALLBACK(&OnButtonPressThunk), this); 137 G_CALLBACK(&OnButtonPressThunk), this);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 // We also need to draw our infobar arrows over the renderer. 197 // We also need to draw our infobar arrows over the renderer.
198 static_cast<InfoBarContainerGtk*>(container())-> 198 static_cast<InfoBarContainerGtk*>(container())->
199 PaintInfobarBitsOn(sender, event, this); 199 PaintInfobarBitsOn(sender, event, this);
200 200
201 return FALSE; 201 return FALSE;
202 } 202 }
203 203
204 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarTabHelper* owner) { 204 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarTabHelper* owner) {
205 return new ExtensionInfoBarGtk(owner, this); 205 return new ExtensionInfoBarGtk(owner, this);
206 } 206 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/extensions/extension_view_gtk.cc ('k') | chrome/browser/ui/views/extensions/extension_dialog.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698