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