| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_COCOA_NOTIFICATIONS_BALLOON_CONTROLLER_H_ | |
| 6 #define CHROME_BROWSER_UI_COCOA_NOTIFICATIONS_BALLOON_CONTROLLER_H_ | |
| 7 | |
| 8 #import <Cocoa/Cocoa.h> | |
| 9 | |
| 10 #include "base/mac/scoped_nsobject.h" | |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 | |
| 13 class Balloon; | |
| 14 @class BalloonContentViewCocoa; | |
| 15 @class BalloonShelfViewCocoa; | |
| 16 class BalloonViewHost; | |
| 17 @class HoverImageButton; | |
| 18 @class MenuController; | |
| 19 class NotificationOptionsMenuModel; | |
| 20 | |
| 21 // The Balloon controller creates the view elements to display a | |
| 22 // notification balloon, resize it if the HTML contents of that | |
| 23 // balloon change, and move it when the collection of balloons is | |
| 24 // modified. | |
| 25 @interface BalloonController : NSWindowController<NSWindowDelegate> { | |
| 26 @private | |
| 27 // The balloon which represents the contents of this view. Weak pointer | |
| 28 // owned by the browser's NotificationUIManager. | |
| 29 Balloon* balloon_; | |
| 30 | |
| 31 // The view that contains the contents of the notification | |
| 32 IBOutlet BalloonContentViewCocoa* htmlContainer_; | |
| 33 | |
| 34 // The view that contains the controls of the notification | |
| 35 IBOutlet BalloonShelfViewCocoa* shelf_; | |
| 36 | |
| 37 // The close button. | |
| 38 IBOutlet NSButton* closeButton_; | |
| 39 | |
| 40 // Tracking region for the close button. | |
| 41 int closeButtonTrackingTag_; | |
| 42 | |
| 43 // The origin label. | |
| 44 IBOutlet NSTextField* originLabel_; | |
| 45 | |
| 46 // The options menu that appears when "options" is pressed. | |
| 47 IBOutlet HoverImageButton* optionsButton_; | |
| 48 scoped_ptr<NotificationOptionsMenuModel> menuModel_; | |
| 49 base::scoped_nsobject<MenuController> menuController_; | |
| 50 | |
| 51 // The host for the renderer of the HTML contents. | |
| 52 scoped_ptr<BalloonViewHost> htmlContents_; | |
| 53 | |
| 54 // Variables to delay close requested by script while showing modal menu. | |
| 55 BOOL optionMenuIsActive_; | |
| 56 BOOL delayedClose_; | |
| 57 } | |
| 58 | |
| 59 // Initialize with a balloon object containing the notification data. | |
| 60 - (id)initWithBalloon:(Balloon*)balloon; | |
| 61 | |
| 62 // Callback function for the close button. | |
| 63 - (IBAction)closeButtonPressed:(id)sender; | |
| 64 | |
| 65 // Callback function for the options button. | |
| 66 - (IBAction)optionsButtonPressed:(id)sender; | |
| 67 | |
| 68 // Callback function for the "revoke" option in the menu. | |
| 69 - (IBAction)permissionRevoked:(id)sender; | |
| 70 | |
| 71 // Closes the balloon. Can be called by the bridge or by the close | |
| 72 // button handler. | |
| 73 - (void)closeBalloon:(bool)byUser; | |
| 74 | |
| 75 // Update the contents of the balloon to match the notification. | |
| 76 - (void)updateContents; | |
| 77 | |
| 78 // Repositions the view to match the position and size of the balloon. | |
| 79 // Called by the bridge when the size changes. | |
| 80 - (void)repositionToBalloon; | |
| 81 | |
| 82 // The current size of the view, possibly subject to an animation completing. | |
| 83 - (int)desiredTotalWidth; | |
| 84 - (int)desiredTotalHeight; | |
| 85 | |
| 86 // The BalloonHost | |
| 87 - (BalloonViewHost*)getHost; | |
| 88 @end | |
| 89 | |
| 90 @interface BalloonController (UnitTesting) | |
| 91 - (void)initializeHost; | |
| 92 @end | |
| 93 | |
| 94 #endif // CHROME_BROWSER_UI_COCOA_NOTIFICATIONS_BALLOON_CONTROLLER_H_ | |
| OLD | NEW |