| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "chrome/browser/extensions/extension_host.h" | 10 #include "chrome/browser/extensions/extension_host.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // valid parameter for pop-ups not associated with a browser. | 46 // valid parameter for pop-ups not associated with a browser. |
| 47 // The positioning of the pop-up is determined by |arrow_location| according | 47 // The positioning of the pop-up is determined by |arrow_location| according |
| 48 // to the following logic: The popup is anchored so that the corner indicated | 48 // to the following logic: The popup is anchored so that the corner indicated |
| 49 // by value of |arrow_location| remains fixed during popup resizes. | 49 // by value of |arrow_location| remains fixed during popup resizes. |
| 50 // If |arrow_location| is BOTTOM_*, then the popup 'pops up', otherwise | 50 // If |arrow_location| is BOTTOM_*, then the popup 'pops up', otherwise |
| 51 // the popup 'drops down'. | 51 // the popup 'drops down'. |
| 52 // Pass |inspect_with_devtools| as true to pin the popup open and show the | 52 // Pass |inspect_with_devtools| as true to pin the popup open and show the |
| 53 // devtools window for it. | 53 // devtools window for it. |
| 54 // The actual display of the popup is delayed until the page contents | 54 // The actual display of the popup is delayed until the page contents |
| 55 // finish loading in order to minimize UI flashing and resizing. | 55 // finish loading in order to minimize UI flashing and resizing. |
| 56 static ExtensionPopup* Show(const GURL& url, Browser* browser, | 56 static ExtensionPopup* Show(const GURL& url, |
| 57 Browser* browser, |
| 57 const gfx::Rect& relative_to, | 58 const gfx::Rect& relative_to, |
| 58 views::BubbleBorder::ArrowLocation arrow_location, | 59 views::BubbleBorder::ArrowLocation arrow_location, |
| 59 bool inspect_with_devtools, | 60 bool inspect_with_devtools, |
| 60 Observer* observer); | 61 Observer* observer); |
| 61 | 62 |
| 62 // Closes the ExtensionPopup. | 63 // Closes the ExtensionPopup. |
| 63 void Close(); | 64 void Close(); |
| 64 | 65 |
| 65 // Some clients wish to do their own custom focus change management. If this | 66 // Some clients wish to do their own custom focus change management. If this |
| 66 // is set to false, then the ExtensionPopup will not do anything in response | 67 // is set to false, then the ExtensionPopup will not do anything in response |
| (...skipping 24 matching lines...) Expand all Loading... |
| 91 virtual void OnExtensionMouseLeave(ExtensionView* view) { } | 92 virtual void OnExtensionMouseLeave(ExtensionView* view) { } |
| 92 virtual void OnExtensionPreferredSizeChanged(ExtensionView* view); | 93 virtual void OnExtensionPreferredSizeChanged(ExtensionView* view); |
| 93 | 94 |
| 94 // The min/max height of popups. | 95 // The min/max height of popups. |
| 95 static const int kMinWidth; | 96 static const int kMinWidth; |
| 96 static const int kMinHeight; | 97 static const int kMinHeight; |
| 97 static const int kMaxWidth; | 98 static const int kMaxWidth; |
| 98 static const int kMaxHeight; | 99 static const int kMaxHeight; |
| 99 | 100 |
| 100 private: | 101 private: |
| 101 ExtensionPopup(ExtensionHost* host, | 102 ExtensionPopup(Browser* browser, |
| 102 views::Widget* frame, | 103 ExtensionHost* host, |
| 103 const gfx::Rect& relative_to, | 104 const gfx::Rect& relative_to, |
| 104 views::BubbleBorder::ArrowLocation arrow_location, | 105 views::BubbleBorder::ArrowLocation arrow_location, |
| 105 bool inspect_with_devtools, | 106 bool inspect_with_devtools, |
| 106 Observer* observer); | 107 Observer* observer); |
| 107 | 108 |
| 108 // The area on the screen that the popup should be positioned relative to. | 109 // The area on the screen that the popup should be positioned relative to. |
| 109 gfx::Rect relative_to_; | 110 gfx::Rect relative_to_; |
| 110 | 111 |
| 111 // The contained host for the view. | 112 // The contained host for the view. |
| 112 scoped_ptr<ExtensionHost> extension_host_; | 113 scoped_ptr<ExtensionHost> extension_host_; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 123 | 124 |
| 124 NotificationRegistrar registrar_; | 125 NotificationRegistrar registrar_; |
| 125 | 126 |
| 126 // The observer of this popup. | 127 // The observer of this popup. |
| 127 Observer* observer_; | 128 Observer* observer_; |
| 128 | 129 |
| 129 DISALLOW_COPY_AND_ASSIGN(ExtensionPopup); | 130 DISALLOW_COPY_AND_ASSIGN(ExtensionPopup); |
| 130 }; | 131 }; |
| 131 | 132 |
| 132 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_ | 133 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_POPUP_H_ |
| OLD | NEW |