diff options
author | scheib@chromium.org <scheib@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-09 23:35:40 +0000 |
---|---|---|
committer | scheib@chromium.org <scheib@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-09 23:35:40 +0000 |
commit | 9cbcbbb3bb2cfbc7dfc50cb65d9b2e0a4ab7a240 (patch) | |
tree | 63ccc6a1aa06361d0a2a1c89c5918b0196484e51 | |
parent | c878bb13ef0175d11e7d57a739fa28d6367220e6 (diff) | |
download | chromium_src-9cbcbbb3bb2cfbc7dfc50cb65d9b2e0a4ab7a240.zip chromium_src-9cbcbbb3bb2cfbc7dfc50cb65d9b2e0a4ab7a240.tar.gz chromium_src-9cbcbbb3bb2cfbc7dfc50cb65d9b2e0a4ab7a240.tar.bz2 |
Merge 143397 - Simplify fullscreen exit bubble on mac; updating always creates one freshly.
Merge approved in roll-up issue crbug.com/134196#c9.
This also moved the logic for when NOT to display the bubble to a single
location, fixing 129456.
BUG=129456
TEST=Manually, see bug.
Review URL: https://chromiumcodereview.appspot.com/10573003
TBR=scheib@chromium.org
git-svn-id: svn://svn.chromium.org/chrome/branches/1180/src@145787 0039d316-1c4b-4281-b951-d872f2087c98
4 files changed, 16 insertions, 56 deletions
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm index b1fb309..cc443d8 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller.mm @@ -1982,16 +1982,7 @@ willAnimateFromState:(bookmarks::VisualState)oldState bubbleType:(FullscreenExitBubbleType)bubbleType { fullscreenUrl_ = url; fullscreenBubbleType_ = bubbleType; - if (bubbleType == FEB_TYPE_NONE || - bubbleType == FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION) { - // Show no exit instruction bubble on Mac when in Browser Fullscreen. - [self destroyFullscreenExitBubbleIfNecessary]; - } else { - if (!fullscreenExitBubbleController_.get()) { - [self showFullscreenExitBubbleIfNecessary]; - } - [fullscreenExitBubbleController_.get() updateURL:url bubbleType:bubbleType]; - } + [self showFullscreenExitBubbleIfNecessary]; } - (BOOL)isFullscreen { diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.mm b/chrome/browser/ui/cocoa/browser_window_controller_private.mm index 5352dde..ee0310d 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm @@ -795,14 +795,20 @@ willPositionSheet:(NSWindow*)sheet - (void)showFullscreenExitBubbleIfNecessary { [presentationModeController_ ensureOverlayHiddenWithAnimation:NO delay:NO]; - [fullscreenExitBubbleController_ closeImmediately]; - fullscreenExitBubbleController_.reset( - [[FullscreenExitBubbleController alloc] - initWithOwner:self - browser:browser_.get() - url:fullscreenUrl_ - bubbleType:fullscreenBubbleType_]); - [fullscreenExitBubbleController_ showWindow]; + if (fullscreenBubbleType_ == FEB_TYPE_NONE || + fullscreenBubbleType_ == FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION) { + // Show no exit instruction bubble on Mac when in Browser Fullscreen. + [self destroyFullscreenExitBubbleIfNecessary]; + } else { + [fullscreenExitBubbleController_ closeImmediately]; + fullscreenExitBubbleController_.reset( + [[FullscreenExitBubbleController alloc] + initWithOwner:self + browser:browser_.get() + url:fullscreenUrl_ + bubbleType:fullscreenBubbleType_]); + [fullscreenExitBubbleController_ showWindow]; + } } - (void)destroyFullscreenExitBubbleIfNecessary { diff --git a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.h b/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.h index 827963f..7afff88 100644 --- a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.h +++ b/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -22,7 +22,6 @@ class Browser; BrowserWindowController* owner_; // weak Browser* browser_; // weak GURL url_; - BOOL showButtons_; FullscreenExitBubbleType bubbleType_; @protected @@ -57,8 +56,4 @@ class Browser; // Positions the fullscreen exit bubble in the top-center of the window. - (void)positionInWindowAtTop:(CGFloat)maxY width:(CGFloat)maxWidth; -// Updates the bubble contents with |url| and |bubbleType|. -- (void)updateURL:(const GURL&)url - bubbleType:(FullscreenExitBubbleType)bubbleType; - @end diff --git a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.mm b/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.mm index 88ebc6d..3f0e1d8 100644 --- a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.mm +++ b/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.mm @@ -96,8 +96,6 @@ const float kHideDuration = 0.7; DCHECK(fullscreen_bubble::ShowButtonsForType(bubbleType_)); browser_->OnAcceptFullscreenPermission( url_, bubbleType_); - [self showButtons:NO]; - [self hideSoon]; } - (void)deny:(id)sender { @@ -148,36 +146,6 @@ const float kHideDuration = 0.7; [[self window] setFrameOrigin:origin]; } -- (void)updateURL:(const GURL&)url - bubbleType:(FullscreenExitBubbleType)bubbleType { - bubbleType_ = bubbleType; - - [messageLabel_ setStringValue:[self getLabelText]]; - - // Make sure the bubble is visible. - [hideAnimation_.get() stopAnimation]; - [hideTimer_ invalidate]; - [[[self window] animator] setAlphaValue:1.0]; - - if (fullscreen_bubble::ShowButtonsForType(bubbleType)) { - [denyButton_ setTitle:SysUTF16ToNSString( - fullscreen_bubble::GetDenyButtonTextForType(bubbleType))]; - [self showButtons:YES]; - - // Reenable mouse events if they were disabled previously. - [[self window] setIgnoresMouseEvents:NO]; - } else { - [self showButtons:NO]; - // Only button-less bubbles auto-hide. - [self hideSoon]; - } - // TODO(jeremya): show "Press Esc to exit" instead of a link on mouselock. - - // Relayout. A bit jumpy, but functional. - [tweaker_ tweakUI:[self window]]; - [owner_ layoutSubviews]; -} - // Called when someone clicks on the embedded link. - (BOOL) textView:(NSTextView*)textView clickedOnLink:(id)link |