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_COCOA_EXTENSIONS_EXTENSION_POPUP_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_POPUP_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_POPUP_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_POPUP_CONTROLLER_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #import "base/mac/cocoa_protocols.h" | 10 #import "base/mac/cocoa_protocols.h" |
11 #import "base/memory/scoped_nsobject.h" | 11 #import "base/memory/scoped_nsobject.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" | 13 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" |
14 #import "chrome/browser/ui/cocoa/info_bubble_view.h" | 14 #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
15 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
16 | 16 |
17 | 17 |
18 class Browser; | 18 class Browser; |
19 class DevtoolsNotificationBridge; | 19 class DevtoolsNotificationBridge; |
20 class ExtensionHost; | |
21 class ExtensionPopupContainer; | 20 class ExtensionPopupContainer; |
22 | 21 |
23 namespace content { | 22 namespace content { |
24 class NotificationRegistrar; | 23 class NotificationRegistrar; |
25 } | 24 } |
26 | 25 |
26 namespace extensions { | |
27 class ExtensionHost; | |
28 } | |
29 | |
27 // This controller manages a single browser action popup that can appear once a | 30 // This controller manages a single browser action popup that can appear once a |
28 // user has clicked on a browser action button. It instantiates the extension | 31 // user has clicked on a browser action button. It instantiates the extension |
29 // popup view showing the content and resizes the window to accomodate any size | 32 // popup view showing the content and resizes the window to accomodate any size |
30 // changes as they occur. | 33 // changes as they occur. |
31 // | 34 // |
32 // There can only be one browser action popup open at a time, so a static | 35 // There can only be one browser action popup open at a time, so a static |
33 // variable holds a reference to the current popup. | 36 // variable holds a reference to the current popup. |
34 @interface ExtensionPopupController : BaseBubbleController { | 37 @interface ExtensionPopupController : BaseBubbleController { |
35 @private | 38 @private |
36 // The native extension view retrieved from the extension host. Weak. | 39 // The native extension view retrieved from the extension host. Weak. |
37 NSView* extensionView_; | 40 NSView* extensionView_; |
38 | 41 |
39 // The current frame of the extension view. Cached to prevent setting the | 42 // The current frame of the extension view. Cached to prevent setting the |
40 // frame if the size hasn't changed. | 43 // frame if the size hasn't changed. |
41 NSRect extensionFrame_; | 44 NSRect extensionFrame_; |
42 | 45 |
43 // The extension host object. | 46 // The extension host object. |
44 scoped_ptr<ExtensionHost> host_; | 47 scoped_ptr<extensions::ExtensionHost> host_; |
45 | 48 |
46 scoped_ptr<content::NotificationRegistrar> registrar_; | 49 scoped_ptr<content::NotificationRegistrar> registrar_; |
47 scoped_ptr<DevtoolsNotificationBridge> notificationBridge_; | 50 scoped_ptr<DevtoolsNotificationBridge> notificationBridge_; |
48 scoped_ptr<ExtensionPopupContainer> container_; | 51 scoped_ptr<ExtensionPopupContainer> container_; |
49 | 52 |
50 // Whether the popup has a devtools window attached to it. | 53 // Whether the popup has a devtools window attached to it. |
51 BOOL beingInspected_; | 54 BOOL beingInspected_; |
52 | 55 |
53 // The size once the ExtensionView has loaded. | 56 // The size once the ExtensionView has loaded. |
54 NSSize pendingSize_; | 57 NSSize pendingSize_; |
55 } | 58 } |
56 | 59 |
57 // Returns the ExtensionHost object associated with this popup. | 60 // Returns the extensions::ExtensionHost object associated with this popup. |
Peter Kasting
2012/07/26 18:13:48
Nit: The qualifier here seems to slightly decrease
| |
58 - (ExtensionHost*)extensionHost; | 61 - (extensions::ExtensionHost*)extensionHost; |
59 | 62 |
60 // Starts the process of showing the given popup URL. Instantiates an | 63 // Starts the process of showing the given popup URL. Instantiates an |
61 // ExtensionPopupController with the parent window retrieved from |browser|, a | 64 // ExtensionPopupController with the parent window retrieved from |browser|, a |
62 // host for the popup created by the extension process manager specific to the | 65 // host for the popup created by the extension process manager specific to the |
63 // browser profile and the remaining arguments |anchoredAt| and |arrowLocation|. | 66 // browser profile and the remaining arguments |anchoredAt| and |arrowLocation|. |
64 // |anchoredAt| is expected to be in the window's coordinates at the bottom | 67 // |anchoredAt| is expected to be in the window's coordinates at the bottom |
65 // center of the browser action button. | 68 // center of the browser action button. |
66 // The actual display of the popup is delayed until the page contents finish | 69 // The actual display of the popup is delayed until the page contents finish |
67 // loading in order to minimize UI flashing and resizing. | 70 // loading in order to minimize UI flashing and resizing. |
68 // Passing YES to |devMode| will launch the webkit inspector for the popup, | 71 // Passing YES to |devMode| will launch the webkit inspector for the popup, |
(...skipping 25 matching lines...) Expand all Loading... | |
94 @interface ExtensionPopupController(TestingAPI) | 97 @interface ExtensionPopupController(TestingAPI) |
95 // Returns a weak pointer to the current popup's view. | 98 // Returns a weak pointer to the current popup's view. |
96 - (NSView*)view; | 99 - (NSView*)view; |
97 // Returns the minimum allowed size for an extension popup. | 100 // Returns the minimum allowed size for an extension popup. |
98 + (NSSize)minPopupSize; | 101 + (NSSize)minPopupSize; |
99 // Returns the maximum allowed size for an extension popup. | 102 // Returns the maximum allowed size for an extension popup. |
100 + (NSSize)maxPopupSize; | 103 + (NSSize)maxPopupSize; |
101 @end | 104 @end |
102 | 105 |
103 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_POPUP_CONTROLLER_H_ | 106 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_POPUP_CONTROLLER_H_ |
OLD | NEW |