| OLD | NEW |
| 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 #ifndef CHROME_BROWSER_UI_COCOA_CONFIRM_BUBBLE_COCOA_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_CONFIRM_BUBBLE_COCOA_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_CONFIRM_BUBBLE_COCOA_H_ | 6 #define CHROME_BROWSER_UI_COCOA_CONFIRM_BUBBLE_COCOA_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include "base/memory/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
| 11 | 11 |
| 12 @class ConfirmBubbleController; | 12 @class ConfirmBubbleController; |
| 13 class ConfirmBubbleModel; | 13 class ConfirmBubbleModel; |
| 14 | 14 |
| 15 // A view class that implements a bubble consisting of the following items: | 15 // A view class that implements a bubble consisting of the following items: |
| 16 // * one icon ("icon") | 16 // * one icon ("icon") |
| 17 // * one title text ("title") | 17 // * one title text ("title") |
| 18 // * one message text ("message") | 18 // * one message text ("message") |
| 19 // * one optional link ("link") | 19 // * one optional link ("link") |
| 20 // * two optional buttons ("ok" and "cancel") | 20 // * two optional buttons ("ok" and "cancel") |
| 21 // | 21 // |
| 22 // This bubble is convenient when we wish to ask transient, non-blocking | 22 // This bubble is convenient when we wish to ask transient, non-blocking |
| 23 // questions. Unlike a dialog, a bubble menu disappears when we click outside of | 23 // questions. Unlike a dialog, a bubble menu disappears when we click outside of |
| 24 // its window to avoid blocking user operations. A bubble is laid out as | 24 // its window to avoid blocking user operations. A bubble is laid out as |
| 25 // follows: | 25 // follows: |
| 26 // | 26 // |
| 27 // +------------------------+ | 27 // +------------------------+ |
| 28 // | icon title | | 28 // | icon title | |
| 29 // | message | | 29 // | message | |
| 30 // | link | | 30 // | link | |
| 31 // | [Cancel] [OK] | | 31 // | [Cancel] [OK] | |
| 32 // +------------------------+ | 32 // +------------------------+ |
| 33 // | 33 // |
| 34 @interface ConfirmBubbleCocoa : NSView<NSTextViewDelegate> { | 34 @interface ConfirmBubbleCocoa : NSView<NSTextViewDelegate> { |
| 35 @private | 35 @private |
| 36 NSView* parent_; // weak | 36 NSView* parent_; // weak |
| 37 ConfirmBubbleController* controller_; // weak | 37 ConfirmBubbleController* controller_; // weak |
| 38 | 38 |
| 39 // Controls used in this bubble. | 39 // Controls used in this bubble. |
| 40 scoped_nsobject<NSImageView> icon_; | 40 base::scoped_nsobject<NSImageView> icon_; |
| 41 scoped_nsobject<NSTextView> titleLabel_; | 41 base::scoped_nsobject<NSTextView> titleLabel_; |
| 42 scoped_nsobject<NSTextView> messageLabel_; | 42 base::scoped_nsobject<NSTextView> messageLabel_; |
| 43 scoped_nsobject<NSButton> okButton_; | 43 base::scoped_nsobject<NSButton> okButton_; |
| 44 scoped_nsobject<NSButton> cancelButton_; | 44 base::scoped_nsobject<NSButton> cancelButton_; |
| 45 } | 45 } |
| 46 | 46 |
| 47 // Initializes a bubble view. Since this initializer programmatically creates a | 47 // Initializes a bubble view. Since this initializer programmatically creates a |
| 48 // custom NSView (i.e. without using a nib file), this function should be called | 48 // custom NSView (i.e. without using a nib file), this function should be called |
| 49 // from loadView: of the controller object which owns this view. | 49 // from loadView: of the controller object which owns this view. |
| 50 - (id)initWithParent:(NSView*)parent | 50 - (id)initWithParent:(NSView*)parent |
| 51 controller:(ConfirmBubbleController*)controller; | 51 controller:(ConfirmBubbleController*)controller; |
| 52 | 52 |
| 53 @end | 53 @end |
| 54 | 54 |
| 55 // Exposed only for unit testing. | 55 // Exposed only for unit testing. |
| 56 @interface ConfirmBubbleCocoa (ExposedForUnitTesting) | 56 @interface ConfirmBubbleCocoa (ExposedForUnitTesting) |
| 57 - (void)clickOk; | 57 - (void)clickOk; |
| 58 - (void)clickCancel; | 58 - (void)clickCancel; |
| 59 - (void)clickLink; | 59 - (void)clickLink; |
| 60 @end | 60 @end |
| 61 | 61 |
| 62 #endif // CHROME_BROWSER_UI_COCOA_CONFIRM_BUBBLE_COCOA_H_ | 62 #endif // CHROME_BROWSER_UI_COCOA_CONFIRM_BUBBLE_COCOA_H_ |
| OLD | NEW |