| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #import <Cocoa/Cocoa.h> | 9 #import <Cocoa/Cocoa.h> |
| 10 | 10 |
| 11 #import "base/mac/cocoa_protocols.h" | 11 #import "base/mac/cocoa_protocols.h" |
| 12 #import "base/memory/scoped_nsobject.h" | 12 #import "base/memory/scoped_nsobject.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "chrome/browser/ui/cocoa/info_bubble_view.h" | 14 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" |
| 15 #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
| 15 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
| 16 | 17 |
| 17 | 18 |
| 18 class Browser; | 19 class Browser; |
| 19 class DevtoolsNotificationBridge; | 20 class DevtoolsNotificationBridge; |
| 20 class ExtensionHost; | 21 class ExtensionHost; |
| 21 class ExtensionPopupContainer; | 22 class ExtensionPopupContainer; |
| 22 @class InfoBubbleWindow; | |
| 23 | 23 |
| 24 namespace content { | 24 namespace content { |
| 25 class NotificationRegistrar; | 25 class NotificationRegistrar; |
| 26 } | 26 } |
| 27 | 27 |
| 28 // This controller manages a single browser action popup that can appear once a | 28 // This controller manages a single browser action popup that can appear once a |
| 29 // user has clicked on a browser action button. It instantiates the extension | 29 // user has clicked on a browser action button. It instantiates the extension |
| 30 // popup view showing the content and resizes the window to accomodate any size | 30 // popup view showing the content and resizes the window to accomodate any size |
| 31 // changes as they occur. | 31 // changes as they occur. |
| 32 // | 32 // |
| 33 // There can only be one browser action popup open at a time, so a static | 33 // There can only be one browser action popup open at a time, so a static |
| 34 // variable holds a reference to the current popup. | 34 // variable holds a reference to the current popup. |
| 35 @interface ExtensionPopupController : NSWindowController<NSWindowDelegate> { | 35 @interface ExtensionPopupController : BaseBubbleController { |
| 36 @private | 36 @private |
| 37 // The native extension view retrieved from the extension host. Weak. | 37 // The native extension view retrieved from the extension host. Weak. |
| 38 NSView* extensionView_; | 38 NSView* extensionView_; |
| 39 | 39 |
| 40 // The popup's parent window. Weak. | |
| 41 NSWindow* parentWindow_; | |
| 42 | |
| 43 // Where the window is anchored. Right now it's the bottom center of the | |
| 44 // browser action button. | |
| 45 NSPoint anchor_; | |
| 46 | |
| 47 // The current frame of the extension view. Cached to prevent setting the | 40 // The current frame of the extension view. Cached to prevent setting the |
| 48 // frame if the size hasn't changed. | 41 // frame if the size hasn't changed. |
| 49 NSRect extensionFrame_; | 42 NSRect extensionFrame_; |
| 50 | 43 |
| 51 // The extension host object. | 44 // The extension host object. |
| 52 scoped_ptr<ExtensionHost> host_; | 45 scoped_ptr<ExtensionHost> host_; |
| 53 | 46 |
| 54 scoped_ptr<content::NotificationRegistrar> registrar_; | 47 scoped_ptr<content::NotificationRegistrar> registrar_; |
| 55 scoped_ptr<DevtoolsNotificationBridge> notificationBridge_; | 48 scoped_ptr<DevtoolsNotificationBridge> notificationBridge_; |
| 56 scoped_ptr<ExtensionPopupContainer> container_; | 49 scoped_ptr<ExtensionPopupContainer> container_; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 @interface ExtensionPopupController(TestingAPI) | 91 @interface ExtensionPopupController(TestingAPI) |
| 99 // Returns a weak pointer to the current popup's view. | 92 // Returns a weak pointer to the current popup's view. |
| 100 - (NSView*)view; | 93 - (NSView*)view; |
| 101 // Returns the minimum allowed size for an extension popup. | 94 // Returns the minimum allowed size for an extension popup. |
| 102 + (NSSize)minPopupSize; | 95 + (NSSize)minPopupSize; |
| 103 // Returns the maximum allowed size for an extension popup. | 96 // Returns the maximum allowed size for an extension popup. |
| 104 + (NSSize)maxPopupSize; | 97 + (NSSize)maxPopupSize; |
| 105 @end | 98 @end |
| 106 | 99 |
| 107 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_POPUP_CONTROLLER_H_ | 100 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_POPUP_CONTROLLER_H_ |
| OLD | NEW |