Chromium Code Reviews| Index: chrome/browser/ui/cocoa/exclusive_access_bubble_window_controller.mm |
| diff --git a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.mm b/chrome/browser/ui/cocoa/exclusive_access_bubble_window_controller.mm |
| similarity index 89% |
| rename from chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.mm |
| rename to chrome/browser/ui/cocoa/exclusive_access_bubble_window_controller.mm |
| index a576002dba7f12f1fe01a3398c937f4348ff1021..6c181a1e17016d526d65cbb814cfe5f7a5fc96a2 100644 |
| --- a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.mm |
| +++ b/chrome/browser/ui/cocoa/exclusive_access_bubble_window_controller.mm |
| @@ -14,11 +14,11 @@ |
| #include "chrome/browser/ui/browser.h" |
| #include "chrome/browser/ui/browser_commands.h" |
| #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| -#import "chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.h" |
| +#import "chrome/browser/ui/cocoa/exclusive_access_bubble_window_controller.h" |
| #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
| #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
| +#include "chrome/browser/ui/fullscreen/exclusive_access_bubble_type.h" |
| #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
| -#include "chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.h" |
| #include "chrome/grit/generated_resources.h" |
| #include "extensions/browser/extension_registry.h" |
| #import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSAnimation+Duration.h" |
| @@ -44,7 +44,7 @@ const float kHideDuration = 0.7; |
| } |
| @end |
| -@interface FullscreenExitBubbleController (PrivateMethods) |
| +@interface ExclusiveAccessBubbleWindowController (PrivateMethods) |
| // Sets |exitLabel_| based on |exitLabelPlaceholder_|, |
| // sets |exitLabelPlaceholder_| to nil. |
| - (void)initializeLabel; |
| @@ -64,14 +64,14 @@ const float kHideDuration = 0.7; |
| (const ui::PlatformAcceleratorCocoa&)item; |
| @end |
| -@implementation FullscreenExitBubbleController |
| +@implementation ExclusiveAccessBubbleWindowController |
| - (id)initWithOwner:(BrowserWindowController*)owner |
| browser:(Browser*)browser |
| url:(const GURL&)url |
| - bubbleType:(FullscreenExitBubbleType)bubbleType { |
| + bubbleType:(ExclusiveAccessBubbleType)bubbleType { |
| NSString* nibPath = |
| - [base::mac::FrameworkBundle() pathForResource:@"FullscreenExitBubble" |
| + [base::mac::FrameworkBundle() pathForResource:@"ExclusiveAccessBubble" |
| ofType:@"nib"]; |
| if ((self = [super initWithWindowNibPath:nibPath owner:self])) { |
| browser_ = browser; |
| @@ -80,8 +80,8 @@ const float kHideDuration = 0.7; |
| bubbleType_ = bubbleType; |
| // Mouse lock expects mouse events to reach the main window immediately. |
| // Make the bubble transparent for mouse events if mouse lock is enabled. |
| - if (bubbleType_ == FEB_TYPE_FULLSCREEN_MOUSELOCK_EXIT_INSTRUCTION || |
| - bubbleType_ == FEB_TYPE_MOUSELOCK_EXIT_INSTRUCTION) |
| + if (bubbleType_ == EAB_TYPE_FULLSCREEN_MOUSELOCK_EXIT_INSTRUCTION || |
|
sky
2014/12/12 00:00:37
I get why you went with EAB here, but IMO the supe
|
| + bubbleType_ == EAB_TYPE_MOUSELOCK_EXIT_INSTRUCTION) |
| [[self window] setIgnoresMouseEvents:YES]; |
| } |
| return self; |
| @@ -91,16 +91,16 @@ const float kHideDuration = 0.7; |
| // The mouselock code expects that mouse events reach the main window |
| // immediately, but the cursor is still over the bubble, which eats the |
| // mouse events. Make the bubble transparent for mouse events. |
| - if (bubbleType_ == FEB_TYPE_FULLSCREEN_MOUSELOCK_BUTTONS || |
| - bubbleType_ == FEB_TYPE_MOUSELOCK_BUTTONS) |
| + if (bubbleType_ == EAB_TYPE_FULLSCREEN_MOUSELOCK_BUTTONS || |
| + bubbleType_ == EAB_TYPE_MOUSELOCK_BUTTONS) |
| [[self window] setIgnoresMouseEvents:YES]; |
| - DCHECK(fullscreen_bubble::ShowButtonsForType(bubbleType_)); |
| + DCHECK(exclusive_access_bubble::ShowButtonsForType(bubbleType_)); |
| browser_->fullscreen_controller()->OnAcceptFullscreenPermission(); |
| } |
| - (void)deny:(id)sender { |
| - DCHECK(fullscreen_bubble::ShowButtonsForType(bubbleType_)); |
| + DCHECK(exclusive_access_bubble::ShowButtonsForType(bubbleType_)); |
| browser_->fullscreen_controller()->OnDenyFullscreenPermission(); |
| } |
| @@ -120,7 +120,7 @@ const float kHideDuration = 0.7; |
| // Completes nib load. |
| InfoBubbleWindow* info_bubble = static_cast<InfoBubbleWindow*>([self window]); |
| [info_bubble setCanBecomeKeyWindow:NO]; |
| - if (!fullscreen_bubble::ShowButtonsForType(bubbleType_)) { |
| + if (!exclusive_access_bubble::ShowButtonsForType(bubbleType_)) { |
| [self showButtons:NO]; |
| [self hideSoon]; |
| } |
| @@ -159,7 +159,7 @@ const float kHideDuration = 0.7; |
| - (void)hideTimerFired:(NSTimer*)timer { |
| // This might fire racily for buttoned bubbles, even though the timer is |
| // cancelled for them. Explicitly check for this case. |
| - if (fullscreen_bubble::ShowButtonsForType(bubbleType_)) |
| + if (exclusive_access_bubble::ShowButtonsForType(bubbleType_)) |
| return; |
| [NSAnimationContext beginGrouping]; |
| @@ -195,7 +195,7 @@ const float kHideDuration = 0.7; |
| @end |
| -@implementation FullscreenExitBubbleController (PrivateMethods) |
| +@implementation ExclusiveAccessBubbleWindowController (PrivateMethods) |
| - (void)initializeLabel { |
| // Replace the label placeholder NSTextField with the real label NSTextView. |
| @@ -214,8 +214,8 @@ const float kHideDuration = 0.7; |
| NSString* exitLinkText; |
| NSString* exitUnlinkedText; |
| - if (bubbleType_ == FEB_TYPE_FULLSCREEN_MOUSELOCK_EXIT_INSTRUCTION || |
| - bubbleType_ == FEB_TYPE_MOUSELOCK_EXIT_INSTRUCTION) { |
| + if (bubbleType_ == EAB_TYPE_FULLSCREEN_MOUSELOCK_EXIT_INSTRUCTION || |
| + bubbleType_ == EAB_TYPE_MOUSELOCK_EXIT_INSTRUCTION) { |
| exitLinkText = @""; |
| exitUnlinkedText = [@" " stringByAppendingString: |
| l10n_util::GetNSStringF(IDS_FULLSCREEN_PRESS_ESC_TO_EXIT, |
| @@ -256,12 +256,14 @@ const float kHideDuration = 0.7; |
| } |
| - (NSString*)getLabelText { |
| - if (bubbleType_ == FEB_TYPE_NONE) |
| + if (bubbleType_ == EAB_TYPE_NONE) |
| return @""; |
| extensions::ExtensionRegistry* registry = |
| extensions::ExtensionRegistry::Get(browser_->profile()); |
| return SysUTF16ToNSString( |
| - fullscreen_bubble::GetLabelTextForType(bubbleType_, url_, registry)); |
| + exclusive_access_bubble::GetLabelTextForType(bubbleType_, |
| + url_, |
| + registry)); |
| } |
| // This looks at the Main Menu and determines what the user has set as the |