summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsriramsr <sriramsr@chromium.org>2014-12-12 18:53:42 -0800
committerCommit bot <commit-bot@chromium.org>2014-12-13 02:54:27 +0000
commit49dd49512c7ee768231b5cca8a5ad475273a012b (patch)
tree7ad5ce6262a648f9e29895a733c058d0897f7640
parent3863a6181578b609db991e62fa7d4d11079fd1e4 (diff)
downloadchromium_src-49dd49512c7ee768231b5cca8a5ad475273a012b.zip
chromium_src-49dd49512c7ee768231b5cca8a5ad475273a012b.tar.gz
chromium_src-49dd49512c7ee768231b5cca8a5ad475273a012b.tar.bz2
Fullscreen exit bubble is actually used to control both mouse lock and fullscreen. Addition of keyboard lock would make it the third behavior requiring some clean-up. This is part 1 of the refactor and contains just renames.
Also the difference from the original CL is that I have reverted rename of fullscreen_controller in lieu of doing it when I actually move the functionality and using exclusive_access_* instead of lock_exit. BUG=166928 Review URL: https://codereview.chromium.org/789403002 Cr-Commit-Position: refs/heads/master@{#308231}
-rw-r--r--chrome/app/nibs/ExclusiveAccessBubble.xib (renamed from chrome/app/nibs/FullscreenExitBubble.xib)12
-rw-r--r--chrome/browser/extensions/extension_fullscreen_apitest.cc6
-rw-r--r--chrome/browser/ui/browser.h4
-rw-r--r--chrome/browser/ui/browser_command_controller_unittest.cc2
-rw-r--r--chrome/browser/ui/browser_window.h6
-rw-r--r--chrome/browser/ui/cocoa/applescript/window_applescript.mm3
-rw-r--r--chrome/browser/ui/cocoa/browser_window_cocoa.h4
-rw-r--r--chrome/browser/ui/cocoa/browser_window_cocoa.mm6
-rw-r--r--chrome/browser/ui/cocoa/browser_window_controller.h16
-rw-r--r--chrome/browser/ui/cocoa/browser_window_controller.mm15
-rw-r--r--chrome/browser/ui/cocoa/browser_window_controller_private.mm21
-rw-r--r--chrome/browser/ui/cocoa/exclusive_access_bubble_view.h14
-rw-r--r--chrome/browser/ui/cocoa/exclusive_access_bubble_view.mm (renamed from chrome/browser/ui/cocoa/fullscreen_exit_bubble_view.mm)11
-rw-r--r--chrome/browser/ui/cocoa/exclusive_access_bubble_window_controller.h (renamed from chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.h)21
-rw-r--r--chrome/browser/ui/cocoa/exclusive_access_bubble_window_controller.mm (renamed from chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.mm)109
-rw-r--r--chrome/browser/ui/cocoa/exclusive_access_bubble_window_controller_unittest.mm (renamed from chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller_unittest.mm)53
-rw-r--r--chrome/browser/ui/cocoa/fullscreen_exit_bubble_view.h14
-rw-r--r--chrome/browser/ui/cocoa/view_id_util_browsertest.mm3
-rw-r--r--chrome/browser/ui/fullscreen/exclusive_access_bubble.cc (renamed from chrome/browser/ui/fullscreen/fullscreen_exit_bubble.cc)82
-rw-r--r--chrome/browser/ui/fullscreen/exclusive_access_bubble.h (renamed from chrome/browser/ui/fullscreen/fullscreen_exit_bubble.h)43
-rw-r--r--chrome/browser/ui/fullscreen/exclusive_access_bubble_type.cc131
-rw-r--r--chrome/browser/ui/fullscreen/exclusive_access_bubble_type.h50
-rw-r--r--chrome/browser/ui/fullscreen/fullscreen_controller.cc44
-rw-r--r--chrome/browser/ui/fullscreen/fullscreen_controller.h4
-rw-r--r--chrome/browser/ui/fullscreen/fullscreen_controller_state_unittest.cc8
-rw-r--r--chrome/browser/ui/fullscreen/fullscreen_controller_test.cc30
-rw-r--r--chrome/browser/ui/fullscreen/fullscreen_controller_test.h4
-rw-r--r--chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.cc131
-rw-r--r--chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.h50
-rw-r--r--chrome/browser/ui/views/exclusive_access_bubble_views.cc (renamed from chrome/browser/ui/views/fullscreen_exit_bubble_views.cc)151
-rw-r--r--chrome/browser/ui/views/exclusive_access_bubble_views.h (renamed from chrome/browser/ui/views/fullscreen_exit_bubble_views.h)38
-rw-r--r--chrome/browser/ui/views/frame/browser_view.cc38
-rw-r--r--chrome/browser/ui/views/frame/browser_view.h14
-rw-r--r--chrome/browser/ui/views/frame/browser_view_layout.cc10
-rw-r--r--chrome/browser/ui/views/frame/browser_view_layout_delegate.h4
-rw-r--r--chrome/browser/ui/views/frame/browser_view_layout_unittest.cc2
-rw-r--r--chrome/chrome_browser_ui.gypi20
-rw-r--r--chrome/chrome_nibs.gyp8
-rw-r--r--chrome/chrome_nibs.gypi2
-rw-r--r--chrome/chrome_tests_unit.gypi2
-rw-r--r--chrome/test/base/test_browser_window.h4
41 files changed, 605 insertions, 585 deletions
diff --git a/chrome/app/nibs/FullscreenExitBubble.xib b/chrome/app/nibs/ExclusiveAccessBubble.xib
index 246eb45..cb64622 100644
--- a/chrome/app/nibs/FullscreenExitBubble.xib
+++ b/chrome/app/nibs/ExclusiveAccessBubble.xib
@@ -32,7 +32,7 @@
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSCustomObject" id="1001">
- <string key="NSClassName">FullscreenExitBubbleController</string>
+ <string key="NSClassName">ExclusiveAccessBubbleWindowController</string>
</object>
<object class="NSCustomObject" id="1003">
<string key="NSClassName">FirstResponder</string>
@@ -215,7 +215,7 @@
<string key="NSFrameSize">{629, 109}</string>
<reference key="NSSuperview" ref="1006"/>
<reference key="NSWindow"/>
- <string key="NSClassName">FullscreenExitBubbleView</string>
+ <string key="NSClassName">ExclusiveAccessBubbleView</string>
</object>
</object>
<string key="NSFrameSize">{629, 109}</string>
@@ -570,7 +570,7 @@
</object>
</object>
<object class="IBPartialClassDescription">
- <string key="className">FullscreenExitBubbleController</string>
+ <string key="className">ExclusiveAccessBubbleWindowController</string>
<string key="superclassName">NSWindowController</string>
<object class="NSMutableDictionary" key="actions">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -659,15 +659,15 @@
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/FullscreenExitBubbleController.h</string>
+ <string key="minorKey">./Classes/ExclusiveAccessBubbleWindowController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
- <string key="className">FullscreenExitBubbleView</string>
+ <string key="className">ExclusiveAccessBubbleView</string>
<string key="superclassName">NSView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/FullscreenExitBubbleView.h</string>
+ <string key="minorKey">./Classes/ExclusiveAccessBubbleView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
diff --git a/chrome/browser/extensions/extension_fullscreen_apitest.cc b/chrome/browser/extensions/extension_fullscreen_apitest.cc
index d55b480..f05b2ef 100644
--- a/chrome/browser/extensions/extension_fullscreen_apitest.cc
+++ b/chrome/browser/extensions/extension_fullscreen_apitest.cc
@@ -21,7 +21,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest,
IN_PROC_BROWSER_TEST_F(ExtensionApiTest,
FocusWindowDoesNotExitFullscreen) {
browser()->window()->EnterFullscreen(
- GURL(), FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION, false);
+ GURL(), EXCLUSIVE_ACCESS_BUBBLE_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION,
+ false);
bool is_fullscreen = browser()->window()->IsFullscreen();
ASSERT_TRUE(RunExtensionTest("window_update/focus")) << message_;
ASSERT_EQ(is_fullscreen, browser()->window()->IsFullscreen());
@@ -31,7 +32,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest,
IN_PROC_BROWSER_TEST_F(ExtensionApiTest,
DISABLED_UpdateWindowSizeExitsFullscreen) {
browser()->window()->EnterFullscreen(
- GURL(), FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION, false);
+ GURL(), EXCLUSIVE_ACCESS_BUBBLE_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION,
+ false);
ASSERT_TRUE(RunExtensionTest("window_update/sizing")) << message_;
ASSERT_FALSE(browser()->window()->IsFullscreen());
}
diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h
index 3d8c0ae..d9b4005 100644
--- a/chrome/browser/ui/browser.h
+++ b/chrome/browser/ui/browser.h
@@ -496,10 +496,10 @@ class Browser : public TabStripModelObserver,
FRIEND_TEST_ALL_PREFIXES(BrowserTest, OpenAppWindowLikeNtp);
FRIEND_TEST_ALL_PREFIXES(BrowserTest, AppIdSwitch);
FRIEND_TEST_ALL_PREFIXES(BrowserTest, ShouldShowLocationBar);
+ FRIEND_TEST_ALL_PREFIXES(ExclusiveAccessBubbleWindowControllerTest,
+ DenyExitsFullscreen);
FRIEND_TEST_ALL_PREFIXES(FullscreenControllerTest,
TabEntersPresentationModeFromWindowed);
- FRIEND_TEST_ALL_PREFIXES(FullscreenExitBubbleControllerTest,
- DenyExitsFullscreen);
FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorTest, OpenAppShortcutNoPref);
FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorTest,
OpenAppShortcutWindowPref);
diff --git a/chrome/browser/ui/browser_command_controller_unittest.cc b/chrome/browser/ui/browser_command_controller_unittest.cc
index cf77f5f..6204b0b 100644
--- a/chrome/browser/ui/browser_command_controller_unittest.cc
+++ b/chrome/browser/ui/browser_command_controller_unittest.cc
@@ -312,7 +312,7 @@ class FullscreenTestBrowserWindow : public TestBrowserWindow {
bool ShouldHideUIForFullscreen() const override { return fullscreen_; }
bool IsFullscreen() const override { return fullscreen_; }
void EnterFullscreen(const GURL& url,
- FullscreenExitBubbleType type,
+ ExclusiveAccessBubbleType type,
bool with_toolbar) override {
fullscreen_ = true;
}
diff --git a/chrome/browser/ui/browser_window.h b/chrome/browser/ui/browser_window.h
index ccd1b6f..5515fba 100644
--- a/chrome/browser/ui/browser_window.h
+++ b/chrome/browser/ui/browser_window.h
@@ -11,7 +11,7 @@
#include "chrome/browser/translate/chrome_translate_client.h"
#include "chrome/browser/ui/bookmarks/bookmark_bar.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.h"
+#include "chrome/browser/ui/fullscreen/exclusive_access_bubble_type.h"
#include "chrome/browser/ui/host_desktop.h"
#include "chrome/browser/ui/sync/one_click_signin_sync_starter.h"
#include "components/content_settings/core/common/content_settings_types.h"
@@ -131,12 +131,12 @@ class BrowserWindow : public ui::BaseWindow {
// On Mac, the tab strip and toolbar will be shown if |with_toolbar| is true,
// |with_toolbar| is ignored on other platforms.
virtual void EnterFullscreen(const GURL& url,
- FullscreenExitBubbleType bubble_type,
+ ExclusiveAccessBubbleType bubble_type,
bool with_toolbar) = 0;
virtual void ExitFullscreen() = 0;
virtual void UpdateFullscreenExitBubbleContent(
const GURL& url,
- FullscreenExitBubbleType bubble_type) = 0;
+ ExclusiveAccessBubbleType bubble_type) = 0;
// Windows and GTK remove the top controls in fullscreen, but Mac and Ash
// keep the controls in a slide-down panel.
diff --git a/chrome/browser/ui/cocoa/applescript/window_applescript.mm b/chrome/browser/ui/cocoa/applescript/window_applescript.mm
index 90ba2d7..8ee0aaa 100644
--- a/chrome/browser/ui/cocoa/applescript/window_applescript.mm
+++ b/chrome/browser/ui/cocoa/applescript/window_applescript.mm
@@ -262,7 +262,8 @@
- (void)handlesEnterPresentationMode:(NSScriptCommand*)command {
if (browser_->window()) {
browser_->window()->EnterFullscreen(
- GURL(), FEB_TYPE_FULLSCREEN_EXIT_INSTRUCTION, false);
+ GURL(), EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_EXIT_INSTRUCTION,
+ false);
}
}
diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.h b/chrome/browser/ui/cocoa/browser_window_cocoa.h
index 00a9d0d..ed9c932 100644
--- a/chrome/browser/ui/cocoa/browser_window_cocoa.h
+++ b/chrome/browser/ui/cocoa/browser_window_cocoa.h
@@ -76,12 +76,12 @@ class BrowserWindowCocoa :
void Minimize() override;
void Restore() override;
void EnterFullscreen(const GURL& url,
- FullscreenExitBubbleType type,
+ ExclusiveAccessBubbleType type,
bool with_toolbar) override;
void ExitFullscreen() override;
void UpdateFullscreenExitBubbleContent(
const GURL& url,
- FullscreenExitBubbleType bubble_type) override;
+ ExclusiveAccessBubbleType bubble_type) override;
bool ShouldHideUIForFullscreen() const override;
bool IsFullscreen() const override;
bool IsFullscreenBubbleVisible() const override;
diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.mm b/chrome/browser/ui/cocoa/browser_window_cocoa.mm
index 485ebb1..9b954b3 100644
--- a/chrome/browser/ui/cocoa/browser_window_cocoa.mm
+++ b/chrome/browser/ui/cocoa/browser_window_cocoa.mm
@@ -375,7 +375,7 @@ void BrowserWindowCocoa::Restore() {
// See browser_window_controller.h for a detailed explanation of the logic in
// this method.
void BrowserWindowCocoa::EnterFullscreen(const GURL& url,
- FullscreenExitBubbleType bubble_type,
+ ExclusiveAccessBubbleType bubble_type,
bool with_toolbar) {
if (browser_->fullscreen_controller()->IsWindowFullscreenForTabOrPending())
[controller_ enterWebContentFullscreenForURL:url bubbleType:bubble_type];
@@ -390,8 +390,8 @@ void BrowserWindowCocoa::ExitFullscreen() {
}
void BrowserWindowCocoa::UpdateFullscreenExitBubbleContent(
- const GURL& url,
- FullscreenExitBubbleType bubble_type) {
+ const GURL& url,
+ ExclusiveAccessBubbleType bubble_type) {
[controller_ updateFullscreenExitBubbleURL:url bubbleType:bubble_type];
}
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.h b/chrome/browser/ui/cocoa/browser_window_controller.h
index e6204e7..0624542a 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.h
+++ b/chrome/browser/ui/cocoa/browser_window_controller.h
@@ -18,7 +18,7 @@
#import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h"
#import "chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.h"
#import "chrome/browser/ui/cocoa/browser_command_executor.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/tabs/tab_strip_controller.h"
#import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h"
#import "chrome/browser/ui/cocoa/themed_window.h"
@@ -81,8 +81,8 @@ class Command;
base::scoped_nsobject<OverlayableContentsController>
overlayableContentsController_;
base::scoped_nsobject<PresentationModeController> presentationModeController_;
- base::scoped_nsobject<FullscreenExitBubbleController>
- fullscreenExitBubbleController_;
+ base::scoped_nsobject<ExclusiveAccessBubbleWindowController>
+ exclusiveAccessBubbleWindowController_;
// Strong. StatusBubble is a special case of a strong reference that
// we don't wrap in a scoped_ptr because it is acting the same
@@ -172,7 +172,7 @@ class Command;
// fullscreen type, since we can't show the bubble until
// -windowDidEnterFullScreen: gets called.
GURL fullscreenUrl_;
- FullscreenExitBubbleType fullscreenBubbleType_;
+ ExclusiveAccessBubbleType exclusiveAccessBubbleType_;
// The Extension Command Registry used to determine which keyboard events to
// handle.
@@ -511,7 +511,7 @@ class Command;
// Updates the contents of the fullscreen exit bubble with |url| and
// |bubbleType|.
- (void)updateFullscreenExitBubbleURL:(const GURL&)url
- bubbleType:(FullscreenExitBubbleType)bubbleType;
+ bubbleType:(ExclusiveAccessBubbleType)bubbleType;
// Returns YES if the browser window is in or entering any fullscreen mode.
- (BOOL)isInAnyFullscreenMode;
@@ -526,11 +526,11 @@ class Command;
// Enter fullscreen for an extension.
- (void)enterExtensionFullscreenForURL:(const GURL&)url
- bubbleType:(FullscreenExitBubbleType)bubbleType;
+ bubbleType:(ExclusiveAccessBubbleType)bubbleType;
// Enters Immersive Fullscreen for the given URL.
- (void)enterWebContentFullscreenForURL:(const GURL&)url
- bubbleType:(FullscreenExitBubbleType)bubbleType;
+ bubbleType:(ExclusiveAccessBubbleType)bubbleType;
// Exits the current fullscreen mode.
- (void)exitAnyFullscreen;
@@ -602,7 +602,7 @@ class Command;
to:(NSRect)target;
// The fullscreen exit bubble controller, or nil if the bubble isn't showing.
-- (FullscreenExitBubbleController*)fullscreenExitBubbleController;
+- (ExclusiveAccessBubbleWindowController*)exclusiveAccessBubbleWindowController;
// Gets the rect, in window base coordinates, that the omnibox popup should be
// positioned relative to.
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm
index eea5f0f..5f13cb6 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller.mm
@@ -2021,8 +2021,9 @@ willAnimateFromState:(BookmarkBar::State)oldState
}
// (Private/TestingAPI)
-- (FullscreenExitBubbleController*)fullscreenExitBubbleController {
- return fullscreenExitBubbleController_.get();
+- (ExclusiveAccessBubbleWindowController*)
+ exclusiveAccessBubbleWindowController {
+ return exclusiveAccessBubbleWindowController_.get();
}
- (NSRect)omniboxPopupAnchorRect {
@@ -2091,9 +2092,9 @@ willAnimateFromState:(BookmarkBar::State)oldState
}
- (void)updateFullscreenExitBubbleURL:(const GURL&)url
- bubbleType:(FullscreenExitBubbleType)bubbleType {
+ bubbleType:(ExclusiveAccessBubbleType)bubbleType {
fullscreenUrl_ = url;
- fullscreenBubbleType_ = bubbleType;
+ exclusiveAccessBubbleType_ = bubbleType;
[self layoutSubviews];
[self showFullscreenExitBubbleIfNecessary];
}
@@ -2113,10 +2114,10 @@ willAnimateFromState:(BookmarkBar::State)oldState
}
- (void)enterExtensionFullscreenForURL:(const GURL&)url
- bubbleType:(FullscreenExitBubbleType)bubbleType {
+ bubbleType:(ExclusiveAccessBubbleType)bubbleType {
if (chrome::mac::SupportsSystemFullscreen()) {
fullscreenUrl_ = url;
- fullscreenBubbleType_ = bubbleType;
+ exclusiveAccessBubbleType_ = bubbleType;
[self enterBrowserFullscreenWithToolbar:NO];
} else {
[self enterImmersiveFullscreen];
@@ -2126,7 +2127,7 @@ willAnimateFromState:(BookmarkBar::State)oldState
}
- (void)enterWebContentFullscreenForURL:(const GURL&)url
- bubbleType:(FullscreenExitBubbleType)bubbleType {
+ bubbleType:(ExclusiveAccessBubbleType)bubbleType {
[self enterImmersiveFullscreen];
if (!url.is_empty())
[self updateFullscreenExitBubbleURL:url bubbleType:bubbleType];
diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.mm b/chrome/browser/ui/cocoa/browser_window_controller_private.mm
index f7350b8..ee44baf 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm
@@ -613,25 +613,26 @@ willPositionSheet:(NSWindow*)sheet
[self hideOverlayIfPossibleWithAnimation:NO delay:NO];
- if (fullscreenBubbleType_ == FEB_TYPE_NONE ||
- fullscreenBubbleType_ == FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION) {
+ if (exclusiveAccessBubbleType_ == EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE ||
+ exclusiveAccessBubbleType_ ==
+ EXCLUSIVE_ACCESS_BUBBLE_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]
+ [exclusiveAccessBubbleWindowController_ closeImmediately];
+ exclusiveAccessBubbleWindowController_.reset(
+ [[ExclusiveAccessBubbleWindowController alloc]
initWithOwner:self
browser:browser_.get()
url:fullscreenUrl_
- bubbleType:fullscreenBubbleType_]);
- [fullscreenExitBubbleController_ showWindow];
+ bubbleType:exclusiveAccessBubbleType_]);
+ [exclusiveAccessBubbleWindowController_ showWindow];
}
}
- (void)destroyFullscreenExitBubbleIfNecessary {
- [fullscreenExitBubbleController_ closeImmediately];
- fullscreenExitBubbleController_.reset();
+ [exclusiveAccessBubbleWindowController_ closeImmediately];
+ exclusiveAccessBubbleWindowController_.reset();
}
- (void)contentViewDidResize:(NSNotification*)notification {
@@ -916,7 +917,7 @@ willPositionSheet:(NSWindow*)sheet
positionFindBarViewAtMaxY:output.findBarMaxY
maxWidth:NSWidth(output.contentAreaFrame)];
- [fullscreenExitBubbleController_
+ [exclusiveAccessBubbleWindowController_
positionInWindowAtTop:output.fullscreenExitButtonMaxY
width:NSWidth(output.contentAreaFrame)];
}
diff --git a/chrome/browser/ui/cocoa/exclusive_access_bubble_view.h b/chrome/browser/ui/cocoa/exclusive_access_bubble_view.h
new file mode 100644
index 0000000..ef761b5
--- /dev/null
+++ b/chrome/browser/ui/cocoa/exclusive_access_bubble_view.h
@@ -0,0 +1,14 @@
+// Copyright (c) 2011 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.
+
+#ifndef CHROME_BROWSER_UI_COCOA_EXCLUSIVE_ACCESS_BUBBLE_VIEW_H_
+#define CHROME_BROWSER_UI_COCOA_EXCLUSIVE_ACCESS_BUBBLE_VIEW_H_
+
+#import <Cocoa/Cocoa.h>
+
+// A view that handles painting the background for the Exclusive Access Bubble.
+@interface ExclusiveAccessBubbleView : NSView
+@end
+
+#endif // CHROME_BROWSER_UI_COCOA_EXCLUSIVE_ACCESS_BUBBLE_VIEW_H_
diff --git a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_view.mm b/chrome/browser/ui/cocoa/exclusive_access_bubble_view.mm
index 8d79127..39061e5 100644
--- a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_view.mm
+++ b/chrome/browser/ui/cocoa/exclusive_access_bubble_view.mm
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#import "chrome/browser/ui/cocoa/fullscreen_exit_bubble_view.h"
+#import "chrome/browser/ui/cocoa/exclusive_access_bubble_view.h"
#include "base/mac/mac_util.h"
#include "base/mac/scoped_nsobject.h"
@@ -20,10 +20,9 @@ const CGFloat kShadowBlurRadius = 150;
const CGFloat kShadowBlurRadiusLion = 30;
const CGFloat kShadowAlpha = 0.5;
const CGFloat kBubbleCornerRadius = 8.0;
-
}
-@implementation FullscreenExitBubbleView
+@implementation ExclusiveAccessBubbleView
- (void)drawRect:(NSRect)rect {
// Make room for the border to be seen.
@@ -36,9 +35,7 @@ const CGFloat kBubbleCornerRadius = 8.0;
CGFloat radius = kBubbleCornerRadius;
// Start with a rounded rectangle.
- [bezier appendBezierPathWithRoundedRect:bounds
- xRadius:radius
- yRadius:radius];
+ [bezier appendBezierPathWithRoundedRect:bounds xRadius:radius yRadius:radius];
[bezier closePath];
[[NSColor whiteColor] set];
@@ -50,7 +47,7 @@ const CGFloat kBubbleCornerRadius = 8.0;
[shadow setShadowBlurRadius:kShadowBlurRadius];
}
[shadow setShadowColor:[[NSColor blackColor]
- colorWithAlphaComponent:kShadowAlpha]];
+ colorWithAlphaComponent:kShadowAlpha]];
[shadow set];
[bezier fill];
diff --git a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.h b/chrome/browser/ui/cocoa/exclusive_access_bubble_window_controller.h
index f2ce354..fda0854 100644
--- a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.h
+++ b/chrome/browser/ui/cocoa/exclusive_access_bubble_window_controller.h
@@ -5,23 +5,24 @@
#import <Cocoa/Cocoa.h>
#include "base/mac/scoped_nsobject.h"
-#include "chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.h"
+#include "chrome/browser/ui/fullscreen/exclusive_access_bubble_type.h"
#include "url/gurl.h"
@class BrowserWindowController;
class Browser;
@class GTMUILocalizerAndLayoutTweaker;
-// The FullscreenExitBubbleController manages the bubble that tells the user
-// how to escape fullscreen mode. The bubble only appears when a tab requests
-// fullscreen mode via webkitRequestFullScreen().
-@interface FullscreenExitBubbleController :
- NSWindowController<NSTextViewDelegate, NSAnimationDelegate> {
+// The ExclusiveAccessBubbleWindowController manages the bubble that informs the
+// user of different exclusive access state like fullscreen mode, mouse lock,
+// etc. Refer to EXCLUSIVE_ACCESS_BUBBLE_TYPE for the different possible
+// conntents of the bubble.
+@interface ExclusiveAccessBubbleWindowController
+ : NSWindowController<NSTextViewDelegate, NSAnimationDelegate> {
@private
BrowserWindowController* owner_; // weak
- Browser* browser_; // weak
+ Browser* browser_; // weak
GURL url_;
- FullscreenExitBubbleType bubbleType_;
+ ExclusiveAccessBubbleType bubbleType_;
@protected
IBOutlet NSTextField* exitLabelPlaceholder_;
@@ -44,7 +45,7 @@ class Browser;
- (id)initWithOwner:(BrowserWindowController*)owner
browser:(Browser*)browser
url:(const GURL&)url
- bubbleType:(FullscreenExitBubbleType)bubbleType;
+ bubbleType:(ExclusiveAccessBubbleType)bubbleType;
- (void)allow:(id)sender;
- (void)deny:(id)sender;
@@ -52,7 +53,7 @@ class Browser;
- (void)showWindow;
- (void)closeImmediately;
-// Positions the fullscreen exit bubble in the top-center of the window.
+// Positions the exclusive access bubble in the top-center of the window.
- (void)positionInWindowAtTop:(CGFloat)maxY width:(CGFloat)maxWidth;
@end
diff --git a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.mm b/chrome/browser/ui/cocoa/exclusive_access_bubble_window_controller.mm
index a576002..05e7b0a 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"
@@ -30,11 +30,10 @@
#include "ui/base/l10n/l10n_util_mac.h"
#include "ui/strings/grit/ui_strings.h"
-
namespace {
const float kInitialDelay = 3.8;
const float kHideDuration = 0.7;
-} // namespace
+} // namespace
@interface OneClickHyperlinkTextView : HyperlinkTextView
@end
@@ -44,7 +43,7 @@ const float kHideDuration = 0.7;
}
@end
-@interface FullscreenExitBubbleController (PrivateMethods)
+@interface ExclusiveAccessBubbleWindowController (PrivateMethods)
// Sets |exitLabel_| based on |exitLabelPlaceholder_|,
// sets |exitLabelPlaceholder_| to nil.
- (void)initializeLabel;
@@ -61,17 +60,17 @@ const float kHideDuration = 0.7;
+ (NSString*)keyCommandString;
+ (NSString*)keyCombinationForAccelerator:
- (const ui::PlatformAcceleratorCocoa&)item;
+ (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 +79,9 @@ 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_ ==
+ EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_MOUSELOCK_EXIT_INSTRUCTION ||
+ bubbleType_ == EXCLUSIVE_ACCESS_BUBBLE_TYPE_MOUSELOCK_EXIT_INSTRUCTION)
[[self window] setIgnoresMouseEvents:YES];
}
return self;
@@ -91,16 +91,17 @@ 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_ ==
+ EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_MOUSELOCK_BUTTONS ||
+ bubbleType_ == EXCLUSIVE_ACCESS_BUBBLE_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 +121,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];
}
@@ -142,30 +143,30 @@ const float kHideDuration = 0.7;
NSRect ownerWindowFrame = [owner_ window].frame;
NSPoint origin;
origin.x = ownerWindowFrame.origin.x +
- (int)(NSWidth(ownerWindowFrame)/2 - NSWidth(windowFrame)/2);
+ (int)(NSWidth(ownerWindowFrame) / 2 - NSWidth(windowFrame) / 2);
origin.y = ownerWindowFrame.origin.y + maxY - NSHeight(windowFrame);
[[self window] setFrameOrigin:origin];
}
// Called when someone clicks on the embedded link.
-- (BOOL) textView:(NSTextView*)textView
+- (BOOL)textView:(NSTextView*)textView
clickedOnLink:(id)link
atIndex:(NSUInteger)charIndex {
- browser_->fullscreen_controller()->
- ExitTabOrBrowserFullscreenToPreviousState();
+ browser_->fullscreen_controller()
+ ->ExitTabOrBrowserFullscreenToPreviousState();
return YES;
}
- (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];
[[NSAnimationContext currentContext]
gtm_setDuration:kHideDuration
- eventMask:NSLeftMouseUpMask|NSLeftMouseDownMask];
+ eventMask:NSLeftMouseUpMask | NSLeftMouseDownMask];
[[[self window] animator] setAlphaValue:0.0];
[NSAnimationContext endGrouping];
}
@@ -195,7 +196,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.
@@ -204,38 +205,43 @@ const float kHideDuration = 0.7;
// programmatically.
exitLabel_.reset([[OneClickHyperlinkTextView alloc]
initWithFrame:[exitLabelPlaceholder_ frame]]);
- [exitLabel_.get() setAutoresizingMask:
- [exitLabelPlaceholder_ autoresizingMask]];
+ [exitLabel_.get()
+ setAutoresizingMask:[exitLabelPlaceholder_ autoresizingMask]];
[exitLabel_.get() setHidden:[exitLabelPlaceholder_ isHidden]];
- [[exitLabelPlaceholder_ superview]
- replaceSubview:exitLabelPlaceholder_ with:exitLabel_.get()];
+ [[exitLabelPlaceholder_ superview] replaceSubview:exitLabelPlaceholder_
+ with:exitLabel_.get()];
exitLabelPlaceholder_ = nil; // Now released.
[exitLabel_.get() setDelegate:self];
NSString* exitLinkText;
NSString* exitUnlinkedText;
- if (bubbleType_ == FEB_TYPE_FULLSCREEN_MOUSELOCK_EXIT_INSTRUCTION ||
- bubbleType_ == FEB_TYPE_MOUSELOCK_EXIT_INSTRUCTION) {
+ if (bubbleType_ ==
+ EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_MOUSELOCK_EXIT_INSTRUCTION ||
+ bubbleType_ == EXCLUSIVE_ACCESS_BUBBLE_TYPE_MOUSELOCK_EXIT_INSTRUCTION) {
exitLinkText = @"";
- exitUnlinkedText = [@" " stringByAppendingString:
- l10n_util::GetNSStringF(IDS_FULLSCREEN_PRESS_ESC_TO_EXIT,
- l10n_util::GetStringUTF16(IDS_APP_ESC_KEY))];
+ exitUnlinkedText =
+ [@" " stringByAppendingString:l10n_util::GetNSStringF(
+ IDS_FULLSCREEN_PRESS_ESC_TO_EXIT,
+ l10n_util::GetStringUTF16(
+ IDS_APP_ESC_KEY))];
} else {
exitLinkText = l10n_util::GetNSString(IDS_EXIT_FULLSCREEN_MODE);
- exitUnlinkedText = [@" " stringByAppendingString:
- l10n_util::GetNSStringF(IDS_EXIT_FULLSCREEN_MODE_ACCELERATOR,
- l10n_util::GetStringUTF16(IDS_APP_ESC_KEY))];
+ exitUnlinkedText =
+ [@" " stringByAppendingString:l10n_util::GetNSStringF(
+ IDS_EXIT_FULLSCREEN_MODE_ACCELERATOR,
+ l10n_util::GetStringUTF16(
+ IDS_APP_ESC_KEY))];
}
- NSFont* font = [NSFont systemFontOfSize:
- [NSFont systemFontSizeForControlSize:NSRegularControlSize]];
- [(HyperlinkTextView*)exitLabel_.get()
- setMessageAndLink:exitUnlinkedText
- withLink:exitLinkText
- atOffset:0
- font:font
- messageColor:[NSColor blackColor]
- linkColor:[NSColor blueColor]];
+ NSFont* font = [NSFont
+ systemFontOfSize:[NSFont
+ systemFontSizeForControlSize:NSRegularControlSize]];
+ [(HyperlinkTextView*)exitLabel_.get() setMessageAndLink:exitUnlinkedText
+ withLink:exitLinkText
+ atOffset:0
+ font:font
+ messageColor:[NSColor blackColor]
+ linkColor:[NSColor blueColor]];
[exitLabel_.get() setAlignment:NSRightTextAlignment];
NSRect labelFrame = [exitLabel_ frame];
@@ -256,12 +262,12 @@ const float kHideDuration = 0.7;
}
- (NSString*)getLabelText {
- if (bubbleType_ == FEB_TYPE_NONE)
+ if (bubbleType_ == EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE)
return @"";
extensions::ExtensionRegistry* registry =
extensions::ExtensionRegistry::Get(browser_->profile());
- return SysUTF16ToNSString(
- fullscreen_bubble::GetLabelTextForType(bubbleType_, url_, registry));
+ return SysUTF16ToNSString(exclusive_access_bubble::GetLabelTextForType(
+ bubbleType_, url_, registry));
}
// This looks at the Main Menu and determines what the user has set as the
@@ -275,14 +281,15 @@ const float kHideDuration = 0.7;
// Find the toggle presentation mode item.
if ([item tag] == IDC_PRESENTATION_MODE) {
return scoped_ptr<ui::PlatformAcceleratorCocoa>(
- new ui::PlatformAcceleratorCocoa([item keyEquivalent],
- [item keyEquivalentModifierMask]));
+ new ui::PlatformAcceleratorCocoa([item keyEquivalent],
+ [item keyEquivalentModifierMask]));
}
}
}
// Default to Cmd+Shift+F.
return scoped_ptr<ui::PlatformAcceleratorCocoa>(
- new ui::PlatformAcceleratorCocoa(@"f", NSCommandKeyMask|NSShiftKeyMask));
+ new ui::PlatformAcceleratorCocoa(@"f",
+ NSCommandKeyMask | NSShiftKeyMask));
}
// This looks at the Main Menu and determines what the user has set as the
@@ -295,7 +302,7 @@ const float kHideDuration = 0.7;
}
+ (NSString*)keyCombinationForAccelerator:
- (const ui::PlatformAcceleratorCocoa&)item {
+ (const ui::PlatformAcceleratorCocoa&)item {
NSMutableString* string = [NSMutableString string];
NSUInteger modifiers = item.modifier_mask();
diff --git a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/exclusive_access_bubble_window_controller_unittest.mm
index 42e6b07..38ccba3 100644
--- a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/exclusive_access_bubble_window_controller_unittest.mm
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#import "chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.h"
+#import "chrome/browser/ui/cocoa/exclusive_access_bubble_window_controller.h"
#include "base/mac/mac_util.h"
#include "chrome/browser/chrome_notification_types.h"
@@ -22,19 +22,19 @@
using content::SiteInstance;
using content::WebContents;
-@interface FullscreenExitBubbleController(JustForTesting)
+@interface ExclusiveAccessBubbleWindowController (JustForTesting)
// Already defined.
+ (NSString*)keyCommandString;
+ (NSString*)keyCombinationForAccelerator:
- (const ui::PlatformAcceleratorCocoa&)item;
+ (const ui::PlatformAcceleratorCocoa&)item;
@end
-@interface FullscreenExitBubbleController(ExposedForTesting)
+@interface ExclusiveAccessBubbleWindowController (ExposedForTesting)
- (NSTextField*)exitLabelPlaceholder;
- (NSTextView*)exitLabel;
@end
-@implementation FullscreenExitBubbleController(ExposedForTesting)
+@implementation ExclusiveAccessBubbleWindowController (ExposedForTesting)
- (NSTextField*)exitLabelPlaceholder {
return exitLabelPlaceholder_;
}
@@ -44,18 +44,19 @@ using content::WebContents;
}
@end
-class FullscreenExitBubbleControllerTest : public CocoaProfileTest {
+class ExclusiveAccessBubbleWindowControllerTest : public CocoaProfileTest {
public:
virtual void SetUp() {
CocoaProfileTest::SetUp();
ASSERT_TRUE(profile());
site_instance_ = SiteInstance::Create(profile());
- controller_.reset(
- [[FullscreenExitBubbleController alloc] initWithOwner:nil
- browser:browser()
- url:GURL()
- bubbleType:FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION]);
+ controller_.reset([[ExclusiveAccessBubbleWindowController alloc]
+ initWithOwner:nil
+ browser:browser()
+ url:GURL()
+ bubbleType:
+ EXCLUSIVE_ACCESS_BUBBLE_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION]);
EXPECT_TRUE([controller_ window]);
}
@@ -68,19 +69,20 @@ class FullscreenExitBubbleControllerTest : public CocoaProfileTest {
void AppendTabToStrip() {
WebContents* web_contents = WebContents::Create(
content::WebContents::CreateParams(profile(), site_instance_.get()));
- browser()->tab_strip_model()->AppendWebContents(
- web_contents, /*foreground=*/true);
+ browser()->tab_strip_model()->AppendWebContents(web_contents,
+ /*foreground=*/true);
}
scoped_refptr<SiteInstance> site_instance_;
- base::scoped_nsobject<FullscreenExitBubbleController> controller_;
+ base::scoped_nsobject<ExclusiveAccessBubbleWindowController> controller_;
};
// http://crbug.com/103912
-TEST_F(FullscreenExitBubbleControllerTest, DISABLED_DenyExitsFullscreen) {
+TEST_F(ExclusiveAccessBubbleWindowControllerTest,
+ DISABLED_DenyExitsFullscreen) {
NSWindow* window = browser()->window()->GetNativeWindow();
- BrowserWindowController* bwc = [BrowserWindowController
- browserWindowControllerForWindow:window];
+ BrowserWindowController* bwc =
+ [BrowserWindowController browserWindowControllerForWindow:window];
[bwc showWindow:nil];
@@ -97,7 +99,8 @@ TEST_F(FullscreenExitBubbleControllerTest, DISABLED_DenyExitsFullscreen) {
ASSERT_TRUE(browser()->window()->IsFullscreen());
}
- FullscreenExitBubbleController* bubble = [bwc fullscreenExitBubbleController];
+ ExclusiveAccessBubbleWindowController* bubble =
+ [bwc exclusiveAccessBubbleWindowController];
EXPECT_TRUE(bubble);
{
content::WindowedNotificationObserver fullscreen_observer(
@@ -106,23 +109,23 @@ TEST_F(FullscreenExitBubbleControllerTest, DISABLED_DenyExitsFullscreen) {
[bubble deny:nil];
fullscreen_observer.Wait();
}
- EXPECT_FALSE([bwc fullscreenExitBubbleController]);
+ EXPECT_FALSE([bwc exclusiveAccessBubbleWindowController]);
EXPECT_FALSE(browser()->window()->IsFullscreen());
CloseBrowserWindow();
}
-TEST_F(FullscreenExitBubbleControllerTest, LabelWasReplaced) {
+TEST_F(ExclusiveAccessBubbleWindowControllerTest, LabelWasReplaced) {
EXPECT_FALSE([controller_ exitLabelPlaceholder]);
EXPECT_TRUE([controller_ exitLabel]);
}
-TEST_F(FullscreenExitBubbleControllerTest, ShortcutText) {
+TEST_F(ExclusiveAccessBubbleWindowControllerTest, ShortcutText) {
ui::PlatformAcceleratorCocoa cmd_F(@"F", NSCommandKeyMask);
- ui::PlatformAcceleratorCocoa cmd_shift_f(
- @"f", NSCommandKeyMask | NSShiftKeyMask);
- NSString* cmd_F_text = [FullscreenExitBubbleController
+ ui::PlatformAcceleratorCocoa cmd_shift_f(@"f",
+ NSCommandKeyMask | NSShiftKeyMask);
+ NSString* cmd_F_text = [ExclusiveAccessBubbleWindowController
keyCombinationForAccelerator:cmd_F];
- NSString* cmd_shift_f_text = [FullscreenExitBubbleController
+ NSString* cmd_shift_f_text = [ExclusiveAccessBubbleWindowController
keyCombinationForAccelerator:cmd_shift_f];
EXPECT_NSEQ(cmd_shift_f_text, cmd_F_text);
EXPECT_NSEQ(@"\u2318\u21E7F", cmd_shift_f_text);
diff --git a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_view.h b/chrome/browser/ui/cocoa/fullscreen_exit_bubble_view.h
deleted file mode 100644
index c8e0f37..0000000
--- a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_view.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (c) 2011 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.
-
-#ifndef CHROME_BROWSER_UI_COCOA_FULLSCREEN_EXIT_BUBBLE_VIEW_H_
-#define CHROME_BROWSER_UI_COCOA_FULLSCREEN_EXIT_BUBBLE_VIEW_H_
-
-#import <Cocoa/Cocoa.h>
-
-// A view that handles painting the background for the Fullscreen Exit Bubble.
-@interface FullscreenExitBubbleView : NSView
-@end
-
-#endif // CHROME_BROWSER_UI_COCOA_FULLSCREEN_EXIT_BUBBLE_VIEW_H_
diff --git a/chrome/browser/ui/cocoa/view_id_util_browsertest.mm b/chrome/browser/ui/cocoa/view_id_util_browsertest.mm
index 9de7dfe4..04dd365 100644
--- a/chrome/browser/ui/cocoa/view_id_util_browsertest.mm
+++ b/chrome/browser/ui/cocoa/view_id_util_browsertest.mm
@@ -97,7 +97,8 @@ IN_PROC_BROWSER_TEST_F(ViewIDTest, Basic) {
// Flaky on Mac: http://crbug.com/90557.
IN_PROC_BROWSER_TEST_F(ViewIDTest, DISABLED_Fullscreen) {
browser()->window()->EnterFullscreen(
- GURL(), FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION, false);
+ GURL(), EXCLUSIVE_ACCESS_BUBBLE_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION,
+ false);
ASSERT_NO_FATAL_FAILURE(DoTest());
}
diff --git a/chrome/browser/ui/fullscreen/fullscreen_exit_bubble.cc b/chrome/browser/ui/fullscreen/exclusive_access_bubble.cc
index ffd5d0a..0497b38 100644
--- a/chrome/browser/ui/fullscreen/fullscreen_exit_bubble.cc
+++ b/chrome/browser/ui/fullscreen/exclusive_access_bubble.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/fullscreen/fullscreen_exit_bubble.h"
+#include "chrome/browser/ui/fullscreen/exclusive_access_bubble.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
@@ -19,53 +19,52 @@
// NOTE(koz): Linux doesn't use the thick shadowed border, so we add padding
// here.
#if defined(OS_LINUX)
-const int FullscreenExitBubble::kPaddingPx = 8;
+const int ExclusiveAccessBubble::kPaddingPx = 8;
#else
-const int FullscreenExitBubble::kPaddingPx = 15;
+const int ExclusiveAccessBubble::kPaddingPx = 15;
#endif
-const int FullscreenExitBubble::kInitialDelayMs = 3800;
-const int FullscreenExitBubble::kIdleTimeMs = 2300;
-const int FullscreenExitBubble::kPositionCheckHz = 10;
-const int FullscreenExitBubble::kSlideInRegionHeightPx = 4;
-const int FullscreenExitBubble::kSlideInDurationMs = 350;
-const int FullscreenExitBubble::kSlideOutDurationMs = 700;
-const int FullscreenExitBubble::kPopupTopPx = 15;
-
-FullscreenExitBubble::FullscreenExitBubble(Browser* browser,
- const GURL& url,
- FullscreenExitBubbleType bubble_type)
- : browser_(browser),
- url_(url),
- bubble_type_(bubble_type) {
- DCHECK_NE(FEB_TYPE_NONE, bubble_type_);
+const int ExclusiveAccessBubble::kInitialDelayMs = 3800;
+const int ExclusiveAccessBubble::kIdleTimeMs = 2300;
+const int ExclusiveAccessBubble::kPositionCheckHz = 10;
+const int ExclusiveAccessBubble::kSlideInRegionHeightPx = 4;
+const int ExclusiveAccessBubble::kSlideInDurationMs = 350;
+const int ExclusiveAccessBubble::kSlideOutDurationMs = 700;
+const int ExclusiveAccessBubble::kPopupTopPx = 15;
+
+ExclusiveAccessBubble::ExclusiveAccessBubble(
+ Browser* browser,
+ const GURL& url,
+ ExclusiveAccessBubbleType bubble_type)
+ : browser_(browser), url_(url), bubble_type_(bubble_type) {
+ DCHECK_NE(EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE, bubble_type_);
}
-FullscreenExitBubble::~FullscreenExitBubble() {
+ExclusiveAccessBubble::~ExclusiveAccessBubble() {
}
-void FullscreenExitBubble::StartWatchingMouse() {
+void ExclusiveAccessBubble::StartWatchingMouse() {
// Start the initial delay timer and begin watching the mouse.
initial_delay_.Start(FROM_HERE,
base::TimeDelta::FromMilliseconds(kInitialDelayMs), this,
- &FullscreenExitBubble::CheckMousePosition);
+ &ExclusiveAccessBubble::CheckMousePosition);
gfx::Point cursor_pos = GetCursorScreenPoint();
last_mouse_pos_ = cursor_pos;
- mouse_position_checker_.Start(FROM_HERE,
- base::TimeDelta::FromMilliseconds(1000 / kPositionCheckHz), this,
- &FullscreenExitBubble::CheckMousePosition);
+ mouse_position_checker_.Start(
+ FROM_HERE, base::TimeDelta::FromMilliseconds(1000 / kPositionCheckHz),
+ this, &ExclusiveAccessBubble::CheckMousePosition);
}
-void FullscreenExitBubble::StopWatchingMouse() {
+void ExclusiveAccessBubble::StopWatchingMouse() {
initial_delay_.Stop();
idle_timeout_.Stop();
mouse_position_checker_.Stop();
}
-bool FullscreenExitBubble::IsWatchingMouse() const {
+bool ExclusiveAccessBubble::IsWatchingMouse() const {
return mouse_position_checker_.IsRunning();
}
-void FullscreenExitBubble::CheckMousePosition() {
+void ExclusiveAccessBubble::CheckMousePosition() {
// Desired behavior:
//
// +------------+-----------------------------+------------+
@@ -94,12 +93,11 @@ void FullscreenExitBubble::CheckMousePosition() {
idle_timeout_.Stop(); // If the timer isn't running, this is a no-op.
idle_timeout_.Start(FROM_HERE,
base::TimeDelta::FromMilliseconds(kIdleTimeMs), this,
- &FullscreenExitBubble::CheckMousePosition);
+ &ExclusiveAccessBubble::CheckMousePosition);
}
last_mouse_pos_ = cursor_pos;
- if (!IsWindowActive() ||
- !WindowContainsPoint(cursor_pos) ||
+ if (!IsWindowActive() || !WindowContainsPoint(cursor_pos) ||
(cursor_pos.y() >= GetPopupRect(true).bottom()) ||
!idle_timeout_.IsRunning()) {
// The cursor is offscreen, in the slide-out region, or idle.
@@ -116,34 +114,34 @@ void FullscreenExitBubble::CheckMousePosition() {
}
}
-void FullscreenExitBubble::ToggleFullscreen() {
- browser_->fullscreen_controller()->
- ExitTabOrBrowserFullscreenToPreviousState();
+void ExclusiveAccessBubble::ToggleFullscreen() {
+ browser_->fullscreen_controller()
+ ->ExitTabOrBrowserFullscreenToPreviousState();
}
-void FullscreenExitBubble::Accept() {
+void ExclusiveAccessBubble::Accept() {
browser_->fullscreen_controller()->OnAcceptFullscreenPermission();
}
-void FullscreenExitBubble::Cancel() {
+void ExclusiveAccessBubble::Cancel() {
browser_->fullscreen_controller()->OnDenyFullscreenPermission();
}
-base::string16 FullscreenExitBubble::GetCurrentMessageText() const {
- return fullscreen_bubble::GetLabelTextForType(
+base::string16 ExclusiveAccessBubble::GetCurrentMessageText() const {
+ return exclusive_access_bubble::GetLabelTextForType(
bubble_type_, url_,
extensions::ExtensionRegistry::Get(browser_->profile()));
}
-base::string16 FullscreenExitBubble::GetCurrentDenyButtonText() const {
- return fullscreen_bubble::GetDenyButtonTextForType(bubble_type_);
+base::string16 ExclusiveAccessBubble::GetCurrentDenyButtonText() const {
+ return exclusive_access_bubble::GetDenyButtonTextForType(bubble_type_);
}
-base::string16 FullscreenExitBubble::GetAllowButtonText() const {
+base::string16 ExclusiveAccessBubble::GetAllowButtonText() const {
return l10n_util::GetStringUTF16(IDS_FULLSCREEN_ALLOW);
}
-base::string16 FullscreenExitBubble::GetInstructionText() const {
+base::string16 ExclusiveAccessBubble::GetInstructionText() const {
return l10n_util::GetStringFUTF16(IDS_FULLSCREEN_PRESS_ESC_TO_EXIT,
- l10n_util::GetStringUTF16(IDS_APP_ESC_KEY));
+ l10n_util::GetStringUTF16(IDS_APP_ESC_KEY));
}
diff --git a/chrome/browser/ui/fullscreen/fullscreen_exit_bubble.h b/chrome/browser/ui/fullscreen/exclusive_access_bubble.h
index 65af1d1..ec6094f 100644
--- a/chrome/browser/ui/fullscreen/fullscreen_exit_bubble.h
+++ b/chrome/browser/ui/fullscreen/exclusive_access_bubble.h
@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_EXIT_BUBBLE_H_
-#define CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_EXIT_BUBBLE_H_
+#ifndef CHROME_BROWSER_UI_FULLSCREEN_EXCLUSIVE_ACCESS_BUBBLE_H_
+#define CHROME_BROWSER_UI_FULLSCREEN_EXCLUSIVE_ACCESS_BUBBLE_H_
#include "base/timer/timer.h"
-#include "chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.h"
+#include "chrome/browser/ui/fullscreen/exclusive_access_bubble_type.h"
#include "ui/gfx/animation/animation_delegate.h"
#include "ui/gfx/point.h"
#include "url/gurl.h"
@@ -17,21 +17,24 @@ namespace gfx {
class Rect;
}
-class FullscreenExitBubble : public gfx::AnimationDelegate {
+// Bubble that informs the user when an exclusive access state is in effect and
+// as to how to exit out of the state. Currently there are two exclusive access
+// state, namely fullscreen and mouse lock.
+class ExclusiveAccessBubble : public gfx::AnimationDelegate {
public:
- explicit FullscreenExitBubble(Browser* browser,
- const GURL& url,
- FullscreenExitBubbleType bubble_type);
- ~FullscreenExitBubble() override;
+ explicit ExclusiveAccessBubble(Browser* browser,
+ const GURL& url,
+ ExclusiveAccessBubbleType bubble_type);
+ ~ExclusiveAccessBubble() override;
protected:
- static const int kPaddingPx; // Amount of padding around the link
- static const int kInitialDelayMs; // Initial time bubble remains onscreen
- static const int kIdleTimeMs; // Time before mouse idle triggers hide
- static const int kPositionCheckHz; // How fast to check the mouse position
+ static const int kPaddingPx; // Amount of padding around the link
+ static const int kInitialDelayMs; // Initial time bubble remains onscreen
+ static const int kIdleTimeMs; // Time before mouse idle triggers hide
+ static const int kPositionCheckHz; // How fast to check the mouse position
static const int kSlideInRegionHeightPx;
- // Height of region triggering
- // slide-in
+ // Height of region triggering
+ // slide-in
static const int kPopupTopPx; // Space between the popup and the top
// of the screen.
static const int kSlideInDurationMs; // Duration of slide-in animation
@@ -89,27 +92,27 @@ class FullscreenExitBubble : public gfx::AnimationDelegate {
GURL url_;
// The type of the bubble; controls e.g. which buttons to show.
- FullscreenExitBubbleType bubble_type_;
+ ExclusiveAccessBubbleType bubble_type_;
private:
// Timer to delay before allowing the bubble to hide after it's initially
// shown.
- base::OneShotTimer<FullscreenExitBubble> initial_delay_;
+ base::OneShotTimer<ExclusiveAccessBubble> initial_delay_;
// Timer to see how long the mouse has been idle.
- base::OneShotTimer<FullscreenExitBubble> idle_timeout_;
+ base::OneShotTimer<ExclusiveAccessBubble> idle_timeout_;
// Timer to poll the current mouse position. We can't just listen for mouse
// events without putting a non-empty HWND onscreen (or hooking Windows, which
// has other problems), so instead we run a low-frequency poller to see if the
// user has moved in or out of our show/hide regions.
- base::RepeatingTimer<FullscreenExitBubble> mouse_position_checker_;
+ base::RepeatingTimer<ExclusiveAccessBubble> mouse_position_checker_;
// The most recently seen mouse position, in screen coordinates. Used to see
// if the mouse has moved since our last check.
gfx::Point last_mouse_pos_;
- DISALLOW_COPY_AND_ASSIGN(FullscreenExitBubble);
+ DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessBubble);
};
-#endif // CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_EXIT_BUBBLE_H_
+#endif // CHROME_BROWSER_UI_FULLSCREEN_EXCLUSIVE_ACCESS_BUBBLE_H_
diff --git a/chrome/browser/ui/fullscreen/exclusive_access_bubble_type.cc b/chrome/browser/ui/fullscreen/exclusive_access_bubble_type.cc
new file mode 100644
index 0000000..f52bf87
--- /dev/null
+++ b/chrome/browser/ui/fullscreen/exclusive_access_bubble_type.cc
@@ -0,0 +1,131 @@
+// 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.
+
+#include "chrome/browser/ui/fullscreen/exclusive_access_bubble_type.h"
+
+#include "base/strings/utf_string_conversions.h"
+#include "chrome/common/url_constants.h"
+#include "chrome/grit/generated_resources.h"
+#include "extensions/browser/extension_registry.h"
+#include "extensions/common/constants.h"
+#include "extensions/common/extension.h"
+#include "extensions/common/extension_set.h"
+#include "ui/base/l10n/l10n_util.h"
+
+namespace exclusive_access_bubble {
+
+base::string16 GetLabelTextForType(ExclusiveAccessBubbleType type,
+ const GURL& url,
+ extensions::ExtensionRegistry* registry) {
+ base::string16 host(base::UTF8ToUTF16(url.host()));
+ if (registry) {
+ const extensions::Extension* extension =
+ registry->enabled_extensions().GetExtensionOrAppByURL(url);
+ if (extension) {
+ host = base::UTF8ToUTF16(extension->name());
+ } else if (url.SchemeIs(extensions::kExtensionScheme)) {
+ // In this case, |host| is set to an extension ID.
+ // We are not going to show it because it's human-unreadable.
+ host.clear();
+ }
+ }
+ if (host.empty()) {
+ switch (type) {
+ case EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_BUTTONS:
+ case EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_EXIT_INSTRUCTION:
+ return l10n_util::GetStringUTF16(IDS_FULLSCREEN_ENTERED_FULLSCREEN);
+ case EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_MOUSELOCK_BUTTONS:
+ return l10n_util::GetStringUTF16(
+ IDS_FULLSCREEN_REQUEST_FULLSCREEN_MOUSELOCK);
+ case EXCLUSIVE_ACCESS_BUBBLE_TYPE_MOUSELOCK_BUTTONS:
+ return l10n_util::GetStringUTF16(IDS_FULLSCREEN_REQUEST_MOUSELOCK);
+ case EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_MOUSELOCK_EXIT_INSTRUCTION:
+ return l10n_util::GetStringUTF16(
+ IDS_FULLSCREEN_ENTERED_FULLSCREEN_MOUSELOCK);
+ case EXCLUSIVE_ACCESS_BUBBLE_TYPE_MOUSELOCK_EXIT_INSTRUCTION:
+ return l10n_util::GetStringUTF16(IDS_FULLSCREEN_ENTERED_MOUSELOCK);
+ case EXCLUSIVE_ACCESS_BUBBLE_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION:
+ return l10n_util::GetStringUTF16(
+ IDS_FULLSCREEN_USER_ENTERED_FULLSCREEN);
+ case EXCLUSIVE_ACCESS_BUBBLE_TYPE_EXTENSION_FULLSCREEN_EXIT_INSTRUCTION:
+ return l10n_util::GetStringUTF16(
+ IDS_FULLSCREEN_UNKNOWN_EXTENSION_TRIGGERED_FULLSCREEN);
+ default:
+ NOTREACHED();
+ return base::string16();
+ }
+ }
+ switch (type) {
+ case EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_BUTTONS:
+ return l10n_util::GetStringFUTF16(IDS_FULLSCREEN_SITE_ENTERED_FULLSCREEN,
+ host);
+ case EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_MOUSELOCK_BUTTONS:
+ return l10n_util::GetStringFUTF16(
+ IDS_FULLSCREEN_SITE_REQUEST_FULLSCREEN_MOUSELOCK, host);
+ case EXCLUSIVE_ACCESS_BUBBLE_TYPE_MOUSELOCK_BUTTONS:
+ return l10n_util::GetStringFUTF16(IDS_FULLSCREEN_SITE_REQUEST_MOUSELOCK,
+ host);
+ case EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_EXIT_INSTRUCTION:
+ return l10n_util::GetStringFUTF16(IDS_FULLSCREEN_SITE_ENTERED_FULLSCREEN,
+ host);
+ case EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_MOUSELOCK_EXIT_INSTRUCTION:
+ return l10n_util::GetStringFUTF16(
+ IDS_FULLSCREEN_SITE_ENTERED_FULLSCREEN_MOUSELOCK, host);
+ case EXCLUSIVE_ACCESS_BUBBLE_TYPE_MOUSELOCK_EXIT_INSTRUCTION:
+ return l10n_util::GetStringFUTF16(IDS_FULLSCREEN_SITE_ENTERED_MOUSELOCK,
+ host);
+ case EXCLUSIVE_ACCESS_BUBBLE_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION:
+ return l10n_util::GetStringUTF16(IDS_FULLSCREEN_USER_ENTERED_FULLSCREEN);
+ case EXCLUSIVE_ACCESS_BUBBLE_TYPE_EXTENSION_FULLSCREEN_EXIT_INSTRUCTION:
+ return l10n_util::GetStringFUTF16(
+ IDS_FULLSCREEN_EXTENSION_TRIGGERED_FULLSCREEN, host);
+ default:
+ NOTREACHED();
+ return base::string16();
+ }
+}
+
+base::string16 GetDenyButtonTextForType(ExclusiveAccessBubbleType type) {
+ switch (type) {
+ case EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_BUTTONS:
+ return l10n_util::GetStringUTF16(IDS_FULLSCREEN_EXIT_FULLSCREEN);
+ case EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_MOUSELOCK_BUTTONS:
+ return l10n_util::GetStringUTF16(IDS_FULLSCREEN_EXIT);
+ case EXCLUSIVE_ACCESS_BUBBLE_TYPE_MOUSELOCK_BUTTONS:
+ return l10n_util::GetStringUTF16(IDS_FULLSCREEN_DENY);
+ case EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_EXIT_INSTRUCTION:
+ case EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_MOUSELOCK_EXIT_INSTRUCTION:
+ case EXCLUSIVE_ACCESS_BUBBLE_TYPE_MOUSELOCK_EXIT_INSTRUCTION:
+ case EXCLUSIVE_ACCESS_BUBBLE_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION:
+ case EXCLUSIVE_ACCESS_BUBBLE_TYPE_EXTENSION_FULLSCREEN_EXIT_INSTRUCTION:
+ NOTREACHED(); // No button in this case.
+ return base::string16();
+ default:
+ NOTREACHED();
+ return base::string16();
+ }
+}
+
+bool ShowButtonsForType(ExclusiveAccessBubbleType type) {
+ return type == EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_BUTTONS ||
+ type == EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_MOUSELOCK_BUTTONS ||
+ type == EXCLUSIVE_ACCESS_BUBBLE_TYPE_MOUSELOCK_BUTTONS;
+}
+
+void PermissionRequestedByType(ExclusiveAccessBubbleType type,
+ bool* tab_fullscreen,
+ bool* mouse_lock) {
+ if (tab_fullscreen) {
+ *tab_fullscreen =
+ type == EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_BUTTONS ||
+ type == EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_MOUSELOCK_BUTTONS;
+ }
+ if (mouse_lock) {
+ *mouse_lock =
+ type == EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_MOUSELOCK_BUTTONS ||
+ type == EXCLUSIVE_ACCESS_BUBBLE_TYPE_MOUSELOCK_BUTTONS;
+ }
+}
+
+} // namespace exclusive_access_bubble
diff --git a/chrome/browser/ui/fullscreen/exclusive_access_bubble_type.h b/chrome/browser/ui/fullscreen/exclusive_access_bubble_type.h
new file mode 100644
index 0000000..4a292aa
--- /dev/null
+++ b/chrome/browser/ui/fullscreen/exclusive_access_bubble_type.h
@@ -0,0 +1,50 @@
+// 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.
+
+#ifndef CHROME_BROWSER_UI_FULLSCREEN_EXCLUSIVE_ACCESS_BUBBLE_TYPE_H_
+#define CHROME_BROWSER_UI_FULLSCREEN_EXCLUSIVE_ACCESS_BUBBLE_TYPE_H_
+
+#include "base/strings/string16.h"
+#include "url/gurl.h"
+
+namespace extensions {
+class ExtensionRegistry;
+}
+
+// Describes the contents of the fullscreen exit bubble.
+// For example, if the user already agreed to fullscreen mode and the
+// web page then requests mouse lock, "do you want to allow mouse lock"
+// will be shown.
+enum ExclusiveAccessBubbleType {
+ EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE = 0,
+
+ // For tab fullscreen mode.
+ // More comments about tab and browser fullscreen mode can be found in
+ // chrome/browser/ui/fullscreen/fullscreen_controller.h.
+ EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_BUTTONS,
+ EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_MOUSELOCK_BUTTONS,
+ EXCLUSIVE_ACCESS_BUBBLE_TYPE_MOUSELOCK_BUTTONS,
+ EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_EXIT_INSTRUCTION,
+ EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_MOUSELOCK_EXIT_INSTRUCTION,
+ EXCLUSIVE_ACCESS_BUBBLE_TYPE_MOUSELOCK_EXIT_INSTRUCTION,
+
+ // For browser fullscreen mode.
+ EXCLUSIVE_ACCESS_BUBBLE_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION,
+ EXCLUSIVE_ACCESS_BUBBLE_TYPE_EXTENSION_FULLSCREEN_EXIT_INSTRUCTION
+};
+
+namespace exclusive_access_bubble {
+
+base::string16 GetLabelTextForType(ExclusiveAccessBubbleType type,
+ const GURL& url,
+ extensions::ExtensionRegistry* registry);
+base::string16 GetDenyButtonTextForType(ExclusiveAccessBubbleType type);
+bool ShowButtonsForType(ExclusiveAccessBubbleType type);
+void PermissionRequestedByType(ExclusiveAccessBubbleType type,
+ bool* tab_fullscreen,
+ bool* mouse_lock);
+
+} // namespace exclusive_access_bubble
+
+#endif // CHROME_BROWSER_UI_FULLSCREEN_EXCLUSIVE_ACCESS_BUBBLE_TYPE_H_
diff --git a/chrome/browser/ui/fullscreen/fullscreen_controller.cc b/chrome/browser/ui/fullscreen/fullscreen_controller.cc
index 18eb88e..35578e1 100644
--- a/chrome/browser/ui/fullscreen/fullscreen_controller.cc
+++ b/chrome/browser/ui/fullscreen/fullscreen_controller.cc
@@ -233,14 +233,14 @@ void FullscreenController::RequestToLockMouse(WebContents* web_contents,
return;
}
SetMouseLockTab(web_contents);
- FullscreenExitBubbleType bubble_type = GetFullscreenExitBubbleType();
+ ExclusiveAccessBubbleType bubble_type = GetExclusiveAccessBubbleType();
switch (GetMouseLockSetting(web_contents->GetURL())) {
case CONTENT_SETTING_ALLOW:
// If bubble already displaying buttons we must not lock the mouse yet,
// or it would prevent pressing those buttons. Instead, merge the request.
if (!IsPrivilegedFullscreenForTab() &&
- fullscreen_bubble::ShowButtonsForType(bubble_type)) {
+ exclusive_access_bubble::ShowButtonsForType(bubble_type)) {
mouse_lock_state_ = MOUSELOCK_REQUESTED;
} else {
// Lock mouse.
@@ -369,11 +369,11 @@ void FullscreenController::ExitTabOrBrowserFullscreenToPreviousState() {
}
void FullscreenController::OnAcceptFullscreenPermission() {
- FullscreenExitBubbleType bubble_type = GetFullscreenExitBubbleType();
+ ExclusiveAccessBubbleType bubble_type = GetExclusiveAccessBubbleType();
bool mouse_lock = false;
bool fullscreen = false;
- fullscreen_bubble::PermissionRequestedByType(bubble_type, &fullscreen,
- &mouse_lock);
+ exclusive_access_bubble::PermissionRequestedByType(bubble_type, &fullscreen,
+ &mouse_lock);
DCHECK(!(fullscreen && tab_fullscreen_accepted_));
DCHECK(!(mouse_lock && IsMouseLocked()));
@@ -461,7 +461,7 @@ GURL FullscreenController::GetFullscreenExitBubbleURL() const {
return extension_caused_fullscreen_;
}
-FullscreenExitBubbleType FullscreenController::GetFullscreenExitBubbleType()
+ExclusiveAccessBubbleType FullscreenController::GetExclusiveAccessBubbleType()
const {
// In kiosk and exclusive app mode we always want to be fullscreen and do not
// want to show exit instructions for browser mode fullscreen.
@@ -471,33 +471,33 @@ FullscreenExitBubbleType FullscreenController::GetFullscreenExitBubbleType()
#endif
if (mouse_lock_state_ == MOUSELOCK_ACCEPTED_SILENTLY)
- return FEB_TYPE_NONE;
+ return EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE;
if (!fullscreened_tab_) {
if (IsMouseLocked())
- return FEB_TYPE_MOUSELOCK_EXIT_INSTRUCTION;
+ return EXCLUSIVE_ACCESS_BUBBLE_TYPE_MOUSELOCK_EXIT_INSTRUCTION;
if (IsMouseLockRequested())
- return FEB_TYPE_MOUSELOCK_BUTTONS;
+ return EXCLUSIVE_ACCESS_BUBBLE_TYPE_MOUSELOCK_BUTTONS;
if (!extension_caused_fullscreen_.is_empty())
- return FEB_TYPE_BROWSER_EXTENSION_FULLSCREEN_EXIT_INSTRUCTION;
+ return EXCLUSIVE_ACCESS_BUBBLE_TYPE_EXTENSION_FULLSCREEN_EXIT_INSTRUCTION;
if (toggled_into_fullscreen_ && !app_mode)
- return FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION;
- return FEB_TYPE_NONE;
+ return EXCLUSIVE_ACCESS_BUBBLE_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION;
+ return EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE;
}
if (tab_fullscreen_accepted_) {
if (IsPrivilegedFullscreenForTab())
- return FEB_TYPE_NONE;
+ return EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE;
if (IsMouseLocked())
- return FEB_TYPE_FULLSCREEN_MOUSELOCK_EXIT_INSTRUCTION;
+ return EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_MOUSELOCK_EXIT_INSTRUCTION;
if (IsMouseLockRequested())
- return FEB_TYPE_MOUSELOCK_BUTTONS;
- return FEB_TYPE_FULLSCREEN_EXIT_INSTRUCTION;
+ return EXCLUSIVE_ACCESS_BUBBLE_TYPE_MOUSELOCK_BUTTONS;
+ return EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_EXIT_INSTRUCTION;
}
if (IsMouseLockRequested())
- return FEB_TYPE_FULLSCREEN_MOUSELOCK_BUTTONS;
- return FEB_TYPE_FULLSCREEN_BUTTONS;
+ return EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_MOUSELOCK_BUTTONS;
+ return EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_BUTTONS;
}
void FullscreenController::UpdateNotificationRegistrations() {
@@ -623,8 +623,7 @@ void FullscreenController::EnterFullscreenModeInternal(
// TODO(scheib): Record metrics for WITH_TOOLBAR, without counting transitions
// from tab fullscreen out to browser with toolbar.
- window_->EnterFullscreen(url,
- GetFullscreenExitBubbleType(),
+ window_->EnterFullscreen(url, GetExclusiveAccessBubbleType(),
option == BROWSER_WITH_TOOLBAR);
UpdateFullscreenExitBubbleContent();
@@ -668,10 +667,11 @@ void FullscreenController::ExitTabFullscreenOrMouseLockIfNecessary() {
void FullscreenController::UpdateFullscreenExitBubbleContent() {
GURL url = GetFullscreenExitBubbleURL();
- FullscreenExitBubbleType bubble_type = GetFullscreenExitBubbleType();
+ ExclusiveAccessBubbleType bubble_type = GetExclusiveAccessBubbleType();
// If bubble displays buttons, unlock mouse to allow pressing them.
- if (fullscreen_bubble::ShowButtonsForType(bubble_type) && IsMouseLocked())
+ if (exclusive_access_bubble::ShowButtonsForType(bubble_type) &&
+ IsMouseLocked())
UnlockMouse();
window_->UpdateFullscreenExitBubbleContent(url, bubble_type);
diff --git a/chrome/browser/ui/fullscreen/fullscreen_controller.h b/chrome/browser/ui/fullscreen/fullscreen_controller.h
index 4b6934e..aa4cb27 100644
--- a/chrome/browser/ui/fullscreen/fullscreen_controller.h
+++ b/chrome/browser/ui/fullscreen/fullscreen_controller.h
@@ -9,7 +9,7 @@
#include "base/basictypes.h"
#include "base/memory/weak_ptr.h"
-#include "chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.h"
+#include "chrome/browser/ui/fullscreen/exclusive_access_bubble_type.h"
#include "components/content_settings/core/common/content_settings.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -150,7 +150,7 @@ class FullscreenController : public content::NotificationObserver {
// Bubble Content ////////////////////////////////////////////////////////////
GURL GetFullscreenExitBubbleURL() const;
- FullscreenExitBubbleType GetFullscreenExitBubbleType() const;
+ ExclusiveAccessBubbleType GetExclusiveAccessBubbleType() const;
private:
friend class FullscreenControllerTest;
diff --git a/chrome/browser/ui/fullscreen/fullscreen_controller_state_unittest.cc b/chrome/browser/ui/fullscreen/fullscreen_controller_state_unittest.cc
index 6738a8b..f28fabd 100644
--- a/chrome/browser/ui/fullscreen/fullscreen_controller_state_unittest.cc
+++ b/chrome/browser/ui/fullscreen/fullscreen_controller_state_unittest.cc
@@ -40,7 +40,7 @@ class FullscreenControllerTestWindow : public TestBrowserWindow {
// BrowserWindow Interface:
void EnterFullscreen(const GURL& url,
- FullscreenExitBubbleType type,
+ ExclusiveAccessBubbleType type,
bool with_toolbar) override;
void ExitFullscreen() override;
bool ShouldHideUIForFullscreen() const override;
@@ -81,7 +81,7 @@ FullscreenControllerTestWindow::FullscreenControllerTestWindow()
void FullscreenControllerTestWindow::EnterFullscreen(
const GURL& url,
- FullscreenExitBubbleType type,
+ ExclusiveAccessBubbleType type,
bool with_toolbar) {
EnterFullscreen(with_toolbar);
}
@@ -427,8 +427,8 @@ TEST_F(FullscreenControllerStateUnitTest, ExitFullscreenViaBrowserWindow) {
// Exit fullscreen without going through fullscreen controller.
browser()->window()->ExitFullscreen();
ChangeWindowFullscreenState();
- EXPECT_EQ(FEB_TYPE_NONE,
- browser()->fullscreen_controller()->GetFullscreenExitBubbleType());
+ EXPECT_EQ(EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE,
+ browser()->fullscreen_controller()->GetExclusiveAccessBubbleType());
}
// Test that switching tabs takes the browser out of tab fullscreen.
diff --git a/chrome/browser/ui/fullscreen/fullscreen_controller_test.cc b/chrome/browser/ui/fullscreen/fullscreen_controller_test.cc
index 96c2a66..e1fd97f 100644
--- a/chrome/browser/ui/fullscreen/fullscreen_controller_test.cc
+++ b/chrome/browser/ui/fullscreen/fullscreen_controller_test.cc
@@ -45,36 +45,36 @@ bool FullscreenControllerTest::IsWindowFullscreenForTabOrPending() {
}
bool FullscreenControllerTest::IsMouseLockPermissionRequested() {
- FullscreenExitBubbleType type =
- browser()->fullscreen_controller()->GetFullscreenExitBubbleType();
+ ExclusiveAccessBubbleType type =
+ browser()->fullscreen_controller()->GetExclusiveAccessBubbleType();
bool mouse_lock = false;
- fullscreen_bubble::PermissionRequestedByType(type, NULL, &mouse_lock);
+ exclusive_access_bubble::PermissionRequestedByType(type, NULL, &mouse_lock);
return mouse_lock;
}
bool FullscreenControllerTest::IsFullscreenPermissionRequested() {
- FullscreenExitBubbleType type =
- browser()->fullscreen_controller()->GetFullscreenExitBubbleType();
+ ExclusiveAccessBubbleType type =
+ browser()->fullscreen_controller()->GetExclusiveAccessBubbleType();
bool fullscreen = false;
- fullscreen_bubble::PermissionRequestedByType(type, &fullscreen, NULL);
+ exclusive_access_bubble::PermissionRequestedByType(type, &fullscreen, NULL);
return fullscreen;
}
-FullscreenExitBubbleType
- FullscreenControllerTest::GetFullscreenExitBubbleType() {
- return browser()->fullscreen_controller()->GetFullscreenExitBubbleType();
+ExclusiveAccessBubbleType
+FullscreenControllerTest::GetExclusiveAccessBubbleType() {
+ return browser()->fullscreen_controller()->GetExclusiveAccessBubbleType();
}
bool FullscreenControllerTest::IsFullscreenBubbleDisplayed() {
- FullscreenExitBubbleType type =
- browser()->fullscreen_controller()->GetFullscreenExitBubbleType();
- return type != FEB_TYPE_NONE;
+ ExclusiveAccessBubbleType type =
+ browser()->fullscreen_controller()->GetExclusiveAccessBubbleType();
+ return type != EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE;
}
bool FullscreenControllerTest::IsFullscreenBubbleDisplayingButtons() {
- FullscreenExitBubbleType type =
- browser()->fullscreen_controller()->GetFullscreenExitBubbleType();
- return fullscreen_bubble::ShowButtonsForType(type);
+ ExclusiveAccessBubbleType type =
+ browser()->fullscreen_controller()->GetExclusiveAccessBubbleType();
+ return exclusive_access_bubble::ShowButtonsForType(type);
}
void FullscreenControllerTest::AcceptCurrentFullscreenOrMouseLockRequest() {
diff --git a/chrome/browser/ui/fullscreen/fullscreen_controller_test.h b/chrome/browser/ui/fullscreen/fullscreen_controller_test.h
index 19c6537..916baec 100644
--- a/chrome/browser/ui/fullscreen/fullscreen_controller_test.h
+++ b/chrome/browser/ui/fullscreen/fullscreen_controller_test.h
@@ -6,7 +6,7 @@
#define CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_CONTROLLER_TEST_H_
#include "chrome/browser/chrome_notification_types.h"
-#include "chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.h"
+#include "chrome/browser/ui/fullscreen/exclusive_access_bubble_type.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "content/public/browser/notification_service.h"
#include "content/public/test/test_utils.h"
@@ -46,7 +46,7 @@ class FullscreenControllerTest : public InProcessBrowserTest {
bool IsWindowFullscreenForTabOrPending();
bool IsMouseLockPermissionRequested();
bool IsFullscreenPermissionRequested();
- FullscreenExitBubbleType GetFullscreenExitBubbleType();
+ ExclusiveAccessBubbleType GetExclusiveAccessBubbleType();
bool IsFullscreenBubbleDisplayed();
bool IsFullscreenBubbleDisplayingButtons();
void AcceptCurrentFullscreenOrMouseLockRequest();
diff --git a/chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.cc b/chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.cc
deleted file mode 100644
index 0c8c076..0000000
--- a/chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.cc
+++ /dev/null
@@ -1,131 +0,0 @@
-// 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.
-
-#include "chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.h"
-
-#include "base/strings/utf_string_conversions.h"
-#include "chrome/common/url_constants.h"
-#include "chrome/grit/generated_resources.h"
-#include "extensions/browser/extension_registry.h"
-#include "extensions/common/constants.h"
-#include "extensions/common/extension.h"
-#include "extensions/common/extension_set.h"
-#include "ui/base/l10n/l10n_util.h"
-
-namespace fullscreen_bubble {
-
-base::string16 GetLabelTextForType(FullscreenExitBubbleType type,
- const GURL& url,
- extensions::ExtensionRegistry* registry) {
- base::string16 host(base::UTF8ToUTF16(url.host()));
- if (registry) {
- const extensions::Extension* extension =
- registry->enabled_extensions().GetExtensionOrAppByURL(url);
- if (extension) {
- host = base::UTF8ToUTF16(extension->name());
- } else if (url.SchemeIs(extensions::kExtensionScheme)) {
- // In this case, |host| is set to an extension ID.
- // We are not going to show it because it's human-unreadable.
- host.clear();
- }
- }
- if (host.empty()) {
- switch (type) {
- case FEB_TYPE_FULLSCREEN_BUTTONS:
- case FEB_TYPE_FULLSCREEN_EXIT_INSTRUCTION:
- return l10n_util::GetStringUTF16(IDS_FULLSCREEN_ENTERED_FULLSCREEN);
- case FEB_TYPE_FULLSCREEN_MOUSELOCK_BUTTONS:
- return l10n_util::GetStringUTF16(
- IDS_FULLSCREEN_REQUEST_FULLSCREEN_MOUSELOCK);
- case FEB_TYPE_MOUSELOCK_BUTTONS:
- return l10n_util::GetStringUTF16(IDS_FULLSCREEN_REQUEST_MOUSELOCK);
- case FEB_TYPE_FULLSCREEN_MOUSELOCK_EXIT_INSTRUCTION:
- return l10n_util::GetStringUTF16(
- IDS_FULLSCREEN_ENTERED_FULLSCREEN_MOUSELOCK);
- case FEB_TYPE_MOUSELOCK_EXIT_INSTRUCTION:
- return l10n_util::GetStringUTF16(
- IDS_FULLSCREEN_ENTERED_MOUSELOCK);
- case FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION:
- return l10n_util::GetStringUTF16(
- IDS_FULLSCREEN_USER_ENTERED_FULLSCREEN);
- case FEB_TYPE_BROWSER_EXTENSION_FULLSCREEN_EXIT_INSTRUCTION:
- return l10n_util::GetStringUTF16(
- IDS_FULLSCREEN_UNKNOWN_EXTENSION_TRIGGERED_FULLSCREEN);
- default:
- NOTREACHED();
- return base::string16();
- }
- }
- switch (type) {
- case FEB_TYPE_FULLSCREEN_BUTTONS:
- return l10n_util::GetStringFUTF16(
- IDS_FULLSCREEN_SITE_ENTERED_FULLSCREEN, host);
- case FEB_TYPE_FULLSCREEN_MOUSELOCK_BUTTONS:
- return l10n_util::GetStringFUTF16(
- IDS_FULLSCREEN_SITE_REQUEST_FULLSCREEN_MOUSELOCK, host);
- case FEB_TYPE_MOUSELOCK_BUTTONS:
- return l10n_util::GetStringFUTF16(
- IDS_FULLSCREEN_SITE_REQUEST_MOUSELOCK, host);
- case FEB_TYPE_FULLSCREEN_EXIT_INSTRUCTION:
- return l10n_util::GetStringFUTF16(
- IDS_FULLSCREEN_SITE_ENTERED_FULLSCREEN, host);
- case FEB_TYPE_FULLSCREEN_MOUSELOCK_EXIT_INSTRUCTION:
- return l10n_util::GetStringFUTF16(
- IDS_FULLSCREEN_SITE_ENTERED_FULLSCREEN_MOUSELOCK, host);
- case FEB_TYPE_MOUSELOCK_EXIT_INSTRUCTION:
- return l10n_util::GetStringFUTF16(
- IDS_FULLSCREEN_SITE_ENTERED_MOUSELOCK, host);
- case FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION:
- return l10n_util::GetStringUTF16(
- IDS_FULLSCREEN_USER_ENTERED_FULLSCREEN);
- case FEB_TYPE_BROWSER_EXTENSION_FULLSCREEN_EXIT_INSTRUCTION:
- return l10n_util::GetStringFUTF16(
- IDS_FULLSCREEN_EXTENSION_TRIGGERED_FULLSCREEN, host);
- default:
- NOTREACHED();
- return base::string16();
- }
-}
-
-base::string16 GetDenyButtonTextForType(FullscreenExitBubbleType type) {
- switch (type) {
- case FEB_TYPE_FULLSCREEN_BUTTONS:
- return l10n_util::GetStringUTF16(IDS_FULLSCREEN_EXIT_FULLSCREEN);
- case FEB_TYPE_FULLSCREEN_MOUSELOCK_BUTTONS:
- return l10n_util::GetStringUTF16(IDS_FULLSCREEN_EXIT);
- case FEB_TYPE_MOUSELOCK_BUTTONS:
- return l10n_util::GetStringUTF16(IDS_FULLSCREEN_DENY);
- case FEB_TYPE_FULLSCREEN_EXIT_INSTRUCTION:
- case FEB_TYPE_FULLSCREEN_MOUSELOCK_EXIT_INSTRUCTION:
- case FEB_TYPE_MOUSELOCK_EXIT_INSTRUCTION:
- case FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION:
- case FEB_TYPE_BROWSER_EXTENSION_FULLSCREEN_EXIT_INSTRUCTION:
- NOTREACHED(); // No button in this case.
- return base::string16();
- default:
- NOTREACHED();
- return base::string16();
- }
-}
-
-bool ShowButtonsForType(FullscreenExitBubbleType type) {
- return type == FEB_TYPE_FULLSCREEN_BUTTONS ||
- type == FEB_TYPE_FULLSCREEN_MOUSELOCK_BUTTONS ||
- type == FEB_TYPE_MOUSELOCK_BUTTONS;
-}
-
-void PermissionRequestedByType(FullscreenExitBubbleType type,
- bool* tab_fullscreen,
- bool* mouse_lock) {
- if (tab_fullscreen) {
- *tab_fullscreen = type == FEB_TYPE_FULLSCREEN_BUTTONS ||
- type == FEB_TYPE_FULLSCREEN_MOUSELOCK_BUTTONS;
- }
- if (mouse_lock) {
- *mouse_lock = type == FEB_TYPE_FULLSCREEN_MOUSELOCK_BUTTONS ||
- type == FEB_TYPE_MOUSELOCK_BUTTONS;
- }
-}
-
-} // namespace fullscreen_bubble
diff --git a/chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.h b/chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.h
deleted file mode 100644
index d36d122..0000000
--- a/chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.h
+++ /dev/null
@@ -1,50 +0,0 @@
-// 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.
-
-#ifndef CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_EXIT_BUBBLE_TYPE_H_
-#define CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_EXIT_BUBBLE_TYPE_H_
-
-#include "base/strings/string16.h"
-#include "url/gurl.h"
-
-namespace extensions {
-class ExtensionRegistry;
-}
-
-// Describes the contents of the fullscreen exit bubble.
-// For example, if the user already agreed to fullscreen mode and the
-// web page then requests mouse lock, "do you want to allow mouse lock"
-// will be shown.
-enum FullscreenExitBubbleType {
- FEB_TYPE_NONE = 0,
-
- // For tab fullscreen mode.
- // More comments about tab and browser fullscreen mode can be found in
- // chrome/browser/ui/fullscreen/fullscreen_controller.h.
- FEB_TYPE_FULLSCREEN_BUTTONS,
- FEB_TYPE_FULLSCREEN_MOUSELOCK_BUTTONS,
- FEB_TYPE_MOUSELOCK_BUTTONS,
- FEB_TYPE_FULLSCREEN_EXIT_INSTRUCTION,
- FEB_TYPE_FULLSCREEN_MOUSELOCK_EXIT_INSTRUCTION,
- FEB_TYPE_MOUSELOCK_EXIT_INSTRUCTION,
-
- // For browser fullscreen mode.
- FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION,
- FEB_TYPE_BROWSER_EXTENSION_FULLSCREEN_EXIT_INSTRUCTION
-};
-
-namespace fullscreen_bubble {
-
-base::string16 GetLabelTextForType(FullscreenExitBubbleType type,
- const GURL& url,
- extensions::ExtensionRegistry* registry);
-base::string16 GetDenyButtonTextForType(FullscreenExitBubbleType type);
-bool ShowButtonsForType(FullscreenExitBubbleType type);
-void PermissionRequestedByType(FullscreenExitBubbleType type,
- bool* tab_fullscreen,
- bool* mouse_lock);
-
-} // namespace fullscreen_bubble
-
-#endif // CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_EXIT_BUBBLE_TYPE_H_
diff --git a/chrome/browser/ui/views/fullscreen_exit_bubble_views.cc b/chrome/browser/ui/views/exclusive_access_bubble_views.cc
index 9545d1a..b5b5e68 100644
--- a/chrome/browser/ui/views/fullscreen_exit_bubble_views.cc
+++ b/chrome/browser/ui/views/exclusive_access_bubble_views.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/views/fullscreen_exit_bubble_views.h"
+#include "chrome/browser/ui/views/exclusive_access_bubble_views.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/utf_string_conversions.h"
@@ -35,7 +35,7 @@
#include "ui/base/l10n/l10n_util_win.h"
#endif
-// FullscreenExitView ----------------------------------------------------------
+// ExclusiveAccessView ---------------------------------------------------------
namespace {
@@ -62,8 +62,7 @@ class ButtonView : public views::View {
ButtonView::ButtonView(views::ButtonListener* listener,
int between_button_spacing)
- : accept_button_(NULL),
- deny_button_(NULL) {
+ : accept_button_(NULL), deny_button_(NULL) {
accept_button_ = new views::LabelButton(listener, base::string16());
accept_button_->SetStyle(views::Button::STYLE_BUTTON);
accept_button_->SetFocusable(false);
@@ -87,16 +86,16 @@ gfx::Size ButtonView::GetPreferredSize() const {
} // namespace
-class FullscreenExitBubbleViews::FullscreenExitView
+class ExclusiveAccessBubbleViews::ExclusiveAccessView
: public views::View,
public views::ButtonListener,
public views::LinkListener {
public:
- FullscreenExitView(FullscreenExitBubbleViews* bubble,
- const base::string16& accelerator,
- const GURL& url,
- FullscreenExitBubbleType bubble_type);
- ~FullscreenExitView() override;
+ ExclusiveAccessView(ExclusiveAccessBubbleViews* bubble,
+ const base::string16& accelerator,
+ const GURL& url,
+ ExclusiveAccessBubbleType bubble_type);
+ ~ExclusiveAccessView() override;
// views::ButtonListener
void ButtonPressed(views::Button* sender, const ui::Event& event) override;
@@ -104,10 +103,10 @@ class FullscreenExitBubbleViews::FullscreenExitView
// views::LinkListener
void LinkClicked(views::Link* source, int event_flags) override;
- void UpdateContent(const GURL& url, FullscreenExitBubbleType bubble_type);
+ void UpdateContent(const GURL& url, ExclusiveAccessBubbleType bubble_type);
private:
- FullscreenExitBubbleViews* bubble_;
+ ExclusiveAccessBubbleViews* bubble_;
// Clickable hint text for exiting fullscreen mode.
views::Link* link_;
@@ -118,14 +117,14 @@ class FullscreenExitBubbleViews::FullscreenExitView
ButtonView* button_view_;
const base::string16 browser_fullscreen_exit_accelerator_;
- DISALLOW_COPY_AND_ASSIGN(FullscreenExitView);
+ DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessView);
};
-FullscreenExitBubbleViews::FullscreenExitView::FullscreenExitView(
- FullscreenExitBubbleViews* bubble,
+ExclusiveAccessBubbleViews::ExclusiveAccessView::ExclusiveAccessView(
+ ExclusiveAccessBubbleViews* bubble,
const base::string16& accelerator,
const GURL& url,
- FullscreenExitBubbleType bubble_type)
+ ExclusiveAccessBubbleType bubble_type)
: bubble_(bubble),
link_(NULL),
mouse_lock_exit_instruction_(NULL),
@@ -134,8 +133,7 @@ FullscreenExitBubbleViews::FullscreenExitView::FullscreenExitView(
browser_fullscreen_exit_accelerator_(accelerator) {
scoped_ptr<views::BubbleBorder> bubble_border(
new views::BubbleBorder(views::BubbleBorder::NONE,
- views::BubbleBorder::BIG_SHADOW,
- SK_ColorWHITE));
+ views::BubbleBorder::BIG_SHADOW, SK_ColorWHITE));
set_background(new views::BubbleBackground(bubble_border.get()));
SetBorder(bubble_border.Pass());
SetFocusable(false);
@@ -195,10 +193,10 @@ FullscreenExitBubbleViews::FullscreenExitView::FullscreenExitView(
UpdateContent(url, bubble_type);
}
-FullscreenExitBubbleViews::FullscreenExitView::~FullscreenExitView() {
+ExclusiveAccessBubbleViews::ExclusiveAccessView::~ExclusiveAccessView() {
}
-void FullscreenExitBubbleViews::FullscreenExitView::ButtonPressed(
+void ExclusiveAccessBubbleViews::ExclusiveAccessView::ButtonPressed(
views::Button* sender,
const ui::Event& event) {
if (sender == button_view_->accept_button())
@@ -207,19 +205,19 @@ void FullscreenExitBubbleViews::FullscreenExitView::ButtonPressed(
bubble_->Cancel();
}
-void FullscreenExitBubbleViews::FullscreenExitView::LinkClicked(
+void ExclusiveAccessBubbleViews::ExclusiveAccessView::LinkClicked(
views::Link* link,
int event_flags) {
bubble_->ToggleFullscreen();
}
-void FullscreenExitBubbleViews::FullscreenExitView::UpdateContent(
+void ExclusiveAccessBubbleViews::ExclusiveAccessView::UpdateContent(
const GURL& url,
- FullscreenExitBubbleType bubble_type) {
- DCHECK_NE(FEB_TYPE_NONE, bubble_type);
+ ExclusiveAccessBubbleType bubble_type) {
+ DCHECK_NE(EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE, bubble_type);
message_label_->SetText(bubble_->GetCurrentMessageText());
- if (fullscreen_bubble::ShowButtonsForType(bubble_type)) {
+ if (exclusive_access_bubble::ShowButtonsForType(bubble_type)) {
link_->SetVisible(false);
mouse_lock_exit_instruction_->SetVisible(false);
button_view_->SetVisible(true);
@@ -228,21 +226,23 @@ void FullscreenExitBubbleViews::FullscreenExitView::UpdateContent(
} else {
bool link_visible = true;
base::string16 accelerator;
- if (bubble_type == FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION ||
- bubble_type == FEB_TYPE_BROWSER_EXTENSION_FULLSCREEN_EXIT_INSTRUCTION) {
+ if (bubble_type ==
+ EXCLUSIVE_ACCESS_BUBBLE_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION ||
+ bubble_type ==
+ EXCLUSIVE_ACCESS_BUBBLE_TYPE_EXTENSION_FULLSCREEN_EXIT_INSTRUCTION) {
accelerator = browser_fullscreen_exit_accelerator_;
- } else if (bubble_type == FEB_TYPE_FULLSCREEN_EXIT_INSTRUCTION) {
+ } else if (bubble_type ==
+ EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_EXIT_INSTRUCTION) {
accelerator = l10n_util::GetStringUTF16(IDS_APP_ESC_KEY);
} else {
link_visible = false;
}
#if !defined(OS_CHROMEOS)
if (link_visible) {
- link_->SetText(
- l10n_util::GetStringUTF16(IDS_EXIT_FULLSCREEN_MODE) +
- base::UTF8ToUTF16(" ") +
- l10n_util::GetStringFUTF16(IDS_EXIT_FULLSCREEN_MODE_ACCELERATOR,
- accelerator));
+ link_->SetText(l10n_util::GetStringUTF16(IDS_EXIT_FULLSCREEN_MODE) +
+ base::UTF8ToUTF16(" ") +
+ l10n_util::GetStringFUTF16(
+ IDS_EXIT_FULLSCREEN_MODE_ACCELERATOR, accelerator));
}
#endif
link_->SetVisible(link_visible);
@@ -251,14 +251,13 @@ void FullscreenExitBubbleViews::FullscreenExitView::UpdateContent(
}
}
+// ExclusiveAccessBubbleViews --------------------------------------------------
-// FullscreenExitBubbleViews ---------------------------------------------------
-
-FullscreenExitBubbleViews::FullscreenExitBubbleViews(
+ExclusiveAccessBubbleViews::ExclusiveAccessBubbleViews(
BrowserView* browser_view,
const GURL& url,
- FullscreenExitBubbleType bubble_type)
- : FullscreenExitBubble(browser_view->browser(), url, bubble_type),
+ ExclusiveAccessBubbleType bubble_type)
+ : ExclusiveAccessBubble(browser_view->browser(), url, bubble_type),
browser_view_(browser_view),
popup_(NULL),
animation_(new gfx::SlideAnimation(this)),
@@ -267,11 +266,11 @@ FullscreenExitBubbleViews::FullscreenExitBubbleViews(
// Create the contents view.
ui::Accelerator accelerator(ui::VKEY_UNKNOWN, ui::EF_NONE);
- bool got_accelerator = browser_view_->GetWidget()->GetAccelerator(
- IDC_FULLSCREEN, &accelerator);
+ bool got_accelerator =
+ browser_view_->GetWidget()->GetAccelerator(IDC_FULLSCREEN, &accelerator);
DCHECK(got_accelerator);
- view_ = new FullscreenExitView(
- this, accelerator.GetShortcutText(), url, bubble_type_);
+ view_ = new ExclusiveAccessView(this, accelerator.GetShortcutText(), url,
+ bubble_type_);
// TODO(yzshen): Change to use the new views bubble, BubbleDelegateView.
// TODO(pkotwicz): When this becomes a views bubble, make sure that this
@@ -296,16 +295,14 @@ FullscreenExitBubbleViews::FullscreenExitBubbleViews(
popup_->AddObserver(this);
- registrar_.Add(
- this,
- chrome::NOTIFICATION_FULLSCREEN_CHANGED,
- content::Source<FullscreenController>(
- browser_view_->browser()->fullscreen_controller()));
+ registrar_.Add(this, chrome::NOTIFICATION_FULLSCREEN_CHANGED,
+ content::Source<FullscreenController>(
+ browser_view_->browser()->fullscreen_controller()));
UpdateForImmersiveState();
}
-FullscreenExitBubbleViews::~FullscreenExitBubbleViews() {
+ExclusiveAccessBubbleViews::~ExclusiveAccessBubbleViews() {
popup_->RemoveObserver(this);
// This is tricky. We may be in an ATL message handler stack, in which case
@@ -321,10 +318,10 @@ FullscreenExitBubbleViews::~FullscreenExitBubbleViews() {
base::MessageLoop::current()->DeleteSoon(FROM_HERE, popup_);
}
-void FullscreenExitBubbleViews::UpdateContent(
+void ExclusiveAccessBubbleViews::UpdateContent(
const GURL& url,
- FullscreenExitBubbleType bubble_type) {
- DCHECK_NE(FEB_TYPE_NONE, bubble_type);
+ ExclusiveAccessBubbleType bubble_type) {
+ DCHECK_NE(EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE, bubble_type);
if (bubble_type_ == bubble_type && url_ == url)
return;
@@ -345,15 +342,16 @@ void FullscreenExitBubbleViews::UpdateContent(
UpdateMouseWatcher();
}
-void FullscreenExitBubbleViews::RepositionIfVisible() {
+void ExclusiveAccessBubbleViews::RepositionIfVisible() {
if (popup_->IsVisible())
UpdateBounds();
}
-void FullscreenExitBubbleViews::UpdateMouseWatcher() {
+void ExclusiveAccessBubbleViews::UpdateMouseWatcher() {
bool should_watch_mouse = false;
if (popup_->IsVisible())
- should_watch_mouse = !fullscreen_bubble::ShowButtonsForType(bubble_type_);
+ should_watch_mouse =
+ !exclusive_access_bubble::ShowButtonsForType(bubble_type_);
else
should_watch_mouse = CanMouseTriggerSlideIn();
@@ -366,10 +364,11 @@ void FullscreenExitBubbleViews::UpdateMouseWatcher() {
StopWatchingMouse();
}
-void FullscreenExitBubbleViews::UpdateForImmersiveState() {
+void ExclusiveAccessBubbleViews::UpdateForImmersiveState() {
AnimatedAttribute expected_animated_attribute =
- browser_view_->immersive_mode_controller()->IsEnabled() ?
- ANIMATED_ATTRIBUTE_OPACITY : ANIMATED_ATTRIBUTE_BOUNDS;
+ browser_view_->immersive_mode_controller()->IsEnabled()
+ ? ANIMATED_ATTRIBUTE_OPACITY
+ : ANIMATED_ATTRIBUTE_BOUNDS;
if (animated_attribute_ != expected_animated_attribute) {
// If an animation is currently in progress, skip to the end because
// switching the animated attribute midway through the animation looks
@@ -390,7 +389,7 @@ void FullscreenExitBubbleViews::UpdateForImmersiveState() {
UpdateMouseWatcher();
}
-void FullscreenExitBubbleViews::UpdateBounds() {
+void ExclusiveAccessBubbleViews::UpdateBounds() {
gfx::Rect popup_rect(GetPopupRect(false));
if (!popup_rect.IsEmpty()) {
popup_->SetBounds(popup_rect);
@@ -398,11 +397,11 @@ void FullscreenExitBubbleViews::UpdateBounds() {
}
}
-views::View* FullscreenExitBubbleViews::GetBrowserRootView() const {
+views::View* ExclusiveAccessBubbleViews::GetBrowserRootView() const {
return browser_view_->GetWidget()->GetRootView();
}
-void FullscreenExitBubbleViews::AnimationProgressed(
+void ExclusiveAccessBubbleViews::AnimationProgressed(
const gfx::Animation* animation) {
if (animated_attribute_ == ANIMATED_ATTRIBUTE_OPACITY) {
int opacity = animation_->CurrentValueBetween(0, 255);
@@ -422,20 +421,21 @@ void FullscreenExitBubbleViews::AnimationProgressed(
}
}
-void FullscreenExitBubbleViews::AnimationEnded(
+void ExclusiveAccessBubbleViews::AnimationEnded(
const gfx::Animation* animation) {
AnimationProgressed(animation);
}
-gfx::Rect FullscreenExitBubbleViews::GetPopupRect(
+gfx::Rect ExclusiveAccessBubbleViews::GetPopupRect(
bool ignore_animation_state) const {
gfx::Size size(view_->GetPreferredSize());
// NOTE: don't use the bounds of the root_view_. On linux GTK changing window
// size is async. Instead we use the size of the screen.
gfx::Screen* screen =
gfx::Screen::GetScreenFor(browser_view_->GetWidget()->GetNativeView());
- gfx::Rect screen_bounds = screen->GetDisplayNearestWindow(
- browser_view_->GetWidget()->GetNativeView()).bounds();
+ gfx::Rect screen_bounds =
+ screen->GetDisplayNearestWindow(
+ browser_view_->GetWidget()->GetNativeView()).bounds();
int x = screen_bounds.x() + (screen_bounds.width() - size.width()) / 2;
int top_container_bottom = screen_bounds.y();
@@ -465,40 +465,41 @@ gfx::Rect FullscreenExitBubbleViews::GetPopupRect(
return gfx::Rect(gfx::Point(x, y), size);
}
-gfx::Point FullscreenExitBubbleViews::GetCursorScreenPoint() {
- gfx::Point cursor_pos = gfx::Screen::GetScreenFor(
- browser_view_->GetWidget()->GetNativeView())->GetCursorScreenPoint();
+gfx::Point ExclusiveAccessBubbleViews::GetCursorScreenPoint() {
+ gfx::Point cursor_pos =
+ gfx::Screen::GetScreenFor(browser_view_->GetWidget()->GetNativeView())
+ ->GetCursorScreenPoint();
views::View::ConvertPointFromScreen(GetBrowserRootView(), &cursor_pos);
return cursor_pos;
}
-bool FullscreenExitBubbleViews::WindowContainsPoint(gfx::Point pos) {
+bool ExclusiveAccessBubbleViews::WindowContainsPoint(gfx::Point pos) {
return GetBrowserRootView()->HitTestPoint(pos);
}
-bool FullscreenExitBubbleViews::IsWindowActive() {
+bool ExclusiveAccessBubbleViews::IsWindowActive() {
return browser_view_->GetWidget()->IsActive();
}
-void FullscreenExitBubbleViews::Hide() {
+void ExclusiveAccessBubbleViews::Hide() {
animation_->SetSlideDuration(kSlideOutDurationMs);
animation_->Hide();
}
-void FullscreenExitBubbleViews::Show() {
+void ExclusiveAccessBubbleViews::Show() {
animation_->SetSlideDuration(kSlideInDurationMs);
animation_->Show();
}
-bool FullscreenExitBubbleViews::IsAnimating() {
+bool ExclusiveAccessBubbleViews::IsAnimating() {
return animation_->is_animating();
}
-bool FullscreenExitBubbleViews::CanMouseTriggerSlideIn() const {
+bool ExclusiveAccessBubbleViews::CanMouseTriggerSlideIn() const {
return !browser_view_->immersive_mode_controller()->IsEnabled();
}
-void FullscreenExitBubbleViews::Observe(
+void ExclusiveAccessBubbleViews::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
@@ -506,7 +507,7 @@ void FullscreenExitBubbleViews::Observe(
UpdateForImmersiveState();
}
-void FullscreenExitBubbleViews::OnWidgetVisibilityChanged(
+void ExclusiveAccessBubbleViews::OnWidgetVisibilityChanged(
views::Widget* widget,
bool visible) {
UpdateMouseWatcher();
diff --git a/chrome/browser/ui/views/fullscreen_exit_bubble_views.h b/chrome/browser/ui/views/exclusive_access_bubble_views.h
index 8af6d0e..f7e22e6 100644
--- a/chrome/browser/ui/views/fullscreen_exit_bubble_views.h
+++ b/chrome/browser/ui/views/exclusive_access_bubble_views.h
@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_UI_VIEWS_FULLSCREEN_EXIT_BUBBLE_VIEWS_H_
-#define CHROME_BROWSER_UI_VIEWS_FULLSCREEN_EXIT_BUBBLE_VIEWS_H_
+#ifndef CHROME_BROWSER_UI_VIEWS_EXCLUSIVE_ACCESS_BUBBLE_VIEWS_H_
+#define CHROME_BROWSER_UI_VIEWS_EXCLUSIVE_ACCESS_BUBBLE_VIEWS_H_
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
-#include "chrome/browser/ui/fullscreen/fullscreen_exit_bubble.h"
+#include "chrome/browser/ui/fullscreen/exclusive_access_bubble.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "ui/views/widget/widget_observer.h"
@@ -22,26 +22,26 @@ class View;
class Widget;
}
-// FullscreenExitBubbleViews is responsible for showing a bubble atop the
-// screen in fullscreen mode, telling users how to exit and providing a click
-// target. The bubble auto-hides, and re-shows when the user moves to the
-// screen top.
-class FullscreenExitBubbleViews : public FullscreenExitBubble,
- public content::NotificationObserver,
- public views::WidgetObserver {
+// ExclusiveAccessBubbleViews is responsible for showing a bubble atop the
+// screen in fullscreen/mouse lock mode, telling users how to exit and providing
+// a click target. The bubble auto-hides, and re-shows when the user moves to
+// the screen top.
+class ExclusiveAccessBubbleViews : public ExclusiveAccessBubble,
+ public content::NotificationObserver,
+ public views::WidgetObserver {
public:
- FullscreenExitBubbleViews(BrowserView* browser,
- const GURL& url,
- FullscreenExitBubbleType bubble_type);
- ~FullscreenExitBubbleViews() override;
+ ExclusiveAccessBubbleViews(BrowserView* browser,
+ const GURL& url,
+ ExclusiveAccessBubbleType bubble_type);
+ ~ExclusiveAccessBubbleViews() override;
- void UpdateContent(const GURL& url, FullscreenExitBubbleType bubble_type);
+ void UpdateContent(const GURL& url, ExclusiveAccessBubbleType bubble_type);
// Repositions |popup_| if it is visible.
void RepositionIfVisible();
private:
- class FullscreenExitView;
+ class ExclusiveAccessView;
enum AnimatedAttribute {
ANIMATED_ATTRIBUTE_BOUNDS,
@@ -93,11 +93,11 @@ class FullscreenExitBubbleViews : public FullscreenExitBubble,
AnimatedAttribute animated_attribute_;
// The contents of the popup.
- FullscreenExitView* view_;
+ ExclusiveAccessView* view_;
content::NotificationRegistrar registrar_;
- DISALLOW_COPY_AND_ASSIGN(FullscreenExitBubbleViews);
+ DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessBubbleViews);
};
-#endif // CHROME_BROWSER_UI_VIEWS_FULLSCREEN_EXIT_BUBBLE_VIEWS_H_
+#endif // CHROME_BROWSER_UI_VIEWS_EXCLUSIVE_ACCESS_BUBBLE_VIEWS_H_
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc
index a3b2a10..562d2ac 100644
--- a/chrome/browser/ui/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -63,6 +63,7 @@
#include "chrome/browser/ui/views/browser_dialogs.h"
#include "chrome/browser/ui/views/download/download_in_progress_dialog_view.h"
#include "chrome/browser/ui/views/download/download_shelf_view.h"
+#include "chrome/browser/ui/views/exclusive_access_bubble_views.h"
#include "chrome/browser/ui/views/extensions/bookmark_app_bubble_view.h"
#include "chrome/browser/ui/views/frame/browser_view_layout.h"
#include "chrome/browser/ui/views/frame/browser_view_layout_delegate.h"
@@ -70,7 +71,6 @@
#include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
#include "chrome/browser/ui/views/frame/top_container_view.h"
#include "chrome/browser/ui/views/frame/web_contents_close_handler.h"
-#include "chrome/browser/ui/views/fullscreen_exit_bubble_views.h"
#include "chrome/browser/ui/views/infobars/infobar_container_view.h"
#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
#include "chrome/browser/ui/views/location_bar/location_icon_view.h"
@@ -289,8 +289,8 @@ class BrowserViewLayoutDelegateImpl : public BrowserViewLayoutDelegate {
return browser_view_->IsBookmarkBarVisible();
}
- FullscreenExitBubbleViews* GetFullscreenExitBubble() const override {
- return browser_view_->fullscreen_exit_bubble();
+ ExclusiveAccessBubbleViews* GetExclusiveAccessBubble() const override {
+ return browser_view_->exclusive_access_bubble();
}
private:
@@ -874,7 +874,7 @@ void BrowserView::Restore() {
}
void BrowserView::EnterFullscreen(const GURL& url,
- FullscreenExitBubbleType bubble_type,
+ ExclusiveAccessBubbleType bubble_type,
bool with_toolbar) {
if (IsFullscreen())
return; // Nothing to do.
@@ -886,22 +886,24 @@ void BrowserView::ExitFullscreen() {
if (!IsFullscreen())
return; // Nothing to do.
- ProcessFullscreen(false, NORMAL_FULLSCREEN, GURL(), FEB_TYPE_NONE);
+ ProcessFullscreen(false, NORMAL_FULLSCREEN, GURL(),
+ EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE);
}
void BrowserView::UpdateFullscreenExitBubbleContent(
const GURL& url,
- FullscreenExitBubbleType bubble_type) {
+ ExclusiveAccessBubbleType bubble_type) {
// Immersive mode has no exit bubble because it has a visible strip at the
// top that gives the user a hover target.
// TODO(jamescook): Figure out what to do with mouse-lock.
- if (bubble_type == FEB_TYPE_NONE || ShouldUseImmersiveFullscreenForUrl(url)) {
- fullscreen_bubble_.reset();
- } else if (fullscreen_bubble_.get()) {
- fullscreen_bubble_->UpdateContent(url, bubble_type);
+ if (bubble_type == EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE ||
+ ShouldUseImmersiveFullscreenForUrl(url)) {
+ exclusive_access_bubble_.reset();
+ } else if (exclusive_access_bubble_.get()) {
+ exclusive_access_bubble_->UpdateContent(url, bubble_type);
} else {
- fullscreen_bubble_.reset(new FullscreenExitBubbleViews(
- this, url, bubble_type));
+ exclusive_access_bubble_.reset(
+ new ExclusiveAccessBubbleViews(this, url, bubble_type));
}
}
@@ -918,7 +920,7 @@ bool BrowserView::IsFullscreen() const {
}
bool BrowserView::IsFullscreenBubbleVisible() const {
- return fullscreen_bubble_ != nullptr;
+ return exclusive_access_bubble_ != nullptr;
}
bool BrowserView::SupportsFullscreenWithToolbar() const {
@@ -937,7 +939,8 @@ bool BrowserView::IsFullscreenWithToolbar() const {
#if defined(OS_WIN)
void BrowserView::SetMetroSnapMode(bool enable) {
LOCAL_HISTOGRAM_COUNTS("Metro.SnapModeToggle", enable);
- ProcessFullscreen(enable, METRO_SNAP_FULLSCREEN, GURL(), FEB_TYPE_NONE);
+ ProcessFullscreen(enable, METRO_SNAP_FULLSCREEN, GURL(),
+ EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE);
}
bool BrowserView::IsInMetroSnapMode() const {
@@ -953,7 +956,8 @@ void BrowserView::RestoreFocus() {
void BrowserView::FullscreenStateChanged() {
CHECK(!IsFullscreen());
- ProcessFullscreen(false, NORMAL_FULLSCREEN, GURL(), FEB_TYPE_NONE);
+ ProcessFullscreen(false, NORMAL_FULLSCREEN, GURL(),
+ EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE);
}
void BrowserView::ToolbarSizeChanged(bool is_animating) {
@@ -2195,7 +2199,7 @@ void BrowserView::UpdateUIForContents(WebContents* contents) {
void BrowserView::ProcessFullscreen(bool fullscreen,
FullscreenMode mode,
const GURL& url,
- FullscreenExitBubbleType bubble_type) {
+ ExclusiveAccessBubbleType bubble_type) {
if (in_process_fullscreen_)
return;
in_process_fullscreen_ = true;
@@ -2209,7 +2213,7 @@ void BrowserView::ProcessFullscreen(bool fullscreen,
if (mode == METRO_SNAP_FULLSCREEN || !fullscreen) {
// Hide the fullscreen bubble as soon as possible, since the mode toggle can
// take enough time for the user to notice.
- fullscreen_bubble_.reset();
+ exclusive_access_bubble_.reset();
}
if (fullscreen) {
diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h
index ed8eea2..f65ef38 100644
--- a/chrome/browser/ui/views/frame/browser_view.h
+++ b/chrome/browser/ui/views/frame/browser_view.h
@@ -48,7 +48,7 @@ class Browser;
class BrowserViewLayout;
class ContentsLayoutManager;
class DownloadShelfView;
-class FullscreenExitBubbleViews;
+class ExclusiveAccessBubbleViews;
class InfoBarContainerView;
class LocationBarView;
class PermissionBubbleViewViews;
@@ -179,8 +179,8 @@ class BrowserView : public BrowserWindow,
InfoBarContainerView* infobar_container() { return infobar_container_; }
// Accessor for the FullscreenExitBubbleViews.
- FullscreenExitBubbleViews* fullscreen_exit_bubble() {
- return fullscreen_bubble_.get();
+ ExclusiveAccessBubbleViews* exclusive_access_bubble() {
+ return exclusive_access_bubble_.get();
}
// Returns true if various window components are visible.
@@ -281,12 +281,12 @@ class BrowserView : public BrowserWindow,
void Minimize() override;
void Restore() override;
void EnterFullscreen(const GURL& url,
- FullscreenExitBubbleType bubble_type,
+ ExclusiveAccessBubbleType bubble_type,
bool with_toolbar) override;
void ExitFullscreen() override;
void UpdateFullscreenExitBubbleContent(
const GURL& url,
- FullscreenExitBubbleType bubble_type) override;
+ ExclusiveAccessBubbleType bubble_type) override;
bool ShouldHideUIForFullscreen() const override;
bool IsFullscreen() const override;
bool IsFullscreenBubbleVisible() const override;
@@ -527,7 +527,7 @@ class BrowserView : public BrowserWindow,
void ProcessFullscreen(bool fullscreen,
FullscreenMode mode,
const GURL& url,
- FullscreenExitBubbleType bubble_type);
+ ExclusiveAccessBubbleType bubble_type);
// Returns whether immmersive fullscreen should replace fullscreen. This
// should only occur for "browser-fullscreen" for tabbed-typed windows (not
@@ -667,7 +667,7 @@ class BrowserView : public BrowserWindow,
// jankiness.
bool in_process_fullscreen_;
- scoped_ptr<FullscreenExitBubbleViews> fullscreen_bubble_;
+ scoped_ptr<ExclusiveAccessBubbleViews> exclusive_access_bubble_;
#if defined(OS_WIN)
// This object is used to perform periodic actions in a worker
diff --git a/chrome/browser/ui/views/frame/browser_view_layout.cc b/chrome/browser/ui/views/frame/browser_view_layout.cc
index cd9d3d8..0c88979 100644
--- a/chrome/browser/ui/views/frame/browser_view_layout.cc
+++ b/chrome/browser/ui/views/frame/browser_view_layout.cc
@@ -14,11 +14,11 @@
#include "chrome/browser/ui/search/search_model.h"
#include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h"
#include "chrome/browser/ui/views/download/download_shelf_view.h"
+#include "chrome/browser/ui/views/exclusive_access_bubble_views.h"
#include "chrome/browser/ui/views/frame/browser_view_layout_delegate.h"
#include "chrome/browser/ui/views/frame/contents_layout_manager.h"
#include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
#include "chrome/browser/ui/views/frame/top_container_view.h"
-#include "chrome/browser/ui/views/fullscreen_exit_bubble_views.h"
#include "chrome/browser/ui/views/infobars/infobar_container_view.h"
#include "chrome/browser/ui/views/tabs/tab_strip.h"
#include "components/web_modal/web_contents_modal_dialog_host.h"
@@ -354,10 +354,10 @@ void BrowserViewLayout::Layout(views::View* browser_view) {
// Adjust the fullscreen exit bubble bounds for |top_container_|'s new bounds.
// This makes the fullscreen exit bubble look like it animates with
// |top_container_| in immersive fullscreen.
- FullscreenExitBubbleViews* fullscreen_exit_bubble =
- delegate_->GetFullscreenExitBubble();
- if (fullscreen_exit_bubble)
- fullscreen_exit_bubble->RepositionIfVisible();
+ ExclusiveAccessBubbleViews* exclusive_access_bubble =
+ delegate_->GetExclusiveAccessBubble();
+ if (exclusive_access_bubble)
+ exclusive_access_bubble->RepositionIfVisible();
// Adjust any hosted dialogs if the browser's dialog hosting bounds changed.
const gfx::Rect dialog_bounds(dialog_host_->GetDialogPosition(gfx::Size()),
diff --git a/chrome/browser/ui/views/frame/browser_view_layout_delegate.h b/chrome/browser/ui/views/frame/browser_view_layout_delegate.h
index 3f443d9..5c01a53 100644
--- a/chrome/browser/ui/views/frame/browser_view_layout_delegate.h
+++ b/chrome/browser/ui/views/frame/browser_view_layout_delegate.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_LAYOUT_DELEGATE_H_
#define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_LAYOUT_DELEGATE_H_
-class FullscreenExitBubbleViews;
+class ExclusiveAccessBubbleViews;
namespace gfx {
class Rect;
@@ -28,7 +28,7 @@ class BrowserViewLayoutDelegate {
virtual bool IsToolbarVisible() const = 0;
virtual bool IsBookmarkBarVisible() const = 0;
virtual bool DownloadShelfNeedsLayout() const = 0;
- virtual FullscreenExitBubbleViews* GetFullscreenExitBubble() const = 0;
+ virtual ExclusiveAccessBubbleViews* GetExclusiveAccessBubble() const = 0;
};
#endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_LAYOUT_DELEGATE_H_
diff --git a/chrome/browser/ui/views/frame/browser_view_layout_unittest.cc b/chrome/browser/ui/views/frame/browser_view_layout_unittest.cc
index 18311c7..87dd583 100644
--- a/chrome/browser/ui/views/frame/browser_view_layout_unittest.cc
+++ b/chrome/browser/ui/views/frame/browser_view_layout_unittest.cc
@@ -53,7 +53,7 @@ class MockBrowserViewLayoutDelegate : public BrowserViewLayoutDelegate {
return download_shelf_needs_layout_;
}
- FullscreenExitBubbleViews* GetFullscreenExitBubble() const override {
+ ExclusiveAccessBubbleViews* GetExclusiveAccessBubble() const override {
return nullptr;
}
diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi
index abd5b1a..59e4c24 100644
--- a/chrome/chrome_browser_ui.gypi
+++ b/chrome/chrome_browser_ui.gypi
@@ -396,6 +396,10 @@
'browser/ui/cocoa/drag_util.mm',
'browser/ui/cocoa/encoding_menu_controller_delegate_mac.h',
'browser/ui/cocoa/encoding_menu_controller_delegate_mac.mm',
+ 'browser/ui/cocoa/exclusive_access_bubble_window_controller.h',
+ 'browser/ui/cocoa/exclusive_access_bubble_window_controller.mm',
+ 'browser/ui/cocoa/exclusive_access_bubble_view.h',
+ 'browser/ui/cocoa/exclusive_access_bubble_view.mm',
'browser/ui/cocoa/extensions/browser_action_button.h',
'browser/ui/cocoa/extensions/browser_action_button.mm',
'browser/ui/cocoa/extensions/browser_action_test_util_mac.mm',
@@ -453,10 +457,6 @@
'browser/ui/cocoa/floating_bar_backing_view.mm',
'browser/ui/cocoa/framed_browser_window.h',
'browser/ui/cocoa/framed_browser_window.mm',
- 'browser/ui/cocoa/fullscreen_exit_bubble_controller.h',
- 'browser/ui/cocoa/fullscreen_exit_bubble_controller.mm',
- 'browser/ui/cocoa/fullscreen_exit_bubble_view.h',
- 'browser/ui/cocoa/fullscreen_exit_bubble_view.mm',
'browser/ui/cocoa/fullscreen_window.h',
'browser/ui/cocoa/fullscreen_window.mm',
'browser/ui/cocoa/full_size_content_window.h',
@@ -1420,12 +1420,12 @@
'browser/ui/fast_unload_controller.h',
'browser/ui/find_bar/find_bar_controller.cc',
'browser/ui/find_bar/find_bar_controller.h',
+ 'browser/ui/fullscreen/exclusive_access_bubble.cc',
+ 'browser/ui/fullscreen/exclusive_access_bubble.h',
+ 'browser/ui/fullscreen/exclusive_access_bubble_type.cc',
+ 'browser/ui/fullscreen/exclusive_access_bubble_type.h',
'browser/ui/fullscreen/fullscreen_controller.cc',
'browser/ui/fullscreen/fullscreen_controller.h',
- 'browser/ui/fullscreen/fullscreen_exit_bubble.cc',
- 'browser/ui/fullscreen/fullscreen_exit_bubble.h',
- 'browser/ui/fullscreen/fullscreen_exit_bubble_type.cc',
- 'browser/ui/fullscreen/fullscreen_exit_bubble_type.h',
'browser/ui/fullscreen/fullscreen_within_tab_helper.cc',
'browser/ui/fullscreen/fullscreen_within_tab_helper.h',
'browser/ui/infobar_container_delegate.cc',
@@ -1994,6 +1994,8 @@
'browser/ui/views/edit_search_engine_dialog.h',
'browser/ui/views/elevation_icon_setter.cc',
'browser/ui/views/elevation_icon_setter.h',
+ 'browser/ui/views/exclusive_access_bubble_views.cc',
+ 'browser/ui/views/exclusive_access_bubble_views.h',
'browser/ui/views/extensions/bookmark_app_bubble_view.cc',
'browser/ui/views/extensions/bookmark_app_bubble_view.h',
'browser/ui/views/extensions/browser_action_drag_data.cc',
@@ -2083,8 +2085,6 @@
'browser/ui/views/frame/web_contents_close_handler.cc',
'browser/ui/views/frame/web_contents_close_handler_delegate.h',
'browser/ui/views/frame/web_contents_close_handler.h',
- 'browser/ui/views/fullscreen_exit_bubble_views.cc',
- 'browser/ui/views/fullscreen_exit_bubble_views.h',
'browser/ui/views/global_error_bubble_view.cc',
'browser/ui/views/global_error_bubble_view.h',
'browser/ui/views/hung_renderer_view.cc',
diff --git a/chrome/chrome_nibs.gyp b/chrome/chrome_nibs.gyp
index 4f1d1fb..9c62303 100644
--- a/chrome/chrome_nibs.gyp
+++ b/chrome/chrome_nibs.gyp
@@ -125,6 +125,10 @@
'browser/ui/cocoa/constrained_window/constrained_window_button.mm',
'browser/ui/cocoa/constrained_window/constrained_window_custom_window.h',
'browser/ui/cocoa/constrained_window/constrained_window_custom_window.mm',
+ 'browser/ui/cocoa/exclusive_access_bubble_window_controller.h',
+ 'browser/ui/cocoa/exclusive_access_bubble_window_controller.mm',
+ 'browser/ui/cocoa/exclusive_access_bubble_view.h',
+ 'browser/ui/cocoa/exclusive_access_bubble_view.mm',
'browser/ui/cocoa/extensions/browser_actions_container_view.h',
'browser/ui/cocoa/extensions/browser_actions_container_view.mm',
'browser/ui/cocoa/extensions/device_permissions_view_controller.h',
@@ -151,10 +155,6 @@
'browser/ui/cocoa/first_run_dialog.mm',
'browser/ui/cocoa/framed_browser_window.h',
'browser/ui/cocoa/framed_browser_window.mm',
- 'browser/ui/cocoa/fullscreen_exit_bubble_controller.h',
- 'browser/ui/cocoa/fullscreen_exit_bubble_controller.mm',
- 'browser/ui/cocoa/fullscreen_exit_bubble_view.h',
- 'browser/ui/cocoa/fullscreen_exit_bubble_view.mm',
'browser/ui/cocoa/global_error_bubble_controller.h',
'browser/ui/cocoa/global_error_bubble_controller.mm',
'browser/ui/cocoa/gradient_button_cell.h',
diff --git a/chrome/chrome_nibs.gypi b/chrome/chrome_nibs.gypi
index caada8b..d90e021 100644
--- a/chrome/chrome_nibs.gypi
+++ b/chrome/chrome_nibs.gypi
@@ -30,6 +30,7 @@
'app/nibs/DownloadItem.xib',
'app/nibs/DownloadShelf.xib',
'app/nibs/EditSearchEngine.xib',
+ 'app/nibs/ExclusiveAccessBubble.xib',
'app/nibs/ExtensionInstallPrompt.xib',
'app/nibs/ExtensionInstallPromptBundle.xib',
'app/nibs/ExtensionInstallPromptNoWarnings.xib',
@@ -37,7 +38,6 @@
'app/nibs/ExtensionInstalledBubble.xib',
'app/nibs/FirstRunBubble.xib',
'app/nibs/FirstRunDialog.xib',
- 'app/nibs/FullscreenExitBubble.xib',
'app/nibs/HttpAuthLoginSheet.xib',
'app/nibs/HungRendererDialog.xib',
'app/nibs/ImportProgressDialog.xib',
diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi
index cba4c7a..4984ec4 100644
--- a/chrome/chrome_tests_unit.gypi
+++ b/chrome/chrome_tests_unit.gypi
@@ -1026,6 +1026,7 @@
'browser/ui/cocoa/download/download_shelf_view_cocoa_unittest.mm',
'browser/ui/cocoa/download/download_util_mac_unittest.mm',
'browser/ui/cocoa/draggable_button_unittest.mm',
+ 'browser/ui/cocoa/exclusive_access_bubble_window_controller_unittest.mm',
'browser/ui/cocoa/extensions/browser_actions_container_view_unittest.mm',
'browser/ui/cocoa/extensions/extension_install_prompt_test_utils.h',
'browser/ui/cocoa/extensions/extension_install_prompt_test_utils.mm',
@@ -1042,7 +1043,6 @@
'browser/ui/cocoa/first_run_bubble_controller_unittest.mm',
'browser/ui/cocoa/floating_bar_backing_view_unittest.mm',
'browser/ui/cocoa/framed_browser_window_unittest.mm',
- 'browser/ui/cocoa/fullscreen_exit_bubble_controller_unittest.mm',
'browser/ui/cocoa/fullscreen_window_unittest.mm',
'browser/ui/cocoa/gradient_button_cell_unittest.mm',
'browser/ui/cocoa/history_menu_bridge_unittest.mm',
diff --git a/chrome/test/base/test_browser_window.h b/chrome/test/base/test_browser_window.h
index acb2689..c418082 100644
--- a/chrome/test/base/test_browser_window.h
+++ b/chrome/test/base/test_browser_window.h
@@ -64,12 +64,12 @@ class TestBrowserWindow : public BrowserWindow {
void Minimize() override {}
void Restore() override {}
void EnterFullscreen(const GURL& url,
- FullscreenExitBubbleType type,
+ ExclusiveAccessBubbleType type,
bool with_toolbar) override {}
void ExitFullscreen() override {}
void UpdateFullscreenExitBubbleContent(
const GURL& url,
- FullscreenExitBubbleType bubble_type) override {}
+ ExclusiveAccessBubbleType bubble_type) override {}
bool ShouldHideUIForFullscreen() const override;
bool IsFullscreen() const override;
bool IsFullscreenBubbleVisible() const override;