Home | History | Annotate | Download | only in cocoa
      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.
      4 
      5 #import <Cocoa/Cocoa.h>
      6 
      7 #include "base/mac/scoped_nsobject.h"
      8 #include "chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.h"
      9 #include "url/gurl.h"
     10 
     11 @class BrowserWindowController;
     12 class Browser;
     13 @class GTMUILocalizerAndLayoutTweaker;
     14 
     15 // The FullscreenExitBubbleController manages the bubble that tells the user
     16 // how to escape fullscreen mode. The bubble only appears when a tab requests
     17 // fullscreen mode via webkitRequestFullScreen().
     18 @interface FullscreenExitBubbleController :
     19     NSWindowController<NSTextViewDelegate, NSAnimationDelegate> {
     20  @private
     21   BrowserWindowController* owner_;  // weak
     22   Browser* browser_; // weak
     23   GURL url_;
     24   FullscreenExitBubbleType bubbleType_;
     25 
     26  @protected
     27   IBOutlet NSTextField* exitLabelPlaceholder_;
     28   IBOutlet NSTextField* messageLabel_;
     29   IBOutlet NSButton* allowButton_;
     30   IBOutlet NSButton* denyButton_;
     31   IBOutlet GTMUILocalizerAndLayoutTweaker* tweaker_;
     32 
     33   // 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   // a text field |exitLabelPlaceholder_| that's replaced by this text view
     36   // |exitLabel_| in -awakeFromNib.
     37   base::scoped_nsobject<NSTextView> exitLabel_;
     38 
     39   base::scoped_nsobject<NSTimer> hideTimer_;
     40   base::scoped_nsobject<NSAnimation> hideAnimation_;
     41 };
     42 
     43 // Initializes a new InfoBarController.
     44 - (id)initWithOwner:(BrowserWindowController*)owner
     45             browser:(Browser*)browser
     46                 url:(const GURL&)url
     47          bubbleType:(FullscreenExitBubbleType)bubbleType;
     48 
     49 - (void)allow:(id)sender;
     50 - (void)deny:(id)sender;
     51 
     52 - (void)showWindow;
     53 - (void)closeImmediately;
     54 
     55 // Positions the fullscreen exit bubble in the top-center of the window.
     56 - (void)positionInWindowAtTop:(CGFloat)maxY width:(CGFloat)maxWidth;
     57 
     58 @end
     59