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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "base/mac/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
8 #include "chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h" | 8 #include "chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h" |
9 #include "url/gurl.h" | 9 #include "url/gurl.h" |
10 | 10 |
11 @class BrowserWindowController; | 11 @class BrowserWindowController; |
12 class Browser; | 12 class Browser; |
13 @class GTMUILocalizerAndLayoutTweaker; | 13 @class GTMUILocalizerAndLayoutTweaker; |
| 14 @class HyperlinkTextView; |
14 | 15 |
15 // The ExclusiveAccessBubbleWindowController manages the bubble that informs the | 16 // The ExclusiveAccessBubbleWindowController manages the bubble that informs the |
16 // user of different exclusive access state like fullscreen mode, mouse lock, | 17 // user of different exclusive access state like fullscreen mode, mouse lock, |
17 // etc. Refer to EXCLUSIVE_ACCESS_BUBBLE_TYPE for the different possible | 18 // etc. Refer to EXCLUSIVE_ACCESS_BUBBLE_TYPE for the different possible |
18 // conntents of the bubble. | 19 // conntents of the bubble. |
19 @interface ExclusiveAccessBubbleWindowController | 20 @interface ExclusiveAccessBubbleWindowController |
20 : NSWindowController<NSTextViewDelegate, NSAnimationDelegate> { | 21 : NSWindowController<NSTextViewDelegate, NSAnimationDelegate> { |
21 @private | 22 @private |
22 BrowserWindowController* owner_; // weak | 23 BrowserWindowController* owner_; // weak |
23 Browser* browser_; // weak | 24 Browser* browser_; // weak |
24 GURL url_; | 25 GURL url_; |
25 ExclusiveAccessBubbleType bubbleType_; | 26 ExclusiveAccessBubbleType bubbleType_; |
26 | 27 |
27 @protected | 28 @protected |
28 IBOutlet NSTextField* exitLabelPlaceholder_; | 29 IBOutlet NSTextField* exitLabelPlaceholder_; |
29 IBOutlet NSTextField* messageLabel_; | 30 IBOutlet NSTextField* messageLabel_; |
30 IBOutlet NSButton* allowButton_; | 31 IBOutlet NSButton* allowButton_; |
31 IBOutlet NSButton* denyButton_; | 32 IBOutlet NSButton* denyButton_; |
32 IBOutlet GTMUILocalizerAndLayoutTweaker* tweaker_; | 33 IBOutlet GTMUILocalizerAndLayoutTweaker* tweaker_; |
33 | 34 |
34 // Text fields don't work as well with embedded links as text views, but | 35 // Text fields don't work as well with embedded links as text views, but |
35 // text views cannot conveniently be created in IB. The xib file contains | 36 // text views cannot conveniently be created in IB. The xib file contains |
36 // a text field |exitLabelPlaceholder_| that's replaced by this text view | 37 // a text field |exitLabelPlaceholder_| that's replaced by this text view |
37 // |exitLabel_| in -awakeFromNib. | 38 // |exitLabel_| in -awakeFromNib. |
38 base::scoped_nsobject<NSTextView> exitLabel_; | 39 base::scoped_nsobject<HyperlinkTextView> exitLabel_; |
39 | 40 |
40 base::scoped_nsobject<NSTimer> hideTimer_; | 41 base::scoped_nsobject<NSTimer> hideTimer_; |
41 base::scoped_nsobject<NSAnimation> hideAnimation_; | 42 base::scoped_nsobject<NSAnimation> hideAnimation_; |
42 }; | 43 }; |
43 | 44 |
44 // Initializes a new InfoBarController. | 45 // Initializes a new InfoBarController. |
45 - (id)initWithOwner:(BrowserWindowController*)owner | 46 - (id)initWithOwner:(BrowserWindowController*)owner |
46 browser:(Browser*)browser | 47 browser:(Browser*)browser |
47 url:(const GURL&)url | 48 url:(const GURL&)url |
48 bubbleType:(ExclusiveAccessBubbleType)bubbleType; | 49 bubbleType:(ExclusiveAccessBubbleType)bubbleType; |
49 | 50 |
50 - (void)allow:(id)sender; | 51 - (void)allow:(id)sender; |
51 - (void)deny:(id)sender; | 52 - (void)deny:(id)sender; |
52 | 53 |
53 - (void)showWindow; | 54 - (void)showWindow; |
54 - (void)closeImmediately; | 55 - (void)closeImmediately; |
55 | 56 |
56 // Positions the exclusive access bubble in the top-center of the window. | 57 // Positions the exclusive access bubble in the top-center of the window. |
57 - (void)positionInWindowAtTop:(CGFloat)maxY width:(CGFloat)maxWidth; | 58 - (void)positionInWindowAtTop:(CGFloat)maxY width:(CGFloat)maxWidth; |
58 | 59 |
59 @end | 60 @end |
OLD | NEW |