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/ui/gtk/bubble/bubble_gtk.h" | 11 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h" |
12 #include "chrome/browser/ui/gtk/extensions/extension_view_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; |
| 19 |
| 20 namespace extensions { |
18 class ExtensionHost; | 21 class ExtensionHost; |
19 class GURL; | 22 } |
20 | 23 |
21 class ExtensionPopupGtk : public content::NotificationObserver, | 24 class ExtensionPopupGtk : public content::NotificationObserver, |
22 public BubbleDelegateGtk, | 25 public BubbleDelegateGtk, |
23 public ExtensionViewGtk::Container { | 26 public ExtensionViewGtk::Container { |
24 public: | 27 public: |
25 enum ShowAction { | 28 enum ShowAction { |
26 SHOW, | 29 SHOW, |
27 SHOW_AND_INSPECT | 30 SHOW_AND_INSPECT |
28 }; | 31 }; |
29 | 32 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 } | 64 } |
62 | 65 |
63 // Declared here for testing. | 66 // Declared here for testing. |
64 static const int kMinWidth; | 67 static const int kMinWidth; |
65 static const int kMinHeight; | 68 static const int kMinHeight; |
66 static const int kMaxWidth; | 69 static const int kMaxWidth; |
67 static const int kMaxHeight; | 70 static const int kMaxHeight; |
68 | 71 |
69 private: | 72 private: |
70 ExtensionPopupGtk(Browser* browser, | 73 ExtensionPopupGtk(Browser* browser, |
71 ExtensionHost* host, | 74 extensions::ExtensionHost* host, |
72 GtkWidget* anchor, | 75 GtkWidget* anchor, |
73 ShowAction show_action); | 76 ShowAction show_action); |
74 virtual ~ExtensionPopupGtk(); | 77 virtual ~ExtensionPopupGtk(); |
75 | 78 |
76 // Shows the popup widget. Called after loading completes. | 79 // Shows the popup widget. Called after loading completes. |
77 void ShowPopup(); | 80 void ShowPopup(); |
78 | 81 |
79 // See DestroyPopup. Does not return success or failure. Necessitated by | 82 // See DestroyPopup. Does not return success or failure. Necessitated by |
80 // base::Bind and friends, which cannot handle a WeakPtr for a function that | 83 // base::Bind and friends, which cannot handle a WeakPtr for a function that |
81 // has a return value. | 84 // has a return value. |
82 void DestroyPopupWithoutResult(); | 85 void DestroyPopupWithoutResult(); |
83 | 86 |
84 Browser* browser_; | 87 Browser* browser_; |
85 | 88 |
86 BubbleGtk* bubble_; | 89 BubbleGtk* bubble_; |
87 | 90 |
88 // We take ownership of the popup ExtensionHost. | 91 // We take ownership of the popup ExtensionHost. |
89 scoped_ptr<ExtensionHost> host_; | 92 scoped_ptr<extensions::ExtensionHost> host_; |
90 | 93 |
91 // The widget for anchoring the position of the bubble. | 94 // The widget for anchoring the position of the bubble. |
92 GtkWidget* anchor_; | 95 GtkWidget* anchor_; |
93 | 96 |
94 content::NotificationRegistrar registrar_; | 97 content::NotificationRegistrar registrar_; |
95 | 98 |
96 static ExtensionPopupGtk* current_extension_popup_; | 99 static ExtensionPopupGtk* current_extension_popup_; |
97 | 100 |
98 // Whether a devtools window is attached to this bubble. | 101 // Whether a devtools window is attached to this bubble. |
99 bool being_inspected_; | 102 bool being_inspected_; |
100 | 103 |
101 base::WeakPtrFactory<ExtensionPopupGtk> weak_factory_; | 104 base::WeakPtrFactory<ExtensionPopupGtk> weak_factory_; |
102 | 105 |
103 // Used for testing. --------------------------------------------------------- | 106 // Used for testing. --------------------------------------------------------- |
104 gfx::Rect GetViewBounds(); | 107 gfx::Rect GetViewBounds(); |
105 | 108 |
106 friend class BrowserActionTestUtil; | 109 friend class BrowserActionTestUtil; |
107 | 110 |
108 DISALLOW_COPY_AND_ASSIGN(ExtensionPopupGtk); | 111 DISALLOW_COPY_AND_ASSIGN(ExtensionPopupGtk); |
109 }; | 112 }; |
110 | 113 |
111 #endif // CHROME_BROWSER_UI_GTK_EXTENSIONS_EXTENSION_POPUP_GTK_H_ | 114 #endif // CHROME_BROWSER_UI_GTK_EXTENSIONS_EXTENSION_POPUP_GTK_H_ |
OLD | NEW |