| 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 #ifndef CHROME_BROWSER_UI_GTK_EXTENSIONS_EXTENSION_POPUP_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_EXTENSIONS_EXTENSION_POPUP_GTK_H_ |
| 6 #define CHROME_BROWSER_UI_GTK_EXTENSIONS_EXTENSION_POPUP_GTK_H_ | 6 #define CHROME_BROWSER_UI_GTK_EXTENSIONS_EXTENSION_POPUP_GTK_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "chrome/browser/extensions/extension_view_container.h" |
| 11 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h" | 12 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h" |
| 12 #include "chrome/browser/ui/gtk/extensions/extension_view_gtk.h" | |
| 13 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
| 14 #include "content/public/browser/notification_registrar.h" | 14 #include "content/public/browser/notification_registrar.h" |
| 15 #include "ui/gfx/rect.h" | 15 #include "ui/gfx/rect.h" |
| 16 | 16 |
| 17 class Browser; | 17 class Browser; |
| 18 class GURL; | 18 class GURL; |
| 19 | 19 |
| 20 namespace extensions { | 20 namespace extensions { |
| 21 class ExtensionHost; | 21 class ExtensionHost; |
| 22 } | 22 } |
| 23 | 23 |
| 24 class ExtensionPopupGtk : public content::NotificationObserver, | 24 class ExtensionPopupGtk : public content::NotificationObserver, |
| 25 public BubbleDelegateGtk, | 25 public BubbleDelegateGtk, |
| 26 public ExtensionViewGtk::Container { | 26 public ExtensionViewContainer { |
| 27 public: | 27 public: |
| 28 enum ShowAction { | 28 enum ShowAction { |
| 29 SHOW, | 29 SHOW, |
| 30 SHOW_AND_INSPECT | 30 SHOW_AND_INSPECT |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 static void Show(const GURL& url, | 33 static void Show(const GURL& url, |
| 34 Browser* browser, | 34 Browser* browser, |
| 35 GtkWidget* anchor, | 35 GtkWidget* anchor, |
| 36 ShowAction show_action); | 36 ShowAction show_action); |
| 37 | 37 |
| 38 // content::NotificationObserver implementation. | 38 // content::NotificationObserver implementation. |
| 39 virtual void Observe(int type, | 39 virtual void Observe(int type, |
| 40 const content::NotificationSource& source, | 40 const content::NotificationSource& source, |
| 41 const content::NotificationDetails& details) OVERRIDE; | 41 const content::NotificationDetails& details) OVERRIDE; |
| 42 | 42 |
| 43 // BubbleDelegateGtk implementation. | 43 // BubbleDelegateGtk implementation. |
| 44 virtual void BubbleClosing(BubbleGtk* bubble, | 44 virtual void BubbleClosing(BubbleGtk* bubble, |
| 45 bool closed_by_escape) OVERRIDE; | 45 bool closed_by_escape) OVERRIDE; |
| 46 | 46 |
| 47 // ExtensionViewGtk::Container implementation. | 47 // ExtensionViewContainer implementation. |
| 48 virtual void OnExtensionSizeChanged( | 48 virtual void OnExtensionSizeChanged(ExtensionView* view, |
| 49 ExtensionViewGtk* view, | 49 const gfx::Size& new_size) OVERRIDE; |
| 50 const gfx::Size& new_size) OVERRIDE; | 50 virtual void OnExtensionViewDidShow(ExtensionView* view) OVERRIDE; |
| 51 | 51 |
| 52 // Destroys the popup widget. This will in turn destroy us since we delete | 52 // Destroys the popup widget. This will in turn destroy us since we delete |
| 53 // ourselves when the bubble closes. Returns true if we successfully | 53 // ourselves when the bubble closes. Returns true if we successfully |
| 54 // closed the bubble. | 54 // closed the bubble. |
| 55 bool DestroyPopup(); | 55 bool DestroyPopup(); |
| 56 | 56 |
| 57 // Get the currently showing extension popup, or NULL. | 57 // Get the currently showing extension popup, or NULL. |
| 58 static ExtensionPopupGtk* get_current_extension_popup() { | 58 static ExtensionPopupGtk* get_current_extension_popup() { |
| 59 return current_extension_popup_; | 59 return current_extension_popup_; |
| 60 } | 60 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 // Used for testing. --------------------------------------------------------- | 106 // Used for testing. --------------------------------------------------------- |
| 107 gfx::Rect GetViewBounds(); | 107 gfx::Rect GetViewBounds(); |
| 108 | 108 |
| 109 friend class BrowserActionTestUtil; | 109 friend class BrowserActionTestUtil; |
| 110 | 110 |
| 111 DISALLOW_COPY_AND_ASSIGN(ExtensionPopupGtk); | 111 DISALLOW_COPY_AND_ASSIGN(ExtensionPopupGtk); |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 #endif // CHROME_BROWSER_UI_GTK_EXTENSIONS_EXTENSION_POPUP_GTK_H_ | 114 #endif // CHROME_BROWSER_UI_GTK_EXTENSIONS_EXTENSION_POPUP_GTK_H_ |
| OLD | NEW |