Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1138)

Side by Side Diff: chrome/browser/cocoa/infobar_container_controller.h

Issue 354008: [Mac] Enables animations for the infobar.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/app/nibs/InfoBar.xib ('k') | chrome/browser/cocoa/infobar_container_controller.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "base/scoped_nsobject.h" 7 #include "base/scoped_nsobject.h"
8 #include "base/scoped_ptr.h" 8 #include "base/scoped_ptr.h"
9 #import "chrome/browser/cocoa/view_resizer.h" 9 #import "chrome/browser/cocoa/view_resizer.h"
10 #include "chrome/common/notification_registrar.h" 10 #include "chrome/common/notification_registrar.h"
11 11
12 @class InfoBarController;
12 class InfoBarDelegate; 13 class InfoBarDelegate;
13 class InfoBarNotificationObserver; 14 class InfoBarNotificationObserver;
14 class TabContents; 15 class TabContents;
15 class TabStripModel; 16 class TabStripModel;
16 class TabStripModelObserverBridge; 17 class TabStripModelObserverBridge;
17 18
19 // Protocol for basic container methods, as needed by an InfoBarController.
20 // This protocol exists to make mocking easier in unittests.
21 @protocol InfoBarContainer
22 - (void)removeDelegate:(InfoBarDelegate*)delegate;
23 - (void)removeController:(InfoBarController*)controller;
24 @end
25
18 // Controller for the infobar container view, which is the superview 26 // Controller for the infobar container view, which is the superview
19 // of all the infobar views. This class owns zero or more 27 // of all the infobar views. This class owns zero or more
20 // InfoBarControllers, which manage the infobar views. This class 28 // InfoBarControllers, which manage the infobar views. This class
21 // also receives tab strip model notifications and handles 29 // also receives tab strip model notifications and handles
22 // adding/removing infobars when needed. 30 // adding/removing infobars when needed.
23 @interface InfoBarContainerController : NSViewController { 31 @interface InfoBarContainerController : NSViewController <ViewResizer,
32 InfoBarContainer> {
24 @private 33 @private
25 // Needed to send resize messages when infobars are added or removed. 34 // Needed to send resize messages when infobars are added or removed.
26 id<ViewResizer> resizeDelegate_; // weak 35 id<ViewResizer> resizeDelegate_; // weak
27 36
28 // The TabContents we are currently showing infobars for. 37 // The TabContents we are currently showing infobars for.
29 TabContents* currentTabContents_; // weak 38 TabContents* currentTabContents_; // weak
30 39
31 // Holds the InfoBarControllers currently owned by this container. 40 // Holds the InfoBarControllers currently owned by this container.
32 scoped_nsobject<NSMutableArray> infobarControllers_; 41 scoped_nsobject<NSMutableArray> infobarControllers_;
33 42
(...skipping 10 matching lines...) Expand all
44 - (id)initWithTabStripModel:(TabStripModel*)model 53 - (id)initWithTabStripModel:(TabStripModel*)model
45 resizeDelegate:(id<ViewResizer>)resizeDelegate; 54 resizeDelegate:(id<ViewResizer>)resizeDelegate;
46 55
47 // Informs the selected TabContents that the infobars for the given 56 // Informs the selected TabContents that the infobars for the given
48 // |delegate| need to be removed. Does not remove any infobar views 57 // |delegate| need to be removed. Does not remove any infobar views
49 // directly, as they will be removed when handling the subsequent 58 // directly, as they will be removed when handling the subsequent
50 // INFOBAR_REMOVED notification. Does not notify |delegate| that the 59 // INFOBAR_REMOVED notification. Does not notify |delegate| that the
51 // infobar was closed. 60 // infobar was closed.
52 - (void)removeDelegate:(InfoBarDelegate*)delegate; 61 - (void)removeDelegate:(InfoBarDelegate*)delegate;
53 62
63 // Removes |controller| from the list of controllers in this container and
64 // removes its view from the view hierarchy. This method is safe to call while
65 // |controller| is still on the call stack.
66 - (void)removeController:(InfoBarController*)controller;
67
54 @end 68 @end
55 69
56 70
57 @interface InfoBarContainerController (ForTheObserverAndTesting) 71 @interface InfoBarContainerController (ForTheObserverAndTesting)
58 72
59 // Adds an infobar view for the given delegate. Callers must call 73 // Adds an infobar view for the given delegate.
60 // positionInfoBarsAndRedraw after calling this method. 74 - (void)addInfoBar:(InfoBarDelegate*)delegate animate:(BOOL)animate;
61 - (void)addInfoBar:(InfoBarDelegate*)delegate;
62 75
63 // Removes all the infobar views for a given delegate. Callers must 76 // Closes all the infobar views for a given delegate, either immediately or by
64 // call positionInfoBarsAndRedraw after calling this method. 77 // starting a close animation.
65 - (void)removeInfoBarsForDelegate:(InfoBarDelegate*)delegate; 78 - (void)closeInfoBarsForDelegate:(InfoBarDelegate*)delegate
79 animate:(BOOL)animate;
66 80
67 // Replaces all info bars for the delegate with a new info bar. 81 // Replaces all info bars for the delegate with a new info bar.
68 // This simply calls removeInfoBarsForDelegate: and then addInfoBar:. 82 // This simply calls closeInfoBarsForDelegate: and then addInfoBar:.
69 - (void)replaceInfoBarsForDelegate:(InfoBarDelegate*)old_delegate 83 - (void)replaceInfoBarsForDelegate:(InfoBarDelegate*)old_delegate
70 with:(InfoBarDelegate*)new_delegate; 84 with:(InfoBarDelegate*)new_delegate;
71 85
72 // Positions the infobar views in the container view and notifies 86 // Positions the infobar views in the container view and notifies
73 // |browser_controller_| that it needs to resize the container view. 87 // |browser_controller_| that it needs to resize the container view.
74 - (void)positionInfoBarsAndRedraw; 88 - (void)positionInfoBarsAndRedraw;
75 89
76 @end 90 @end
77 91
78 92
79 @interface InfoBarContainerController (JustForTesting) 93 @interface InfoBarContainerController (JustForTesting)
80 94
81 // Removes all infobar views. Callers must call 95 // Removes all infobar views. Callers must call
82 // positionInfoBarsAndRedraw() after calling this method. 96 // positionInfoBarsAndRedraw() after calling this method.
83 - (void)removeAllInfoBars; 97 - (void)removeAllInfoBars;
84 98
85 @end 99 @end
OLDNEW
« no previous file with comments | « chrome/app/nibs/InfoBar.xib ('k') | chrome/browser/cocoa/infobar_container_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698