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/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "chrome/browser/extensions/extension_host.h" | 9 #include "chrome/browser/extensions/extension_host.h" |
10 #include "chrome/browser/ui/views/extensions/extension_view.h" | 10 #include "chrome/browser/ui/views/extensions/extension_view.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 // If |arrow_location| is BOTTOM_*, then the popup 'pops up', otherwise | 31 // If |arrow_location| is BOTTOM_*, then the popup 'pops up', otherwise |
32 // the popup 'drops down'. | 32 // the popup 'drops down'. |
33 // The actual display of the popup is delayed until the page contents | 33 // The actual display of the popup is delayed until the page contents |
34 // finish loading in order to minimize UI flashing and resizing. | 34 // finish loading in order to minimize UI flashing and resizing. |
35 static ExtensionPopup* ShowPopup( | 35 static ExtensionPopup* ShowPopup( |
36 const GURL& url, | 36 const GURL& url, |
37 Browser* browser, | 37 Browser* browser, |
38 views::View* anchor_view, | 38 views::View* anchor_view, |
39 views::BubbleBorder::ArrowLocation arrow_location); | 39 views::BubbleBorder::ArrowLocation arrow_location); |
40 | 40 |
41 ExtensionHost* host() const { return extension_host_.get(); } | 41 extensions::ExtensionHost* host() const { return extension_host_.get(); } |
42 | 42 |
43 // content::NotificationObserver overrides. | 43 // content::NotificationObserver overrides. |
44 virtual void Observe(int type, | 44 virtual void Observe(int type, |
45 const content::NotificationSource& source, | 45 const content::NotificationSource& source, |
46 const content::NotificationDetails& details) OVERRIDE; | 46 const content::NotificationDetails& details) OVERRIDE; |
47 | 47 |
48 // ExtensionView::Container overrides. | 48 // ExtensionView::Container overrides. |
49 virtual void OnExtensionSizeChanged(ExtensionView* view) OVERRIDE; | 49 virtual void OnExtensionSizeChanged(ExtensionView* view) OVERRIDE; |
50 | 50 |
51 // views::View overrides. | 51 // views::View overrides. |
52 virtual gfx::Size GetPreferredSize() OVERRIDE; | 52 virtual gfx::Size GetPreferredSize() OVERRIDE; |
53 | 53 |
54 // views::WidgetFocusChangeListener overrides. | 54 // views::WidgetFocusChangeListener overrides. |
55 virtual void OnNativeFocusChange(gfx::NativeView focused_before, | 55 virtual void OnNativeFocusChange(gfx::NativeView focused_before, |
56 gfx::NativeView focused_now) OVERRIDE; | 56 gfx::NativeView focused_now) OVERRIDE; |
57 | 57 |
58 // The min/max height of popups. | 58 // The min/max height of popups. |
59 static const int kMinWidth; | 59 static const int kMinWidth; |
60 static const int kMinHeight; | 60 static const int kMinHeight; |
61 static const int kMaxWidth; | 61 static const int kMaxWidth; |
62 static const int kMaxHeight; | 62 static const int kMaxHeight; |
63 | 63 |
64 private: | 64 private: |
65 ExtensionPopup(Browser* browser, | 65 ExtensionPopup(Browser* browser, |
66 ExtensionHost* host, | 66 extensions::ExtensionHost* host, |
67 views::View* anchor_view, | 67 views::View* anchor_view, |
68 views::BubbleBorder::ArrowLocation arrow_location); | 68 views::BubbleBorder::ArrowLocation arrow_location); |
69 | 69 |
70 // Show the bubble, focus on its content, and register listeners. | 70 // Show the bubble, focus on its content, and register listeners. |
71 void ShowBubble(); | 71 void ShowBubble(); |
72 | 72 |
73 void CloseBubble(); | 73 void CloseBubble(); |
74 | 74 |
75 // The contained host for the view. | 75 // The contained host for the view. |
76 scoped_ptr<ExtensionHost> extension_host_; | 76 scoped_ptr<extensions::ExtensionHost> extension_host_; |
77 | 77 |
78 // Flag used to indicate if the pop-up should open a devtools window once | 78 // Flag used to indicate if the pop-up should open a devtools window once |
79 // it is shown inspecting it. | 79 // it is shown inspecting it. |
80 bool inspect_with_devtools_; | 80 bool inspect_with_devtools_; |
81 | 81 |
82 content::NotificationRegistrar registrar_; | 82 content::NotificationRegistrar registrar_; |
83 | 83 |
84 base::WeakPtrFactory<ExtensionPopup> close_bubble_factory_; | 84 base::WeakPtrFactory<ExtensionPopup> close_bubble_factory_; |
85 | 85 |
86 DISALLOW_COPY_AND_ASSIGN(ExtensionPopup); | 86 DISALLOW_COPY_AND_ASSIGN(ExtensionPopup); |
87 }; | 87 }; |
88 | 88 |
89 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_ | 89 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_ |
OLD | NEW |