Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / confirm_bubble_cocoa.h
blobc1971b0b797220a881f56ea44234eaa308b5eeb2
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
25 // follows:
27 // +------------------------+
28 // | icon title |
29 // | message |
30 // | link |
31 // | [Cancel] [OK] |
32 // +------------------------+
34 @interface ConfirmBubbleCocoa : NSView<NSTextViewDelegate> {
35 @private
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;
53 @end
55 // Exposed only for unit testing.
56 @interface ConfirmBubbleCocoa (ExposedForUnitTesting)
57 - (void)clickOk;
58 - (void)clickCancel;
59 - (void)clickLink;
60 @end
62 #endif // CHROME_BROWSER_UI_COCOA_CONFIRM_BUBBLE_COCOA_H_