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

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

Issue 10830353: Introduce InfoBarTabService API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to review comments, merge to LKGR Created 8 years, 4 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/memory/scoped_nsobject.h" 7 #include "base/memory/scoped_nsobject.h"
8 8
9 @class AnimatableView; 9 @class AnimatableView;
10 @class HoverCloseButton; 10 @class HoverCloseButton;
11 @protocol InfoBarContainer; 11 @protocol InfoBarContainer;
12 class InfoBarDelegate; 12 class InfoBarDelegate;
13 class InfoBarTabHelper; 13 class InfoBarTabService;
14 @class InfoBarGradientView; 14 @class InfoBarGradientView;
15 15
16 // A controller for an infobar in the browser window. There is one 16 // A controller for an infobar in the browser window. There is one
17 // controller per infobar view. The base InfoBarController is able to 17 // controller per infobar view. The base InfoBarController is able to
18 // draw an icon, a text message, and a close button. Subclasses can 18 // draw an icon, a text message, and a close button. Subclasses can
19 // override addAdditionalControls to customize the UI. 19 // override addAdditionalControls to customize the UI.
20 @interface InfoBarController : NSViewController<NSTextViewDelegate> { 20 @interface InfoBarController : NSViewController<NSTextViewDelegate> {
21 @private 21 @private
22 id<InfoBarContainer> containerController_; // weak, owns us 22 id<InfoBarContainer> containerController_; // weak, owns us
23 InfoBarTabHelper* owner_; // weak 23 InfoBarTabService* owner_; // weak
24 BOOL infoBarClosing_; 24 BOOL infoBarClosing_;
25 25
26 @protected 26 @protected
27 IBOutlet InfoBarGradientView* infoBarView_; 27 IBOutlet InfoBarGradientView* infoBarView_;
28 IBOutlet NSImageView* image_; 28 IBOutlet NSImageView* image_;
29 IBOutlet NSTextField* labelPlaceholder_; 29 IBOutlet NSTextField* labelPlaceholder_;
30 IBOutlet NSButton* okButton_; 30 IBOutlet NSButton* okButton_;
31 IBOutlet NSButton* cancelButton_; 31 IBOutlet NSButton* cancelButton_;
32 IBOutlet HoverCloseButton* closeButton_; 32 IBOutlet HoverCloseButton* closeButton_;
33 33
34 // In rare instances, it can be possible for |delegate_| to delete itself 34 // In rare instances, it can be possible for |delegate_| to delete itself
35 // while this controller is still alive. Always check |delegate_| against 35 // while this controller is still alive. Always check |delegate_| against
36 // NULL before using it. 36 // NULL before using it.
37 InfoBarDelegate* delegate_; // weak, can be NULL 37 InfoBarDelegate* delegate_; // weak, can be NULL
38 38
39 // Text fields don't work as well with embedded links as text views, but 39 // Text fields don't work as well with embedded links as text views, but
40 // text views cannot conveniently be created in IB. The xib file contains 40 // text views cannot conveniently be created in IB. The xib file contains
41 // a text field |labelPlaceholder_| that's replaced by this text view |label_| 41 // a text field |labelPlaceholder_| that's replaced by this text view |label_|
42 // in -awakeFromNib. 42 // in -awakeFromNib.
43 scoped_nsobject<NSTextView> label_; 43 scoped_nsobject<NSTextView> label_;
44 }; 44 };
45 45
46 // Initializes a new InfoBarController. 46 // Initializes a new InfoBarController.
47 - (id)initWithDelegate:(InfoBarDelegate*)delegate 47 - (id)initWithDelegate:(InfoBarDelegate*)delegate
48 owner:(InfoBarTabHelper*)owner; 48 owner:(InfoBarTabService*)owner;
49 49
50 // Returns YES if the infobar is owned. If this is NO, it is not safe to call 50 // Returns YES if the infobar is owned. If this is NO, it is not safe to call
51 // any delegate functions, since they might attempt to access the owner. Code 51 // any delegate functions, since they might attempt to access the owner. Code
52 // should generally just do nothing at all in this case (once we're closing, all 52 // should generally just do nothing at all in this case (once we're closing, all
53 // controls can safely just go dead). 53 // controls can safely just go dead).
54 - (BOOL)isOwned; 54 - (BOOL)isOwned;
55 55
56 // Called when someone clicks on the OK or Cancel buttons. Subclasses 56 // Called when someone clicks on the OK or Cancel buttons. Subclasses
57 // must override if they do not hide the buttons. 57 // must override if they do not hide the buttons.
58 - (void)ok:(id)sender; 58 - (void)ok:(id)sender;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 @end 114 @end
115 115
116 116
117 @interface ConfirmInfoBarController : InfoBarController 117 @interface ConfirmInfoBarController : InfoBarController
118 // Called when the OK and Cancel buttons are clicked. 118 // Called when the OK and Cancel buttons are clicked.
119 - (IBAction)ok:(id)sender; 119 - (IBAction)ok:(id)sender;
120 - (IBAction)cancel:(id)sender; 120 - (IBAction)cancel:(id)sender;
121 // Called when there is a click on the link in the infobar. 121 // Called when there is a click on the link in the infobar.
122 - (void)linkClicked; 122 - (void)linkClicked;
123 @end 123 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698