OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_ |
6 #define CHROME_BROWSER_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_ | 6 #define CHROME_BROWSER_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_ |
7 | 7 |
| 8 #include "app/gfx/native_widget_types.h" |
8 #include "chrome/browser/extensions/extension_host.h" | 9 #include "chrome/browser/extensions/extension_host.h" |
9 #include "chrome/browser/views/browser_bubble.h" | 10 #include "chrome/browser/views/browser_bubble.h" |
10 #include "chrome/browser/views/extensions/extension_view.h" | 11 #include "chrome/browser/views/extensions/extension_view.h" |
11 #include "chrome/browser/views/bubble_border.h" | 12 #include "chrome/browser/views/bubble_border.h" |
12 #include "chrome/common/notification_observer.h" | 13 #include "chrome/common/notification_observer.h" |
13 #include "chrome/common/notification_registrar.h" | 14 #include "chrome/common/notification_registrar.h" |
14 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
15 | 16 |
16 class Browser; | 17 class Browser; |
17 class ExtensionHost; | 18 class ExtensionHost; |
| 19 class Profile; |
| 20 |
| 21 namespace views { |
| 22 class Widget; |
| 23 } |
18 | 24 |
19 class ExtensionPopup : public BrowserBubble, | 25 class ExtensionPopup : public BrowserBubble, |
20 public NotificationObserver, | 26 public NotificationObserver, |
21 public ExtensionView::Container { | 27 public ExtensionView::Container { |
22 public: | 28 public: |
23 virtual ~ExtensionPopup(); | 29 virtual ~ExtensionPopup(); |
24 | 30 |
25 // Create and show a popup with |url| positioned adjacent to |relative_to| in | 31 // Create and show a popup with |url| positioned adjacent to |relative_to| in |
26 // screen coordinates. | 32 // screen coordinates. |
| 33 // |browser| is the browser to which the pop-up will be attached. NULL is a |
| 34 // valid parameter for pop-ups not associated with a browser. |
| 35 // |profile| is the user profile instance associated with the popup. A |
| 36 // non NULL value must be given. |
| 37 // |frame_window| is the native window that hosts the view inside which the |
| 38 // popup will be anchored. |
27 // The positioning of the pop-up is determined by |arrow_location| according | 39 // The positioning of the pop-up is determined by |arrow_location| according |
28 // to the following logic: The popup is anchored so that the corner indicated | 40 // to the following logic: The popup is anchored so that the corner indicated |
29 // by value of |arrow_location| remains fixed during popup resizes. | 41 // by value of |arrow_location| remains fixed during popup resizes. |
30 // If |arrow_location| is BOTTOM_*, then the popup 'pops up', otherwise | 42 // If |arrow_location| is BOTTOM_*, then the popup 'pops up', otherwise |
31 // the popup 'drops down'. | 43 // the popup 'drops down'. |
32 // Pass |activate_on_show| as true to activate the popup window. | 44 // Pass |activate_on_show| as true to activate the popup window. |
33 // | 45 // |
34 // The actual display of the popup is delayed until the page contents | 46 // The actual display of the popup is delayed until the page contents |
35 // finish loading in order to minimize UI flashing and resizing. | 47 // finish loading in order to minimize UI flashing and resizing. |
36 static ExtensionPopup* Show(const GURL& url, Browser* browser, | 48 static ExtensionPopup* Show(const GURL& url, Browser* browser, |
| 49 Profile* profile, |
| 50 gfx::NativeWindow frame_window, |
37 const gfx::Rect& relative_to, | 51 const gfx::Rect& relative_to, |
38 BubbleBorder::ArrowLocation arrow_location, | 52 BubbleBorder::ArrowLocation arrow_location, |
39 bool activate_on_show); | 53 bool activate_on_show); |
40 | 54 |
41 ExtensionHost* host() const { return extension_host_.get(); } | 55 ExtensionHost* host() const { return extension_host_.get(); } |
42 | 56 |
43 // BrowserBubble overrides. | 57 // BrowserBubble overrides. |
44 virtual void Hide(); | 58 virtual void Hide(); |
45 virtual void Show(bool activate); | 59 virtual void Show(bool activate); |
46 virtual void ResizeToView(); | 60 virtual void ResizeToView(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // Layered windows can't contain native child windows, so we wouldn't be | 98 // Layered windows can't contain native child windows, so we wouldn't be |
85 // able to have the ExtensionView child. | 99 // able to have the ExtensionView child. |
86 views::Widget* border_widget_; | 100 views::Widget* border_widget_; |
87 BubbleBorder* border_; | 101 BubbleBorder* border_; |
88 views::View* border_view_; | 102 views::View* border_view_; |
89 | 103 |
90 DISALLOW_COPY_AND_ASSIGN(ExtensionPopup); | 104 DISALLOW_COPY_AND_ASSIGN(ExtensionPopup); |
91 }; | 105 }; |
92 | 106 |
93 #endif // CHROME_BROWSER_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_ | 107 #endif // CHROME_BROWSER_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_ |
OLD | NEW |