OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
3 // LICENSE file. | 3 // LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_VIEWS_BLOCKED_POPUP_CONTAINER_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_BLOCKED_POPUP_CONTAINER_CONTROLLER_H_ |
6 #define CHROME_BROWSER_VIEWS_BLOCKED_POPUP_CONTAINER_CONTROLLER_H_ | 6 #define CHROME_BROWSER_VIEWS_BLOCKED_POPUP_CONTAINER_CONTROLLER_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include "base/scoped_nsobject.h" | 10 #include "base/scoped_nsobject.h" |
11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
12 #include "chrome/browser/blocked_popup_container.h" | 12 #include "chrome/browser/blocked_popup_container.h" |
13 | 13 |
14 // Controller for the blocked popup view. Communicates with the cross-platform | 14 // Controller for the blocked popup view. Communicates with the cross-platform |
15 // code via a C++ bridge class, below. The BlockedPopupContainer class doesn't | 15 // code via a C++ bridge class, below. The BlockedPopupContainer class doesn't |
16 // really "own" the bridge, it just keeps a pointer to it and calls Destroy() on | 16 // really "own" the bridge, it just keeps a pointer to it and calls Destroy() on |
17 // it when it's supposed to go away. As a result, this class needs to own itself | 17 // it when it's supposed to go away. As a result, this class needs to own itself |
18 // (always keep an extra retain), and will autorelease itself (and the bridge | 18 // (always keep an extra retain), and will autorelease itself (and the bridge |
19 // which it owns) when the bridge gets a Destroy() message. | 19 // which it owns) when the bridge gets a Destroy() message. |
20 // TODO(pinkerton): Reverse the ownership if it makes more sense. I'm leaving | 20 // TODO(pinkerton): Reverse the ownership if it makes more sense. I'm leaving |
21 // it this way because I assume we eventually want this to be a | 21 // it this way because I assume we eventually want this to be a |
22 // NSViewController, and we usually have the Obj-C controller owning the | 22 // NSViewController, and we usually have the Obj-C controller owning the |
23 // bridge (rather than the other way around). | 23 // bridge (rather than the other way around). |
24 @interface BlockedPopupContainerController : NSObject { | 24 @interface BlockedPopupContainerController : NSObject { |
25 @private | 25 @private |
26 scoped_ptr<BlockedPopupContainerView> bridge_; | 26 scoped_ptr<BlockedPopupContainerView> bridge_; |
27 BlockedPopupContainer* container_; // Weak. "owns" me. | 27 BlockedPopupContainer* container_; // Weak. "owns" me. |
28 scoped_nsobject<NSView> view_; | 28 scoped_nsobject<NSView> view_; |
| 29 scoped_nsobject<NSButton> closeButton_; |
| 30 // Tracking area for close button mouseover images. |
| 31 scoped_nsobject<NSTrackingArea> closeTrackingArea_; |
29 IBOutlet NSPopUpButton* popupButton_; | 32 IBOutlet NSPopUpButton* popupButton_; |
30 } | 33 } |
31 | 34 |
32 // Initialize with the given popup container. Creates the C++ bridge object | 35 // Initialize with the given popup container. Creates the C++ bridge object |
33 // used to represet the "view". | 36 // used to represet the "view". |
34 - (id)initWithContainer:(BlockedPopupContainer*)container; | 37 - (id)initWithContainer:(BlockedPopupContainer*)container; |
35 | 38 |
36 // Returns the C++ brige object. | 39 // Returns the C++ brige object. |
37 - (BlockedPopupContainerView*)bridge; | 40 - (BlockedPopupContainerView*)bridge; |
38 | 41 |
39 // Called by the bridge to perform certain actions from the back-end code. | 42 // Called by the bridge to perform certain actions from the back-end code. |
40 - (void)show; | 43 - (void)show; |
41 - (void)hide; | 44 - (void)hide; |
42 - (void)update; | 45 - (void)update; |
43 | 46 |
44 @end | 47 @end |
45 | 48 |
46 @interface BlockedPopupContainerController(ForTesting) | 49 @interface BlockedPopupContainerController(ForTesting) |
47 - (NSView*)view; | 50 - (NSView*)view; |
48 - (NSPopUpButton*)popupButton; | 51 - (NSPopUpButton*)popupButton; |
49 - (IBAction)closePopup:(id)sender; | 52 - (IBAction)closePopup:(id)sender; |
50 - (NSMenu*)buildMenu; | 53 - (NSMenu*)buildMenu; |
51 - (void)setContainer:(BlockedPopupContainer*)container; | 54 - (void)setContainer:(BlockedPopupContainer*)container; |
52 @end | 55 @end |
53 | 56 |
54 #endif // CHROME_BROWSER_VIEWS_BLOCKED_POPUP_CONTAINER_CONTROLLER_H_ | 57 #endif // CHROME_BROWSER_VIEWS_BLOCKED_POPUP_CONTAINER_CONTROLLER_H_ |
OLD | NEW |