Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / constrained_window / constrained_window_alert.h
blob4365413abfda834ce0caae7739dc4be6e480c0e3
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_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_ALERT_H_
6 #define CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_ALERT_H_
8 #import <Cocoa/Cocoa.h>
10 #include "base/mac/scoped_nsobject.h"
12 // This class implements an alert that has a constrained window look and feel
13 // (close button on top right, WebUI style buttons, etc...). The alert can be
14 // shown by using the window accessor and calling -[window orderFont:]. Normally
15 // this would be done by ConstrainedWindowSheetController.
16 @interface ConstrainedWindowAlert : NSObject {
17 @private
18 base::scoped_nsobject<NSTextField> informativeTextField_;
19 base::scoped_nsobject<NSTextField> messageTextField_;
20 base::scoped_nsobject<NSButton> linkView_;
21 base::scoped_nsobject<NSView> accessoryView_;
22 base::scoped_nsobject<NSMutableArray> buttons_;
23 base::scoped_nsobject<NSButton> closeButton_;
24 base::scoped_nsobject<NSWindow> window_;
27 @property(nonatomic, copy) NSString* informativeText;
28 @property(nonatomic, copy) NSString* messageText;
29 @property(nonatomic, retain) NSView* accessoryView;
30 @property(nonatomic, readonly) NSArray* buttons;
31 @property(nonatomic, readonly) NSButton* closeButton;
32 @property(nonatomic, readonly) NSWindow* window;
34 // Default initializer.
35 - (id)init;
37 // Adds a button with the given |title|. Newly added buttons are positioned in
38 // order from right to left.
39 - (void)addButtonWithTitle:(NSString*)title
40 keyEquivalent:(NSString*)keyEquivalent
41 target:(id)target
42 action:(SEL)action;
44 // Sets the |text|, the |target| and the |action| of a left-aligned link
45 // positioned above the buttons. If |text| is empty, no link is displayed.
46 - (void)setLinkText:(NSString*)text
47 target:(id)target
48 action:(SEL)action;
50 // Lays out the controls in the alert. This should be called before the window
51 // is displayed.
52 - (void)layout;
54 @end
56 @interface ConstrainedWindowAlert (ExposedForTesting)
57 @property(nonatomic, readonly) NSButton* linkView;
58 @end
60 #endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_ALERT_H_