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_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 public content::NotificationObserver, | 33 public content::NotificationObserver, |
34 public TabStripModelObserver { | 34 public TabStripModelObserver { |
35 public: | 35 public: |
36 enum ShowAction { | 36 enum ShowAction { |
37 SHOW, | 37 SHOW, |
38 SHOW_AND_INSPECT, | 38 SHOW_AND_INSPECT, |
39 }; | 39 }; |
40 | 40 |
41 ~ExtensionPopup() override; | 41 ~ExtensionPopup() override; |
42 | 42 |
43 // Create and show a popup with |url| positioned adjacent to |anchor_view|. | 43 // Create and show a popup with the given |host| positioned adjacent to |
44 // |browser| is the browser to which the pop-up will be attached. NULL is a | 44 // |anchor_view|. |
45 // valid parameter for pop-ups not associated with a browser. | |
46 // The positioning of the pop-up is determined by |arrow| according to the | 45 // The positioning of the pop-up is determined by |arrow| according to the |
47 // following logic: The popup is anchored so that the corner indicated by the | 46 // following logic: The popup is anchored so that the corner indicated by the |
48 // value of |arrow| remains fixed during popup resizes. If |arrow| is | 47 // value of |arrow| remains fixed during popup resizes. If |arrow| is |
49 // BOTTOM_*, then the popup 'pops up', otherwise the popup 'drops down'. | 48 // BOTTOM_*, then the popup 'pops up', otherwise the popup 'drops down'. |
50 // The actual display of the popup is delayed until the page contents | 49 // The actual display of the popup is delayed until the page contents |
51 // finish loading in order to minimize UI flashing and resizing. | 50 // finish loading in order to minimize UI flashing and resizing. |
52 static ExtensionPopup* ShowPopup(const GURL& url, | 51 static ExtensionPopup* ShowPopup( |
53 Browser* browser, | 52 scoped_ptr<extensions::ExtensionViewHost> host, |
54 views::View* anchor_view, | 53 views::View* anchor_view, |
55 views::BubbleBorder::Arrow arrow, | 54 views::BubbleBorder::Arrow arrow, |
56 ShowAction show_action); | 55 ShowAction show_action); |
| 56 |
57 | 57 |
58 extensions::ExtensionViewHost* host() const { return host_.get(); } | 58 extensions::ExtensionViewHost* host() const { return host_.get(); } |
59 | 59 |
60 // content::NotificationObserver overrides. | 60 // content::NotificationObserver overrides. |
61 void Observe(int type, | 61 void Observe(int type, |
62 const content::NotificationSource& source, | 62 const content::NotificationSource& source, |
63 const content::NotificationDetails& details) override; | 63 const content::NotificationDetails& details) override; |
64 | 64 |
65 // ExtensionViewViews::Container overrides. | 65 // ExtensionViewViews::Container overrides. |
66 void OnExtensionSizeChanged(ExtensionViewViews* view) override; | 66 void OnExtensionSizeChanged(ExtensionViewViews* view) override; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 content::NotificationRegistrar registrar_; | 115 content::NotificationRegistrar registrar_; |
116 | 116 |
117 base::Callback<void(content::DevToolsAgentHost*, bool)> devtools_callback_; | 117 base::Callback<void(content::DevToolsAgentHost*, bool)> devtools_callback_; |
118 | 118 |
119 bool widget_initialized_; | 119 bool widget_initialized_; |
120 | 120 |
121 DISALLOW_COPY_AND_ASSIGN(ExtensionPopup); | 121 DISALLOW_COPY_AND_ASSIGN(ExtensionPopup); |
122 }; | 122 }; |
123 | 123 |
124 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_ | 124 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_ |
OLD | NEW |