| 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/extensions/extension_popup_gtk.h" | 5 #include "chrome/browser/ui/gtk/extensions/extension_popup_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 ExtensionPopupGtk::ExtensionPopupGtk(Browser* browser, | 42 ExtensionPopupGtk::ExtensionPopupGtk(Browser* browser, |
| 43 extensions::ExtensionHost* host, | 43 extensions::ExtensionHost* host, |
| 44 GtkWidget* anchor, | 44 GtkWidget* anchor, |
| 45 ShowAction show_action) | 45 ShowAction show_action) |
| 46 : browser_(browser), | 46 : browser_(browser), |
| 47 bubble_(NULL), | 47 bubble_(NULL), |
| 48 host_(host), | 48 host_(host), |
| 49 anchor_(anchor), | 49 anchor_(anchor), |
| 50 weak_factory_(this) { | 50 weak_factory_(this) { |
| 51 host_->view()->SetContainer(this); | 51 host_->GetExtensionView()->SetContainer(this); |
| 52 being_inspected_ = show_action == SHOW_AND_INSPECT; | 52 being_inspected_ = show_action == SHOW_AND_INSPECT; |
| 53 | 53 |
| 54 // If the host had somehow finished loading, then we'd miss the notification | 54 // If the host had somehow finished loading, then we'd miss the notification |
| 55 // and not show. This seems to happen in single-process mode. | 55 // and not show. This seems to happen in single-process mode. |
| 56 if (host->did_stop_loading()) { | 56 if (host->did_stop_loading()) { |
| 57 ShowPopup(); | 57 ShowPopup(); |
| 58 } else { | 58 } else { |
| 59 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, | 59 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, |
| 60 content::Source<Profile>(host->profile())); | 60 content::Source<Profile>(host->profile())); |
| 61 } | 61 } |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 177 |
| 178 // We'll be in the upper-right corner of the window for LTR languages, so we | 178 // We'll be in the upper-right corner of the window for LTR languages, so we |
| 179 // want to put the arrow at the upper-right corner of the bubble to match the | 179 // want to put the arrow at the upper-right corner of the bubble to match the |
| 180 // page and app menus. | 180 // page and app menus. |
| 181 BubbleGtk::ArrowLocationGtk arrow_location = | 181 BubbleGtk::ArrowLocationGtk arrow_location = |
| 182 !base::i18n::IsRTL() ? | 182 !base::i18n::IsRTL() ? |
| 183 BubbleGtk::ARROW_LOCATION_TOP_RIGHT : | 183 BubbleGtk::ARROW_LOCATION_TOP_RIGHT : |
| 184 BubbleGtk::ARROW_LOCATION_TOP_LEFT; | 184 BubbleGtk::ARROW_LOCATION_TOP_LEFT; |
| 185 bubble_ = BubbleGtk::Show(anchor_, | 185 bubble_ = BubbleGtk::Show(anchor_, |
| 186 NULL, | 186 NULL, |
| 187 host_->view()->native_view(), | 187 host_->GetExtensionView()->GetNativeView(), |
| 188 arrow_location, | 188 arrow_location, |
| 189 being_inspected_ ? 0 : | 189 being_inspected_ ? 0 : |
| 190 BubbleGtk::POPUP_WINDOW | BubbleGtk::GRAB_INPUT, | 190 BubbleGtk::POPUP_WINDOW | BubbleGtk::GRAB_INPUT, |
| 191 GtkThemeService::GetFrom(browser_->profile()), | 191 GtkThemeService::GetFrom(browser_->profile()), |
| 192 this); | 192 this); |
| 193 } | 193 } |
| 194 | 194 |
| 195 void ExtensionPopupGtk::DestroyPopupWithoutResult() { | 195 void ExtensionPopupGtk::DestroyPopupWithoutResult() { |
| 196 DestroyPopup(); | 196 DestroyPopup(); |
| 197 } | 197 } |
| 198 | 198 |
| 199 gfx::Rect ExtensionPopupGtk::GetViewBounds() { | 199 gfx::Rect ExtensionPopupGtk::GetViewBounds() { |
| 200 GtkAllocation allocation; | 200 GtkAllocation allocation; |
| 201 gtk_widget_get_allocation(host_->view()->native_view(), &allocation); | 201 gtk_widget_get_allocation(host_->GetExtensionView()->GetNativeView(), |
| 202 &allocation); |
| 202 return gfx::Rect(allocation); | 203 return gfx::Rect(allocation); |
| 203 } | 204 } |
| OLD | NEW |