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