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

Side by Side Diff: chrome/browser/ui/cocoa/infobars/infobar_controller.h

Issue 240193003: Move Infobars core files to the Infobars component (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nib name on mac Created 6 years, 8 months 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
OLDNEW
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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "base/mac/scoped_nsobject.h" 7 #include "base/mac/scoped_nsobject.h"
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 9
10 @protocol InfoBarContainerControllerBase; 10 @protocol InfoBarContainerControllerBase;
11 class InfoBarCocoa; 11 class InfoBarCocoa;
12 class InfoBarDelegate;
13 class InfoBarService; 12 class InfoBarService;
14 @class InfoBarGradientView; 13 @class InfoBarGradientView;
15 14
15 namespace infobars {
16 class InfoBarDelegate;
17 }
18
16 // A controller for an infobar in the browser window. There is one 19 // A controller for an infobar in the browser window. There is one
17 // controller per infobar view. The base InfoBarController is able to 20 // controller per infobar view. The base InfoBarController is able to
18 // draw an icon, a text message, and a close button. Subclasses can 21 // draw an icon, a text message, and a close button. Subclasses can
19 // override addAdditionalControls to customize the UI. 22 // override addAdditionalControls to customize the UI.
20 @interface InfoBarController : NSViewController<NSTextViewDelegate> { 23 @interface InfoBarController : NSViewController<NSTextViewDelegate> {
21 @private 24 @private
22 id<InfoBarContainerControllerBase> containerController_; // weak, owns us 25 id<InfoBarContainerControllerBase> containerController_; // weak, owns us
23 base::WeakPtr<InfoBarCocoa> infobar_; 26 base::WeakPtr<InfoBarCocoa> infobar_;
24 27
25 @protected 28 @protected
26 IBOutlet InfoBarGradientView* infoBarView_; 29 IBOutlet InfoBarGradientView* infoBarView_;
27 IBOutlet NSImageView* image_; 30 IBOutlet NSImageView* image_;
28 IBOutlet NSTextField* labelPlaceholder_; 31 IBOutlet NSTextField* labelPlaceholder_;
29 IBOutlet NSButton* okButton_; 32 IBOutlet NSButton* okButton_;
30 IBOutlet NSButton* cancelButton_; 33 IBOutlet NSButton* cancelButton_;
31 IBOutlet NSButton* closeButton_; 34 IBOutlet NSButton* closeButton_;
32 35
33 // Text fields don't work as well with embedded links as text views, but 36 // Text fields don't work as well with embedded links as text views, but
34 // text views cannot conveniently be created in IB. The xib file contains 37 // text views cannot conveniently be created in IB. The xib file contains
35 // a text field |labelPlaceholder_| that's replaced by this text view |label_| 38 // a text field |labelPlaceholder_| that's replaced by this text view |label_|
36 // in -awakeFromNib. 39 // in -awakeFromNib.
37 base::scoped_nsobject<NSTextView> label_; 40 base::scoped_nsobject<NSTextView> label_;
38 } 41 }
39 42
40 @property(nonatomic, assign) 43 @property(nonatomic, assign)
41 id<InfoBarContainerControllerBase> containerController; 44 id<InfoBarContainerControllerBase> containerController;
42 @property(nonatomic, readonly) InfoBarDelegate* delegate; 45 @property(nonatomic, readonly) infobars::InfoBarDelegate* delegate;
43 @property(nonatomic, readonly) InfoBarCocoa* infobar; 46 @property(nonatomic, readonly) InfoBarCocoa* infobar;
44 47
45 // Initializes a new InfoBarController and takes a WeakPtr to |infobar|. 48 // Initializes a new InfoBarController and takes a WeakPtr to |infobar|.
46 - (id)initWithInfoBar:(InfoBarCocoa*)infobar; 49 - (id)initWithInfoBar:(InfoBarCocoa*)infobar;
47 50
48 // Returns YES if the infobar is owned. If this is NO, it is not safe to call 51 // Returns YES if the infobar is owned. If this is NO, it is not safe to call
49 // any delegate functions, since they might attempt to access the owner. Code 52 // any delegate functions, since they might attempt to access the owner. Code
50 // should generally just do nothing at all in this case (once we're closing, all 53 // should generally just do nothing at all in this case (once we're closing, all
51 // controls can safely just go dead). 54 // controls can safely just go dead).
52 - (BOOL)isOwned; 55 - (BOOL)isOwned;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 @interface InfoBarController (Protected) 94 @interface InfoBarController (Protected)
92 // Disables the provided menu. Subclasses should call this for each popup menu 95 // Disables the provided menu. Subclasses should call this for each popup menu
93 // in -infobarWillClose. 96 // in -infobarWillClose.
94 - (void)disablePopUpMenu:(NSMenu*)menu; 97 - (void)disablePopUpMenu:(NSMenu*)menu;
95 @end 98 @end
96 99
97 ///////////////////////////////////////////////////////////////////////// 100 /////////////////////////////////////////////////////////////////////////
98 // InfoBarController subclasses, one for each InfoBarDelegate 101 // InfoBarController subclasses, one for each InfoBarDelegate
99 // subclass. Each of these subclasses overrides addAdditionalControls to 102 // subclass. Each of these subclasses overrides addAdditionalControls to
100 // configure its view as necessary. 103 // configure its view as necessary.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698