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.
5 #ifndef CHROME_BROWSER_UI_COCOA_CONFIRM_BUBBLE_COCOA_H_
6 #define CHROME_BROWSER_UI_COCOA_CONFIRM_BUBBLE_COCOA_H_
8 #import <Cocoa/Cocoa.h>
10 #include "base/mac/scoped_nsobject.h"
12 @
class ConfirmBubbleController
;
13 class ConfirmBubbleModel
;
15 // A view class that implements a bubble consisting of the following items:
16 // * one icon ("icon")
17 // * one title text ("title")
18 // * one message text ("message")
19 // * one optional link ("link")
20 // * two optional buttons ("ok" and "cancel")
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
24 // its window to avoid blocking user operations. A bubble is laid out as
27 // +------------------------+
32 // +------------------------+
34 @interface ConfirmBubbleCocoa
: NSView
<NSTextViewDelegate
> {
36 NSView
* parent_
; // weak
37 ConfirmBubbleController
* controller_
; // weak
39 // Controls used in this bubble.
40 base::scoped_nsobject
<NSImageView
> icon_
;
41 base::scoped_nsobject
<NSTextView
> titleLabel_
;
42 base::scoped_nsobject
<NSTextView
> messageLabel_
;
43 base::scoped_nsobject
<NSButton
> okButton_
;
44 base::scoped_nsobject
<NSButton
> cancelButton_
;
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
49 // from loadView: of the controller object which owns this view.
50 - (id
)initWithParent
:(NSView
*)parent
51 controller
:(ConfirmBubbleController
*)controller
;
55 // Exposed only for unit testing.
56 @interface
ConfirmBubbleCocoa (ExposedForUnitTesting
)
62 #endif // CHROME_BROWSER_UI_COCOA_CONFIRM_BUBBLE_COCOA_H_