| 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/infobars/infobar_tab_helper.h" | 10 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 gfx::Size(extension_misc::EXTENSION_ICON_BITTY, | 120 gfx::Size(extension_misc::EXTENSION_ICON_BITTY, |
| 121 extension_misc::EXTENSION_ICON_BITTY), | 121 extension_misc::EXTENSION_ICON_BITTY), |
| 122 ImageLoadingTracker::DONT_CACHE); | 122 ImageLoadingTracker::DONT_CACHE); |
| 123 | 123 |
| 124 // Pad the bottom of the infobar by one pixel for the border. | 124 // Pad the bottom of the infobar by one pixel for the border. |
| 125 alignment_ = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); | 125 alignment_ = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); |
| 126 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment_), 0, 1, 0, 0); | 126 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment_), 0, 1, 0, 0); |
| 127 gtk_box_pack_start(GTK_BOX(hbox_), alignment_, TRUE, TRUE, 0); | 127 gtk_box_pack_start(GTK_BOX(hbox_), alignment_, TRUE, TRUE, 0); |
| 128 | 128 |
| 129 extensions::ExtensionHost* extension_host = delegate_->extension_host(); | 129 extensions::ExtensionHost* extension_host = delegate_->extension_host(); |
| 130 view_ = extension_host->view(); | 130 view_ = extension_host->GetExtensionView(); |
| 131 | 131 |
| 132 if (gtk_widget_get_parent(view_->native_view())) { | 132 if (gtk_widget_get_parent(view_->native_view())) { |
| 133 gtk_widget_reparent(view_->native_view(), alignment_); | 133 gtk_widget_reparent(view_->native_view(), alignment_); |
| 134 } else { | 134 } else { |
| 135 gtk_container_add(GTK_CONTAINER(alignment_), view_->native_view()); | 135 gtk_container_add(GTK_CONTAINER(alignment_), view_->native_view()); |
| 136 } | 136 } |
| 137 | 137 |
| 138 Signals()->Connect(button_, "button-press-event", | 138 Signals()->Connect(button_, "button-press-event", |
| 139 G_CALLBACK(&OnButtonPressThunk), this); | 139 G_CALLBACK(&OnButtonPressThunk), this); |
| 140 Signals()->Connect(view_->native_view(), "expose-event", | 140 Signals()->Connect(view_->native_view(), "expose-event", |
| (...skipping 24 matching lines...) Expand all Loading... |
| 165 if (!browser) | 165 if (!browser) |
| 166 return NULL; | 166 return NULL; |
| 167 | 167 |
| 168 return new ExtensionContextMenuModel(extension, browser); | 168 return new ExtensionContextMenuModel(extension, browser); |
| 169 } | 169 } |
| 170 | 170 |
| 171 void ExtensionInfoBarGtk::OnSizeAllocate(GtkWidget* widget, | 171 void ExtensionInfoBarGtk::OnSizeAllocate(GtkWidget* widget, |
| 172 GtkAllocation* allocation) { | 172 GtkAllocation* allocation) { |
| 173 gfx::Size new_size(allocation->width, allocation->height); | 173 gfx::Size new_size(allocation->width, allocation->height); |
| 174 | 174 |
| 175 delegate_->extension_host()->view()->render_view_host()->GetView() | 175 delegate_->extension_host()->GetExtensionView()->render_view_host()->GetView() |
| 176 ->SetSize(new_size); | 176 ->SetSize(new_size); |
| 177 } | 177 } |
| 178 | 178 |
| 179 gboolean ExtensionInfoBarGtk::OnButtonPress(GtkWidget* widget, | 179 gboolean ExtensionInfoBarGtk::OnButtonPress(GtkWidget* widget, |
| 180 GdkEventButton* event) { | 180 GdkEventButton* event) { |
| 181 if (event->button != 1) | 181 if (event->button != 1) |
| 182 return FALSE; | 182 return FALSE; |
| 183 | 183 |
| 184 ui::MenuModel* model = BuildMenuModel(); | 184 ui::MenuModel* model = BuildMenuModel(); |
| 185 if (!model) | 185 if (!model) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 199 // We also need to draw our infobar arrows over the renderer. | 199 // We also need to draw our infobar arrows over the renderer. |
| 200 static_cast<InfoBarContainerGtk*>(container())-> | 200 static_cast<InfoBarContainerGtk*>(container())-> |
| 201 PaintInfobarBitsOn(sender, event, this); | 201 PaintInfobarBitsOn(sender, event, this); |
| 202 | 202 |
| 203 return FALSE; | 203 return FALSE; |
| 204 } | 204 } |
| 205 | 205 |
| 206 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarService* owner) { | 206 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarService* owner) { |
| 207 return new ExtensionInfoBarGtk(static_cast<InfoBarTabHelper*>(owner), this); | 207 return new ExtensionInfoBarGtk(static_cast<InfoBarTabHelper*>(owner), this); |
| 208 } | 208 } |
| OLD | NEW |