Commit 84f05bbb authored by Evan Stade's avatar Evan Stade Committed by Commit Bot

Re-land "Remove NOTIFICATION_FULLSCREEN_CHANGED"

This re-lands commit a5646d5a.

Difference to original:

Override TearDownOnMainThread() instead of TearDown().

Original change's description:
> Remove NOTIFICATION_FULLSCREEN_CHANGED
>
> Replace with an observer interface on FullscreenController.
>
> Bug: 268984
> Change-Id: I1af2056e870af56b2f436a3aa8c6a54ed0ff44fb
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1666148
> Reviewed-by: Scott Violet <sky@chromium.org>
> Commit-Queue: Evan Stade <estade@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#671901}

Bug: 268984
Change-Id: I735754efa634d8ef21b4bb57f366dbad22b3c682
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1676731
Commit-Queue: Evan Stade <estade@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#673412}
parent 4dd5ac65
...@@ -317,9 +317,6 @@ enum NotificationType { ...@@ -317,9 +317,6 @@ enum NotificationType {
// Sent when a ProtocolHandlerRegistry is changed. The source is the profile. // Sent when a ProtocolHandlerRegistry is changed. The source is the profile.
NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED, NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED,
// Sent when the browser enters or exits fullscreen mode.
NOTIFICATION_FULLSCREEN_CHANGED,
// Sent when the FullscreenController changes, confirms, or denies mouse lock. // Sent when the FullscreenController changes, confirms, or denies mouse lock.
// The source is the browser's FullscreenController, no details. // The source is the browser's FullscreenController, no details.
NOTIFICATION_MOUSE_LOCK_CHANGED, NOTIFICATION_MOUSE_LOCK_CHANGED,
......
...@@ -35,23 +35,6 @@ namespace { ...@@ -35,23 +35,6 @@ namespace {
constexpr char kFingerprint[] = "pinky"; constexpr char kFingerprint[] = "pinky";
class FullscreenWaiter {
public:
explicit FullscreenWaiter(Browser* browser) : browser_(browser) {}
~FullscreenWaiter() = default;
void WaitForState(bool fullscreen) {
if (browser_->window()->IsFullscreen() != fullscreen)
observer_.Wait();
}
private:
FullscreenNotificationObserver observer_;
Browser* browser_;
DISALLOW_COPY_AND_ASSIGN(FullscreenWaiter);
};
class ScreenLockerTest : public InProcessBrowserTest { class ScreenLockerTest : public InProcessBrowserTest {
public: public:
ScreenLockerTest() = default; ScreenLockerTest() = default;
...@@ -144,20 +127,18 @@ IN_PROC_BROWSER_TEST_F(ScreenLockerTest, TestFullscreenExit) { ...@@ -144,20 +127,18 @@ IN_PROC_BROWSER_TEST_F(ScreenLockerTest, TestFullscreenExit) {
ash::wm::WindowState* window_state = ash::wm::WindowState* window_state =
ash::wm::GetWindowState(browser_window->GetNativeWindow()); ash::wm::GetWindowState(browser_window->GetNativeWindow());
{ {
FullscreenWaiter fullscreen_waiter(browser()); FullscreenNotificationObserver fullscreen_waiter(browser());
browser() browser()
->exclusive_access_manager() ->exclusive_access_manager()
->fullscreen_controller() ->fullscreen_controller()
->ToggleBrowserFullscreenMode(); ->ToggleBrowserFullscreenMode();
fullscreen_waiter.WaitForState(true); fullscreen_waiter.Wait();
EXPECT_TRUE(browser_window->IsFullscreen()); EXPECT_TRUE(browser_window->IsFullscreen());
EXPECT_FALSE(window_state->GetHideShelfWhenFullscreen()); EXPECT_FALSE(window_state->GetHideShelfWhenFullscreen());
EXPECT_FALSE(tester.IsLocked()); EXPECT_FALSE(tester.IsLocked());
} }
{ {
FullscreenWaiter fullscreen_waiter(browser());
tester.Lock(); tester.Lock();
fullscreen_waiter.WaitForState(true);
EXPECT_TRUE(browser_window->IsFullscreen()); EXPECT_TRUE(browser_window->IsFullscreen());
EXPECT_FALSE(window_state->GetHideShelfWhenFullscreen()); EXPECT_FALSE(window_state->GetHideShelfWhenFullscreen());
EXPECT_TRUE(tester.IsLocked()); EXPECT_TRUE(tester.IsLocked());
...@@ -166,12 +147,12 @@ IN_PROC_BROWSER_TEST_F(ScreenLockerTest, TestFullscreenExit) { ...@@ -166,12 +147,12 @@ IN_PROC_BROWSER_TEST_F(ScreenLockerTest, TestFullscreenExit) {
tester.UnlockWithPassword(user_manager::StubAccountId(), "pass"); tester.UnlockWithPassword(user_manager::StubAccountId(), "pass");
EXPECT_FALSE(tester.IsLocked()); EXPECT_FALSE(tester.IsLocked());
{ {
FullscreenWaiter fullscreen_waiter(browser()); FullscreenNotificationObserver fullscreen_waiter(browser());
browser() browser()
->exclusive_access_manager() ->exclusive_access_manager()
->fullscreen_controller() ->fullscreen_controller()
->ToggleBrowserFullscreenMode(); ->ToggleBrowserFullscreenMode();
fullscreen_waiter.WaitForState(false); fullscreen_waiter.Wait();
EXPECT_FALSE(browser_window->IsFullscreen()); EXPECT_FALSE(browser_window->IsFullscreen());
} }
...@@ -183,22 +164,20 @@ IN_PROC_BROWSER_TEST_F(ScreenLockerTest, TestFullscreenExit) { ...@@ -183,22 +164,20 @@ IN_PROC_BROWSER_TEST_F(ScreenLockerTest, TestFullscreenExit) {
// has all of the pixels, locking the screen should exit fullscreen. The // has all of the pixels, locking the screen should exit fullscreen. The
// fullscreen window has all of the pixels when in tab fullscreen. // fullscreen window has all of the pixels when in tab fullscreen.
{ {
FullscreenWaiter fullscreen_waiter(browser()); FullscreenNotificationObserver fullscreen_waiter(browser());
content::WebContents* web_contents = content::WebContents* web_contents =
browser()->tab_strip_model()->GetActiveWebContents(); browser()->tab_strip_model()->GetActiveWebContents();
browser() browser()
->exclusive_access_manager() ->exclusive_access_manager()
->fullscreen_controller() ->fullscreen_controller()
->EnterFullscreenModeForTab(web_contents, GURL()); ->EnterFullscreenModeForTab(web_contents, GURL());
fullscreen_waiter.WaitForState(true); fullscreen_waiter.Wait();
EXPECT_TRUE(browser_window->IsFullscreen()); EXPECT_TRUE(browser_window->IsFullscreen());
EXPECT_TRUE(window_state->GetHideShelfWhenFullscreen()); EXPECT_TRUE(window_state->GetHideShelfWhenFullscreen());
EXPECT_FALSE(tester.IsLocked()); EXPECT_FALSE(tester.IsLocked());
} }
{ {
FullscreenWaiter fullscreen_waiter(browser());
tester.Lock(); tester.Lock();
fullscreen_waiter.WaitForState(false);
EXPECT_FALSE(browser_window->IsFullscreen()); EXPECT_FALSE(browser_window->IsFullscreen());
EXPECT_TRUE(tester.IsLocked()); EXPECT_TRUE(tester.IsLocked());
} }
......
...@@ -686,11 +686,10 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessInteractiveBrowserTest, ...@@ -686,11 +686,10 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessInteractiveBrowserTest,
AddResizeListener(child, GetScreenSize()); AddResizeListener(child, GetScreenSize());
{ {
content::DOMMessageQueue queue; content::DOMMessageQueue queue;
std::unique_ptr<FullscreenNotificationObserver> observer( FullscreenNotificationObserver observer(browser());
new FullscreenNotificationObserver());
EXPECT_TRUE(ExecuteScript(child, "activateFullscreen()")); EXPECT_TRUE(ExecuteScript(child, "activateFullscreen()"));
WaitForMultipleFullscreenEvents(expected_events, queue); WaitForMultipleFullscreenEvents(expected_events, queue);
observer->Wait(); observer.Wait();
} }
// Verify that the browser has entered fullscreen for the current tab. // Verify that the browser has entered fullscreen for the current tab.
...@@ -722,11 +721,10 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessInteractiveBrowserTest, ...@@ -722,11 +721,10 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessInteractiveBrowserTest,
AddResizeListener(child, original_child_size); AddResizeListener(child, original_child_size);
{ {
content::DOMMessageQueue queue; content::DOMMessageQueue queue;
std::unique_ptr<FullscreenNotificationObserver> observer( FullscreenNotificationObserver observer(browser());
new FullscreenNotificationObserver());
EXPECT_TRUE(ExecuteScript(child, "exitFullscreen()")); EXPECT_TRUE(ExecuteScript(child, "exitFullscreen()"));
WaitForMultipleFullscreenEvents(expected_events, queue); WaitForMultipleFullscreenEvents(expected_events, queue);
observer->Wait(); observer.Wait();
} }
EXPECT_FALSE(browser()->window()->IsFullscreen()); EXPECT_FALSE(browser()->window()->IsFullscreen());
...@@ -786,11 +784,10 @@ void SitePerProcessInteractiveBrowserTest::FullscreenElementInABA( ...@@ -786,11 +784,10 @@ void SitePerProcessInteractiveBrowserTest::FullscreenElementInABA(
std::set<std::string> expected_events = {"main_frame", "child", "grandchild"}; std::set<std::string> expected_events = {"main_frame", "child", "grandchild"};
{ {
content::DOMMessageQueue queue; content::DOMMessageQueue queue;
std::unique_ptr<FullscreenNotificationObserver> observer( FullscreenNotificationObserver observer(browser());
new FullscreenNotificationObserver());
EXPECT_TRUE(ExecuteScript(grandchild, "activateFullscreen()")); EXPECT_TRUE(ExecuteScript(grandchild, "activateFullscreen()"));
WaitForMultipleFullscreenEvents(expected_events, queue); WaitForMultipleFullscreenEvents(expected_events, queue);
observer->Wait(); observer.Wait();
} }
// Verify that the browser has entered fullscreen for the current tab. // Verify that the browser has entered fullscreen for the current tab.
...@@ -817,8 +814,7 @@ void SitePerProcessInteractiveBrowserTest::FullscreenElementInABA( ...@@ -817,8 +814,7 @@ void SitePerProcessInteractiveBrowserTest::FullscreenElementInABA(
AddResizeListener(grandchild, original_grandchild_size); AddResizeListener(grandchild, original_grandchild_size);
{ {
content::DOMMessageQueue queue; content::DOMMessageQueue queue;
std::unique_ptr<FullscreenNotificationObserver> observer( FullscreenNotificationObserver observer(browser());
new FullscreenNotificationObserver());
switch (exit_method) { switch (exit_method) {
case FullscreenExitMethod::JS_CALL: case FullscreenExitMethod::JS_CALL:
EXPECT_TRUE(ExecuteScript(grandchild, "exitFullscreen()")); EXPECT_TRUE(ExecuteScript(grandchild, "exitFullscreen()"));
...@@ -831,7 +827,7 @@ void SitePerProcessInteractiveBrowserTest::FullscreenElementInABA( ...@@ -831,7 +827,7 @@ void SitePerProcessInteractiveBrowserTest::FullscreenElementInABA(
NOTREACHED(); NOTREACHED();
} }
WaitForMultipleFullscreenEvents(expected_events, queue); WaitForMultipleFullscreenEvents(expected_events, queue);
observer->Wait(); observer.Wait();
} }
EXPECT_FALSE(browser()->window()->IsFullscreen()); EXPECT_FALSE(browser()->window()->IsFullscreen());
...@@ -950,11 +946,10 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessInteractiveBrowserTest, ...@@ -950,11 +946,10 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessInteractiveBrowserTest,
// browser finishes the fullscreen transition. // browser finishes the fullscreen transition.
{ {
content::DOMMessageQueue queue; content::DOMMessageQueue queue;
std::unique_ptr<FullscreenNotificationObserver> observer( FullscreenNotificationObserver observer(browser());
new FullscreenNotificationObserver());
EXPECT_TRUE(ExecuteScript(c_middle, "activateFullscreen()")); EXPECT_TRUE(ExecuteScript(c_middle, "activateFullscreen()"));
WaitForMultipleFullscreenEvents(expected_events, queue); WaitForMultipleFullscreenEvents(expected_events, queue);
observer->Wait(); observer.Wait();
} }
// Verify that the browser has entered fullscreen for the current tab. // Verify that the browser has entered fullscreen for the current tab.
...@@ -991,12 +986,11 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessInteractiveBrowserTest, ...@@ -991,12 +986,11 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessInteractiveBrowserTest,
AddResizeListener(c_middle, c_middle_original_size); AddResizeListener(c_middle, c_middle_original_size);
{ {
content::DOMMessageQueue queue; content::DOMMessageQueue queue;
std::unique_ptr<FullscreenNotificationObserver> observer( FullscreenNotificationObserver observer(browser());
new FullscreenNotificationObserver());
ASSERT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_ESCAPE, ASSERT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_ESCAPE,
false, false, false, false)); false, false, false, false));
WaitForMultipleFullscreenEvents(expected_events, queue); WaitForMultipleFullscreenEvents(expected_events, queue);
observer->Wait(); observer.Wait();
} }
EXPECT_FALSE(browser()->window()->IsFullscreen()); EXPECT_FALSE(browser()->window()->IsFullscreen());
......
...@@ -886,7 +886,6 @@ jumbo_split_static_library("ui") { ...@@ -886,7 +886,6 @@ jumbo_split_static_library("ui") {
"exclusive_access/exclusive_access_bubble_hide_callback.h", "exclusive_access/exclusive_access_bubble_hide_callback.h",
"exclusive_access/exclusive_access_bubble_type.cc", "exclusive_access/exclusive_access_bubble_type.cc",
"exclusive_access/exclusive_access_bubble_type.h", "exclusive_access/exclusive_access_bubble_type.h",
"exclusive_access/exclusive_access_context.cc",
"exclusive_access/exclusive_access_context.h", "exclusive_access/exclusive_access_context.h",
"exclusive_access/exclusive_access_controller_base.cc", "exclusive_access/exclusive_access_controller_base.cc",
"exclusive_access/exclusive_access_controller_base.h", "exclusive_access/exclusive_access_controller_base.h",
...@@ -894,6 +893,7 @@ jumbo_split_static_library("ui") { ...@@ -894,6 +893,7 @@ jumbo_split_static_library("ui") {
"exclusive_access/exclusive_access_manager.h", "exclusive_access/exclusive_access_manager.h",
"exclusive_access/fullscreen_controller.cc", "exclusive_access/fullscreen_controller.cc",
"exclusive_access/fullscreen_controller.h", "exclusive_access/fullscreen_controller.h",
"exclusive_access/fullscreen_observer.h",
"exclusive_access/fullscreen_within_tab_helper.cc", "exclusive_access/fullscreen_within_tab_helper.cc",
"exclusive_access/fullscreen_within_tab_helper.h", "exclusive_access/fullscreen_within_tab_helper.h",
"exclusive_access/keyboard_lock_controller.cc", "exclusive_access/keyboard_lock_controller.cc",
......
...@@ -48,21 +48,28 @@ IN_PROC_BROWSER_TEST_F(PermissionBubbleBrowserTest, HasLocationBarByDefault) { ...@@ -48,21 +48,28 @@ IN_PROC_BROWSER_TEST_F(PermissionBubbleBrowserTest, HasLocationBarByDefault) {
} }
IN_PROC_BROWSER_TEST_F(PermissionBubbleBrowserTest, IN_PROC_BROWSER_TEST_F(PermissionBubbleBrowserTest,
TabFullscreenHasLocationBar) { TabFullscreenHasNoLocationBar) {
FullscreenNotificationObserver fullscreen_observer;
ShowBubble(browser()); ShowBubble(browser());
EXPECT_TRUE(HasVisibleLocationBarForBrowser(browser())); EXPECT_TRUE(HasVisibleLocationBarForBrowser(browser()));
FullscreenController* controller = FullscreenController* controller =
browser()->exclusive_access_manager()->fullscreen_controller(); browser()->exclusive_access_manager()->fullscreen_controller();
controller->EnterFullscreenModeForTab( {
browser()->tab_strip_model()->GetActiveWebContents(), GURL()); FullscreenNotificationObserver fullscreen_observer(browser());
fullscreen_observer.Wait(); controller->EnterFullscreenModeForTab(
browser()->tab_strip_model()->GetActiveWebContents(), GURL());
fullscreen_observer.Wait();
}
EXPECT_TRUE(controller->IsTabFullscreen());
EXPECT_FALSE(HasVisibleLocationBarForBrowser(browser())); EXPECT_FALSE(HasVisibleLocationBarForBrowser(browser()));
controller->ExitFullscreenModeForTab( {
browser()->tab_strip_model()->GetActiveWebContents()); FullscreenNotificationObserver fullscreen_observer(browser());
fullscreen_observer.Wait(); controller->ExitFullscreenModeForTab(
browser()->tab_strip_model()->GetActiveWebContents());
fullscreen_observer.Wait();
}
EXPECT_FALSE(controller->IsTabFullscreen());
EXPECT_TRUE(HasVisibleLocationBarForBrowser(browser())); EXPECT_TRUE(HasVisibleLocationBarForBrowser(browser()));
} }
......
// Copyright (c) 2015 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/exclusive_access/exclusive_access_context.h"
#include "base/logging.h"
#include "build/build_config.h"
// This file provides default implementations for the ExclusiveAccessContext
// methods that only some platforms care about.
void ExclusiveAccessContext::UpdateUIForTabFullscreen(
TabFullscreenState state) {
NOTIMPLEMENTED();
}
void ExclusiveAccessContext::UpdateFullscreenToolbar() {
NOTIMPLEMENTED();
}
...@@ -26,7 +26,7 @@ class ExclusiveAccessContext { ...@@ -26,7 +26,7 @@ class ExclusiveAccessContext {
STATE_EXIT_TAB_FULLSCREEN, STATE_EXIT_TAB_FULLSCREEN,
}; };
virtual ~ExclusiveAccessContext() {} virtual ~ExclusiveAccessContext() = default;
// Returns the current profile associated with the window. // Returns the current profile associated with the window.
virtual Profile* GetProfile() = 0; virtual Profile* GetProfile() = 0;
...@@ -38,11 +38,11 @@ class ExclusiveAccessContext { ...@@ -38,11 +38,11 @@ class ExclusiveAccessContext {
// Called when we transition between tab and browser fullscreen. This method // Called when we transition between tab and browser fullscreen. This method
// updates the UI by showing/hiding the tab strip, toolbar and bookmark bar // updates the UI by showing/hiding the tab strip, toolbar and bookmark bar
// in the browser fullscreen. Currently only supported on Mac. // in the browser fullscreen. Currently only supported on Mac.
virtual void UpdateUIForTabFullscreen(TabFullscreenState state); virtual void UpdateUIForTabFullscreen(TabFullscreenState state) {}
// Updates the toolbar state to be hidden or shown in fullscreen according to // Updates the toolbar state to be hidden or shown in fullscreen according to
// the preference's state. Only supported on Mac. // the preference's state. Only supported on Mac.
virtual void UpdateFullscreenToolbar(); virtual void UpdateFullscreenToolbar() {}
// Enters fullscreen and update exit bubble. // Enters fullscreen and update exit bubble.
virtual void EnterFullscreen(const GURL& url, virtual void EnterFullscreen(const GURL& url,
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/app_mode/app_mode_utils.h" #include "chrome/browser/app_mode/app_mode_utils.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h"
...@@ -26,7 +25,6 @@ ...@@ -26,7 +25,6 @@
#include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/content_settings/core/browser/host_content_settings_map.h"
#include "content/public/browser/navigation_details.h" #include "content/public/browser/navigation_details.h"
#include "content/public/browser/navigation_entry.h" #include "content/public/browser/navigation_entry.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_view_host.h" #include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host_view.h" #include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
...@@ -49,16 +47,16 @@ const char kFullscreenBubbleReshowsHistogramName[] = ...@@ -49,16 +47,16 @@ const char kFullscreenBubbleReshowsHistogramName[] =
} // namespace } // namespace
FullscreenController::FullscreenController(ExclusiveAccessManager* manager) FullscreenController::FullscreenController(ExclusiveAccessManager* manager)
: ExclusiveAccessControllerBase(manager), : ExclusiveAccessControllerBase(manager) {}
state_prior_to_tab_fullscreen_(STATE_INVALID),
tab_fullscreen_(false),
toggled_into_fullscreen_(false),
deactivated_contents_(nullptr),
is_privileged_fullscreen_for_testing_(false),
is_tab_fullscreen_for_testing_(false),
ptr_factory_(this) {}
FullscreenController::~FullscreenController() { FullscreenController::~FullscreenController() = default;
void FullscreenController::AddObserver(FullscreenObserver* observer) {
observer_list_.AddObserver(observer);
}
void FullscreenController::RemoveObserver(FullscreenObserver* observer) {
observer_list_.RemoveObserver(observer);
} }
bool FullscreenController::IsFullscreenForBrowser() const { bool FullscreenController::IsFullscreenForBrowser() const {
...@@ -162,7 +160,7 @@ void FullscreenController::EnterFullscreenModeForTab(WebContents* web_contents, ...@@ -162,7 +160,7 @@ void FullscreenController::EnterFullscreenModeForTab(WebContents* web_contents,
// This is only a change between Browser and Tab fullscreen. We generate // This is only a change between Browser and Tab fullscreen. We generate
// a fullscreen notification now because there is no window change. // a fullscreen notification now because there is no window change.
PostFullscreenChangeNotification(true); PostFullscreenChangeNotification();
} }
void FullscreenController::ExitFullscreenModeForTab(WebContents* web_contents) { void FullscreenController::ExitFullscreenModeForTab(WebContents* web_contents) {
...@@ -208,7 +206,7 @@ void FullscreenController::ExitFullscreenModeForTab(WebContents* web_contents) { ...@@ -208,7 +206,7 @@ void FullscreenController::ExitFullscreenModeForTab(WebContents* web_contents) {
// This is only a change between Browser and Tab fullscreen. We generate // This is only a change between Browser and Tab fullscreen. We generate
// a fullscreen notification now because there is no window change. // a fullscreen notification now because there is no window change.
PostFullscreenChangeNotification(true); PostFullscreenChangeNotification();
} }
void FullscreenController::OnTabDeactivated( void FullscreenController::OnTabDeactivated(
...@@ -273,7 +271,7 @@ void FullscreenController::WindowFullscreenStateChanged() { ...@@ -273,7 +271,7 @@ void FullscreenController::WindowFullscreenStateChanged() {
exclusive_access_manager()->context(); exclusive_access_manager()->context();
bool exiting_fullscreen = !exclusive_access_context->IsFullscreen(); bool exiting_fullscreen = !exclusive_access_context->IsFullscreen();
PostFullscreenChangeNotification(!exiting_fullscreen); PostFullscreenChangeNotification();
if (exiting_fullscreen) { if (exiting_fullscreen) {
toggled_into_fullscreen_ = false; toggled_into_fullscreen_ = false;
extension_caused_fullscreen_ = GURL(); extension_caused_fullscreen_ = GURL();
...@@ -317,18 +315,15 @@ void FullscreenController::ExitExclusiveAccessIfNecessary() { ...@@ -317,18 +315,15 @@ void FullscreenController::ExitExclusiveAccessIfNecessary() {
NotifyTabExclusiveAccessLost(); NotifyTabExclusiveAccessLost();
} }
void FullscreenController::PostFullscreenChangeNotification( void FullscreenController::PostFullscreenChangeNotification() {
bool is_fullscreen) {
base::ThreadTaskRunnerHandle::Get()->PostTask( base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(&FullscreenController::NotifyFullscreenChange, FROM_HERE, base::BindOnce(&FullscreenController::NotifyFullscreenChange,
ptr_factory_.GetWeakPtr(), is_fullscreen)); ptr_factory_.GetWeakPtr()));
} }
void FullscreenController::NotifyFullscreenChange(bool is_fullscreen) { void FullscreenController::NotifyFullscreenChange() {
content::NotificationService::current()->Notify( for (auto& observer : observer_list_)
chrome::NOTIFICATION_FULLSCREEN_CHANGED, observer.OnFullscreenStateChanged();
content::Source<FullscreenController>(this),
content::Details<bool>(&is_fullscreen));
} }
void FullscreenController::NotifyTabExclusiveAccessLost() { void FullscreenController::NotifyTabExclusiveAccessLost() {
......
...@@ -9,11 +9,10 @@ ...@@ -9,11 +9,10 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "build/build_config.h" #include "base/observer_list.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_controller_base.h" #include "chrome/browser/ui/exclusive_access/exclusive_access_controller_base.h"
#include "chrome/browser/ui/exclusive_access/fullscreen_observer.h"
#include "components/content_settings/core/common/content_settings.h" #include "components/content_settings/core/common/content_settings.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
class GURL; class GURL;
...@@ -63,6 +62,9 @@ class FullscreenController : public ExclusiveAccessControllerBase { ...@@ -63,6 +62,9 @@ class FullscreenController : public ExclusiveAccessControllerBase {
explicit FullscreenController(ExclusiveAccessManager* manager); explicit FullscreenController(ExclusiveAccessManager* manager);
~FullscreenController() override; ~FullscreenController() override;
void AddObserver(FullscreenObserver* observer);
void RemoveObserver(FullscreenObserver* observer);
// Browser/User Fullscreen /////////////////////////////////////////////////// // Browser/User Fullscreen ///////////////////////////////////////////////////
// Returns true if the window is currently fullscreen and was initially // Returns true if the window is currently fullscreen and was initially
...@@ -156,10 +158,9 @@ class FullscreenController : public ExclusiveAccessControllerBase { ...@@ -156,10 +158,9 @@ class FullscreenController : public ExclusiveAccessControllerBase {
TAB TAB
}; };
// Posts a task to call NotifyFullscreenChange. // Posts a task to notify observers of the fullscreen state change.
void PostFullscreenChangeNotification(bool is_fullscreen); void PostFullscreenChangeNotification();
// Sends a NOTIFICATION_FULLSCREEN_CHANGED notification. void NotifyFullscreenChange();
void NotifyFullscreenChange(bool is_fullscreen);
// Notifies the tab that it has been forced out of fullscreen mode if // Notifies the tab that it has been forced out of fullscreen mode if
// necessary. // necessary.
...@@ -198,25 +199,27 @@ class FullscreenController : public ExclusiveAccessControllerBase { ...@@ -198,25 +199,27 @@ class FullscreenController : public ExclusiveAccessControllerBase {
}; };
// The state before entering tab fullscreen mode via webkitRequestFullScreen. // The state before entering tab fullscreen mode via webkitRequestFullScreen.
// When not in tab fullscreen, it is STATE_INVALID. // When not in tab fullscreen, it is STATE_INVALID.
PriorFullscreenState state_prior_to_tab_fullscreen_; PriorFullscreenState state_prior_to_tab_fullscreen_ = STATE_INVALID;
// True if the site has entered into fullscreen. // True if the site has entered into fullscreen.
bool tab_fullscreen_; bool tab_fullscreen_ = false;
// True if this controller has toggled into tab OR browser fullscreen. // True if this controller has toggled into tab OR browser fullscreen.
bool toggled_into_fullscreen_; bool toggled_into_fullscreen_ = false;
// Set in OnTabDeactivated(). Used to see if we're in the middle of // Set in OnTabDeactivated(). Used to see if we're in the middle of
// deactivation of a tab. // deactivation of a tab.
content::WebContents* deactivated_contents_; content::WebContents* deactivated_contents_ = nullptr;
// Used in testing to confirm proper behavior for specific, privileged // Used in testing to confirm proper behavior for specific, privileged
// fullscreen cases. // fullscreen cases.
bool is_privileged_fullscreen_for_testing_; bool is_privileged_fullscreen_for_testing_ = false;
// Used in testing to set the state to tab fullscreen. // Used in testing to set the state to tab fullscreen.
bool is_tab_fullscreen_for_testing_; bool is_tab_fullscreen_for_testing_ = false;
base::ObserverList<FullscreenObserver> observer_list_;
base::WeakPtrFactory<FullscreenController> ptr_factory_; base::WeakPtrFactory<FullscreenController> ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(FullscreenController); DISALLOW_COPY_AND_ASSIGN(FullscreenController);
}; };
......
...@@ -90,7 +90,7 @@ void FullscreenControllerInteractiveTest::ToggleTabFullscreenNoRetries( ...@@ -90,7 +90,7 @@ void FullscreenControllerInteractiveTest::ToggleTabFullscreenNoRetries(
void FullscreenControllerInteractiveTest::ToggleBrowserFullscreen( void FullscreenControllerInteractiveTest::ToggleBrowserFullscreen(
bool enter_fullscreen) { bool enter_fullscreen) {
ASSERT_EQ(browser()->window()->IsFullscreen(), !enter_fullscreen); ASSERT_EQ(browser()->window()->IsFullscreen(), !enter_fullscreen);
FullscreenNotificationObserver fullscreen_observer; FullscreenNotificationObserver fullscreen_observer(browser());
chrome::ToggleFullscreenMode(browser()); chrome::ToggleFullscreenMode(browser());
...@@ -103,7 +103,7 @@ void FullscreenControllerInteractiveTest::ToggleTabFullscreen_Internal( ...@@ -103,7 +103,7 @@ void FullscreenControllerInteractiveTest::ToggleTabFullscreen_Internal(
bool enter_fullscreen, bool retry_until_success) { bool enter_fullscreen, bool retry_until_success) {
WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
do { do {
FullscreenNotificationObserver fullscreen_observer; FullscreenNotificationObserver fullscreen_observer(browser());
if (enter_fullscreen) if (enter_fullscreen)
browser()->EnterFullscreenModeForTab(tab, GURL(), browser()->EnterFullscreenModeForTab(tab, GURL(),
blink::WebFullscreenOptions()); blink::WebFullscreenOptions());
...@@ -133,7 +133,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, ...@@ -133,7 +133,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(true)); ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(true));
{ {
FullscreenNotificationObserver fullscreen_observer; FullscreenNotificationObserver fullscreen_observer(browser());
AddTabAtIndex(1, GURL(url::kAboutBlankURL), PAGE_TRANSITION_TYPED); AddTabAtIndex(1, GURL(url::kAboutBlankURL), PAGE_TRANSITION_TYPED);
fullscreen_observer.Wait(); fullscreen_observer.Wait();
ASSERT_FALSE(browser()->window()->IsFullscreen()); ASSERT_FALSE(browser()->window()->IsFullscreen());
...@@ -264,7 +264,7 @@ IN_PROC_BROWSER_TEST_F( ...@@ -264,7 +264,7 @@ IN_PROC_BROWSER_TEST_F(
WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
{ {
FullscreenNotificationObserver fullscreen_observer; FullscreenNotificationObserver fullscreen_observer(browser());
EXPECT_FALSE(browser()->window()->IsFullscreen()); EXPECT_FALSE(browser()->window()->IsFullscreen());
browser()->EnterFullscreenModeForTab(tab, GURL(), browser()->EnterFullscreenModeForTab(tab, GURL(),
blink::WebFullscreenOptions()); blink::WebFullscreenOptions());
...@@ -273,7 +273,7 @@ IN_PROC_BROWSER_TEST_F( ...@@ -273,7 +273,7 @@ IN_PROC_BROWSER_TEST_F(
} }
{ {
FullscreenNotificationObserver fullscreen_observer; FullscreenNotificationObserver fullscreen_observer(browser());
chrome::ToggleFullscreenMode(browser()); chrome::ToggleFullscreenMode(browser());
fullscreen_observer.Wait(); fullscreen_observer.Wait();
EXPECT_FALSE(browser()->window()->IsFullscreen()); EXPECT_FALSE(browser()->window()->IsFullscreen());
...@@ -282,7 +282,7 @@ IN_PROC_BROWSER_TEST_F( ...@@ -282,7 +282,7 @@ IN_PROC_BROWSER_TEST_F(
{ {
// Test that tab fullscreen mode doesn't make presentation mode the default // Test that tab fullscreen mode doesn't make presentation mode the default
// on Lion. // on Lion.
FullscreenNotificationObserver fullscreen_observer; FullscreenNotificationObserver fullscreen_observer(browser());
chrome::ToggleFullscreenMode(browser()); chrome::ToggleFullscreenMode(browser());
fullscreen_observer.Wait(); fullscreen_observer.Wait();
EXPECT_TRUE(browser()->window()->IsFullscreen()); EXPECT_TRUE(browser()->window()->IsFullscreen());
...@@ -328,7 +328,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, ...@@ -328,7 +328,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
// Request to lock the mouse and enter fullscreen. // Request to lock the mouse and enter fullscreen.
{ {
FullscreenNotificationObserver fullscreen_observer; FullscreenNotificationObserver fullscreen_observer(browser());
ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait(
browser(), ui::VKEY_B, false, true, false, false, browser(), ui::VKEY_B, false, true, false, false,
chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, chrome::NOTIFICATION_MOUSE_LOCK_CHANGED,
...@@ -338,7 +338,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, ...@@ -338,7 +338,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
// Escape, no prompts should remain. // Escape, no prompts should remain.
{ {
FullscreenNotificationObserver fullscreen_observer; FullscreenNotificationObserver fullscreen_observer(browser());
SendEscapeToFullscreenController(); SendEscapeToFullscreenController();
fullscreen_observer.Wait(); fullscreen_observer.Wait();
} }
...@@ -401,7 +401,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, ...@@ -401,7 +401,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
// Request to lock the mouse and enter fullscreen. // Request to lock the mouse and enter fullscreen.
{ {
FullscreenNotificationObserver fullscreen_observer; FullscreenNotificationObserver fullscreen_observer(browser());
ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait(
browser(), ui::VKEY_B, false, true, false, false, browser(), ui::VKEY_B, false, true, false, false,
chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, chrome::NOTIFICATION_MOUSE_LOCK_CHANGED,
...@@ -427,7 +427,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, ...@@ -427,7 +427,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
SetPrivilegedFullscreen(true); SetPrivilegedFullscreen(true);
// Request to lock the mouse and enter fullscreen. // Request to lock the mouse and enter fullscreen.
FullscreenNotificationObserver fullscreen_observer; FullscreenNotificationObserver fullscreen_observer(browser());
ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait(
browser(), ui::VKEY_B, false, true, false, false, browser(), ui::VKEY_B, false, true, false, false,
chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, chrome::NOTIFICATION_MOUSE_LOCK_CHANGED,
...@@ -639,7 +639,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, ...@@ -639,7 +639,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
// Request to lock the mouse and enter fullscreen. // Request to lock the mouse and enter fullscreen.
{ {
FullscreenNotificationObserver fullscreen_observer; FullscreenNotificationObserver fullscreen_observer(browser());
ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait(
browser(), ui::VKEY_B, false, true, false, false, browser(), ui::VKEY_B, false, true, false, false,
chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, chrome::NOTIFICATION_MOUSE_LOCK_CHANGED,
...@@ -652,7 +652,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, ...@@ -652,7 +652,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest,
// Reload. Mouse should be unlocked and fullscreen exited. // Reload. Mouse should be unlocked and fullscreen exited.
{ {
FullscreenNotificationObserver fullscreen_observer; FullscreenNotificationObserver fullscreen_observer(browser());
Reload(); Reload();
fullscreen_observer.Wait(); fullscreen_observer.Wait();
ASSERT_FALSE(IsMouseLocked()); ASSERT_FALSE(IsMouseLocked());
......
...@@ -31,15 +31,26 @@ ...@@ -31,15 +31,26 @@
class FullscreenControllerStateInteractiveTest class FullscreenControllerStateInteractiveTest
: public InProcessBrowserTest, : public InProcessBrowserTest,
public FullscreenControllerStateTest { public FullscreenControllerStateTest {
private: public:
// FullscreenControllerStateTest override: FullscreenControllerStateInteractiveTest() = default;
Browser* GetBrowser() override; ~FullscreenControllerStateInteractiveTest() override = default;
};
// InProcessBrowserTest:
void TearDownOnMainThread() override {
// This code needs to override TearDownOnMainThread() as that is called
// before the Browser created by BrowserTestBase is deleted. TearDown() is
// called after the browser has already been deleted, which means the test
// code tries to remove an observer from a browser that was destroyed.
FullscreenControllerStateTest::TearDown();
InProcessBrowserTest::TearDownOnMainThread();
}
Browser* FullscreenControllerStateInteractiveTest::GetBrowser() { // FullscreenControllerStateTest:
return InProcessBrowserTest::browser(); Browser* GetBrowser() override { return InProcessBrowserTest::browser(); }
}
private:
DISALLOW_COPY_AND_ASSIGN(FullscreenControllerStateInteractiveTest);
};
// Soak tests ------------------------------------------------------------------ // Soak tests ------------------------------------------------------------------
......
...@@ -227,12 +227,12 @@ const char* FullscreenControllerStateTest::GetWindowStateString() { ...@@ -227,12 +227,12 @@ const char* FullscreenControllerStateTest::GetWindowStateString() {
bool FullscreenControllerStateTest::InvokeEvent(Event event) { bool FullscreenControllerStateTest::InvokeEvent(Event event) {
if (!fullscreen_notification_observer_.get()) { if (!fullscreen_notification_observer_.get()) {
// Start observing NOTIFICATION_FULLSCREEN_CHANGED. Construct the // Start observing fullscreen changes. Construct the notification observer
// notification observer here instead of in // here instead of in
// FullscreenControllerStateTest::FullscreenControllerStateTest() so that we // FullscreenControllerStateTest::FullscreenControllerStateTest() so that we
// listen to notifications on the proper thread. // listen to notifications on the proper thread.
fullscreen_notification_observer_.reset( fullscreen_notification_observer_ =
new FullscreenNotificationObserver()); std::make_unique<FullscreenNotificationObserver>(GetBrowser());
} }
State source_state = state_; State source_state = state_;
...@@ -350,8 +350,8 @@ void FullscreenControllerStateTest::MaybeWaitForNotification() { ...@@ -350,8 +350,8 @@ void FullscreenControllerStateTest::MaybeWaitForNotification() {
IsPersistentState(state_)) { IsPersistentState(state_)) {
fullscreen_notification_observer_->Wait(); fullscreen_notification_observer_->Wait();
last_notification_received_state_ = state_; last_notification_received_state_ = state_;
fullscreen_notification_observer_.reset( fullscreen_notification_observer_ =
new FullscreenNotificationObserver()); std::make_unique<FullscreenNotificationObserver>(GetBrowser());
} }
} }
...@@ -507,6 +507,10 @@ void FullscreenControllerStateTest::VerifyWindowStateExpectations( ...@@ -507,6 +507,10 @@ void FullscreenControllerStateTest::VerifyWindowStateExpectations(
} }
} }
void FullscreenControllerStateTest::TearDown() {
fullscreen_notification_observer_.reset();
}
FullscreenController* FullscreenControllerStateTest::GetFullscreenController() { FullscreenController* FullscreenControllerStateTest::GetFullscreenController() {
return GetBrowser()->exclusive_access_manager()->fullscreen_controller(); return GetBrowser()->exclusive_access_manager()->fullscreen_controller();
} }
......
...@@ -100,8 +100,8 @@ class FullscreenControllerStateTest { ...@@ -100,8 +100,8 @@ class FullscreenControllerStateTest {
// Checks that window state matches the expected controller state. // Checks that window state matches the expected controller state.
virtual void VerifyWindowState(); virtual void VerifyWindowState();
// Wait for NOTIFICATION_FULLSCREEN_CHANGED if a notification should have been // Wait for a fullscreen change if a notification should have been sent in
// sent in transitioning to |state_| from the previous persistent state. // transitioning to |state_| from the previous persistent state.
void MaybeWaitForNotification(); void MaybeWaitForNotification();
// Tests all states with all permutations of multiple events to detect // Tests all states with all permutations of multiple events to detect
...@@ -165,6 +165,8 @@ class FullscreenControllerStateTest { ...@@ -165,6 +165,8 @@ class FullscreenControllerStateTest {
FullscreenForBrowserExpectation fullscreen_for_browser, FullscreenForBrowserExpectation fullscreen_for_browser,
FullscreenForTabExpectation fullscreen_for_tab); FullscreenForTabExpectation fullscreen_for_tab);
void TearDown();
virtual Browser* GetBrowser() = 0; virtual Browser* GetBrowser() = 0;
FullscreenController* GetFullscreenController(); FullscreenController* GetFullscreenController();
......
...@@ -216,6 +216,7 @@ class FullscreenControllerStateUnitTest : public BrowserWithTestWindowTest, ...@@ -216,6 +216,7 @@ class FullscreenControllerStateUnitTest : public BrowserWithTestWindowTest,
// FullscreenControllerStateTest: // FullscreenControllerStateTest:
void SetUp() override; void SetUp() override;
void TearDown() override;
std::unique_ptr<BrowserWindow> CreateBrowserWindow() override; std::unique_ptr<BrowserWindow> CreateBrowserWindow() override;
void ChangeWindowFullscreenState() override; void ChangeWindowFullscreenState() override;
const char* GetWindowStateString() override; const char* GetWindowStateString() override;
...@@ -225,18 +226,24 @@ class FullscreenControllerStateUnitTest : public BrowserWithTestWindowTest, ...@@ -225,18 +226,24 @@ class FullscreenControllerStateUnitTest : public BrowserWithTestWindowTest,
// FullscreenControllerStateTest: // FullscreenControllerStateTest:
bool ShouldSkipStateAndEventPair(State state, Event event) override; bool ShouldSkipStateAndEventPair(State state, Event event) override;
Browser* GetBrowser() override; Browser* GetBrowser() override;
FullscreenControllerTestWindow* window_; FullscreenControllerTestWindow* window_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(FullscreenControllerStateUnitTest);
}; };
FullscreenControllerStateUnitTest::FullscreenControllerStateUnitTest() FullscreenControllerStateUnitTest::FullscreenControllerStateUnitTest() =
: window_(NULL) { default;
}
void FullscreenControllerStateUnitTest::SetUp() { void FullscreenControllerStateUnitTest::SetUp() {
BrowserWithTestWindowTest::SetUp(); BrowserWithTestWindowTest::SetUp();
window_->set_browser(browser()); window_->set_browser(browser());
} }
void FullscreenControllerStateUnitTest::TearDown() {
FullscreenControllerStateTest::TearDown();
BrowserWithTestWindowTest::TearDown();
}
std::unique_ptr<BrowserWindow> std::unique_ptr<BrowserWindow>
FullscreenControllerStateUnitTest::CreateBrowserWindow() { FullscreenControllerStateUnitTest::CreateBrowserWindow() {
auto window = std::make_unique<FullscreenControllerTestWindow>(); auto window = std::make_unique<FullscreenControllerTestWindow>();
......
...@@ -33,6 +33,26 @@ ...@@ -33,6 +33,26 @@
using content::WebContents; using content::WebContents;
FullscreenNotificationObserver::FullscreenNotificationObserver(
Browser* browser) {
observer_.Add(browser->exclusive_access_manager()->fullscreen_controller());
}
FullscreenNotificationObserver::~FullscreenNotificationObserver() = default;
void FullscreenNotificationObserver::OnFullscreenStateChanged() {
observed_change_ = true;
if (run_loop_.running())
run_loop_.Quit();
}
void FullscreenNotificationObserver::Wait() {
if (observed_change_)
return;
run_loop_.Run();
}
const char FullscreenControllerTest::kFullscreenKeyboardLockHTML[] = const char FullscreenControllerTest::kFullscreenKeyboardLockHTML[] =
"/fullscreen_keyboardlock/fullscreen_keyboardlock.html"; "/fullscreen_keyboardlock/fullscreen_keyboardlock.html";
...@@ -173,20 +193,20 @@ void FullscreenControllerTest::SetPrivilegedFullscreen(bool is_privileged) { ...@@ -173,20 +193,20 @@ void FullscreenControllerTest::SetPrivilegedFullscreen(bool is_privileged) {
void FullscreenControllerTest::EnterActiveTabFullscreen() { void FullscreenControllerTest::EnterActiveTabFullscreen() {
WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
FullscreenNotificationObserver fullscreen_observer; FullscreenNotificationObserver fullscreen_observer(browser());
browser()->EnterFullscreenModeForTab(tab, GURL(), browser()->EnterFullscreenModeForTab(tab, GURL(),
blink::WebFullscreenOptions()); blink::WebFullscreenOptions());
fullscreen_observer.Wait(); fullscreen_observer.Wait();
} }
void FullscreenControllerTest::ToggleBrowserFullscreen() { void FullscreenControllerTest::ToggleBrowserFullscreen() {
FullscreenNotificationObserver fullscreen_observer; FullscreenNotificationObserver fullscreen_observer(browser());
chrome::ToggleFullscreenMode(browser()); chrome::ToggleFullscreenMode(browser());
fullscreen_observer.Wait(); fullscreen_observer.Wait();
} }
void FullscreenControllerTest::EnterExtensionInitiatedFullscreen() { void FullscreenControllerTest::EnterExtensionInitiatedFullscreen() {
FullscreenNotificationObserver fullscreen_observer; FullscreenNotificationObserver fullscreen_observer(browser());
browser()->ToggleFullscreenModeWithExtension(GURL("faux_extension")); browser()->ToggleFullscreenModeWithExtension(GURL("faux_extension"));
fullscreen_observer.Wait(); fullscreen_observer.Wait();
} }
......
...@@ -10,12 +10,15 @@ ...@@ -10,12 +10,15 @@
#include "base/callback_forward.h" #include "base/callback_forward.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/run_loop.h"
#include "base/scoped_observer.h"
#include "base/test/scoped_feature_list.h" #include "base/test/scoped_feature_list.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_bubble_hide_callback.h" #include "chrome/browser/ui/exclusive_access/exclusive_access_bubble_hide_callback.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h" #include "chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h"
#include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
#include "chrome/browser/ui/exclusive_access/fullscreen_observer.h"
#include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/in_process_browser_test.h"
#include "content/public/browser/notification_service.h" #include "content/public/browser/notification_service.h"
#include "content/public/test/test_utils.h" #include "content/public/test/test_utils.h"
...@@ -24,18 +27,30 @@ ...@@ -24,18 +27,30 @@
#include "ui/base/test/scoped_fake_nswindow_fullscreen.h" #include "ui/base/test/scoped_fake_nswindow_fullscreen.h"
#endif #endif
class Browser;
namespace base { namespace base {
class TickClock; class TickClock;
} // namespace base } // namespace base
// Observer for NOTIFICATION_FULLSCREEN_CHANGED notifications. // Observer for fullscreen state change notifications.
class FullscreenNotificationObserver class FullscreenNotificationObserver : public FullscreenObserver {
: public content::WindowedNotificationObserver {
public: public:
FullscreenNotificationObserver() : WindowedNotificationObserver( explicit FullscreenNotificationObserver(Browser* browser);
chrome::NOTIFICATION_FULLSCREEN_CHANGED, ~FullscreenNotificationObserver() override;
content::NotificationService::AllSources()) {}
// Runs a loop until a fullscreen change is seen (unless one has already been
// observed, in which case it returns immediately).
void Wait();
// FullscreenObserver:
void OnFullscreenStateChanged() override;
protected: protected:
bool observed_change_ = false;
ScopedObserver<FullscreenController, FullscreenObserver> observer_{this};
base::RunLoop run_loop_;
DISALLOW_COPY_AND_ASSIGN(FullscreenNotificationObserver); DISALLOW_COPY_AND_ASSIGN(FullscreenNotificationObserver);
}; };
......
// Copyright 2019 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_EXCLUSIVE_ACCESS_FULLSCREEN_OBSERVER_H_
#define CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_FULLSCREEN_OBSERVER_H_
#include "base/observer_list_types.h"
// An interface to be notified of changes in FullscreenController.
class FullscreenObserver : public base::CheckedObserver {
public:
virtual void OnFullscreenStateChanged() = 0;
};
#endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_FULLSCREEN_OBSERVER_H_
...@@ -11,14 +11,13 @@ ...@@ -11,14 +11,13 @@
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/app/chrome_command_ids.h" #include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/interactive_test_utils.h" #include "chrome/test/base/interactive_test_utils.h"
#include "content/public/browser/notification_service.h"
#include "content/public/test/browser_test_utils.h" #include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h" #include "content/public/test/test_utils.h"
#include "ui/events/keycodes/dom/keycode_converter.h" #include "ui/events/keycodes/dom/keycode_converter.h"
...@@ -181,9 +180,7 @@ void FullscreenKeyboardBrowserTestBase::SendShiftShortcut( ...@@ -181,9 +180,7 @@ void FullscreenKeyboardBrowserTestBase::SendShiftShortcut(
void FullscreenKeyboardBrowserTestBase::SendFullscreenShortcutAndWait() { void FullscreenKeyboardBrowserTestBase::SendFullscreenShortcutAndWait() {
// On MacOSX, entering and exiting fullscreen are not synchronous. So we wait // On MacOSX, entering and exiting fullscreen are not synchronous. So we wait
// for the observer to notice the change of fullscreen state. // for the observer to notice the change of fullscreen state.
content::WindowedNotificationObserver observer( FullscreenNotificationObserver observer(GetActiveBrowser());
chrome::NOTIFICATION_FULLSCREEN_CHANGED,
content::NotificationService::AllSources());
// Enter fullscreen. // Enter fullscreen.
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
// On MACOSX, Command + Control + F is used. // On MACOSX, Command + Control + F is used.
...@@ -202,16 +199,14 @@ void FullscreenKeyboardBrowserTestBase::SendFullscreenShortcutAndWait() { ...@@ -202,16 +199,14 @@ void FullscreenKeyboardBrowserTestBase::SendFullscreenShortcutAndWait() {
// keyboard events. As a result, content doesn't actually know it has entered // keyboard events. As a result, content doesn't actually know it has entered
// fullscreen. For more details, see ScopedFakeNSWindowFullscreen. // fullscreen. For more details, see ScopedFakeNSWindowFullscreen.
// TODO(crbug.com/837438): Remove this once ScopedFakeNSWindowFullscreen fires // TODO(crbug.com/837438): Remove this once ScopedFakeNSWindowFullscreen fires
// NOTIFICATION_FULLSCREEN_CHANGED. // OnFullscreenStateChanged.
#if !defined(OS_MACOSX) #if !defined(OS_MACOSX)
observer.Wait(); observer.Wait();
#endif #endif
} }
void FullscreenKeyboardBrowserTestBase::SendJsFullscreenShortcutAndWait() { void FullscreenKeyboardBrowserTestBase::SendJsFullscreenShortcutAndWait() {
content::WindowedNotificationObserver observer( FullscreenNotificationObserver observer(GetActiveBrowser());
chrome::NOTIFICATION_FULLSCREEN_CHANGED,
content::NotificationService::AllSources());
ASSERT_TRUE(ui_test_utils::SendKeyPressSync(GetActiveBrowser(), ui::VKEY_S, ASSERT_TRUE(ui_test_utils::SendKeyPressSync(GetActiveBrowser(), ui::VKEY_S,
false, false, false, false)); false, false, false, false));
expected_result_ += "KeyS ctrl:false shift:false alt:false meta:false\n"; expected_result_ += "KeyS ctrl:false shift:false alt:false meta:false\n";
...@@ -227,9 +222,7 @@ void FullscreenKeyboardBrowserTestBase::SendEscape() { ...@@ -227,9 +222,7 @@ void FullscreenKeyboardBrowserTestBase::SendEscape() {
void FullscreenKeyboardBrowserTestBase:: void FullscreenKeyboardBrowserTestBase::
SendEscapeAndWaitForExitingFullscreen() { SendEscapeAndWaitForExitingFullscreen() {
content::WindowedNotificationObserver observer( FullscreenNotificationObserver observer(GetActiveBrowser());
chrome::NOTIFICATION_FULLSCREEN_CHANGED,
content::NotificationService::AllSources());
ASSERT_TRUE(ui_test_utils::SendKeyPressSync( ASSERT_TRUE(ui_test_utils::SendKeyPressSync(
GetActiveBrowser(), ui::VKEY_ESCAPE, false, false, false, false)); GetActiveBrowser(), ui::VKEY_ESCAPE, false, false, false, false));
observer.Wait(); observer.Wait();
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/app/chrome_command_ids.h" #include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
#include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
#include "chrome/browser/ui/views/exclusive_access_bubble_views_context.h" #include "chrome/browser/ui/views/exclusive_access_bubble_views_context.h"
...@@ -22,7 +21,6 @@ ...@@ -22,7 +21,6 @@
#include "chrome/browser/ui/views/frame/top_container_view.h" #include "chrome/browser/ui/views/frame/top_container_view.h"
#include "chrome/browser/ui/views/subtle_notification_view.h" #include "chrome/browser/ui/views/subtle_notification_view.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "content/public/browser/notification_service.h"
#include "ui/accessibility/ax_node_data.h" #include "ui/accessibility/ax_node_data.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/events/keycodes/keyboard_codes.h" #include "ui/events/keycodes/keyboard_codes.h"
...@@ -70,10 +68,8 @@ ExclusiveAccessBubbleViews::ExclusiveAccessBubbleViews( ...@@ -70,10 +68,8 @@ ExclusiveAccessBubbleViews::ExclusiveAccessBubbleViews(
view_->SetBounds(0, 0, size.width(), size.height()); view_->SetBounds(0, 0, size.width(), size.height());
popup_->AddObserver(this); popup_->AddObserver(this);
registrar_.Add(this, chrome::NOTIFICATION_FULLSCREEN_CHANGED, fullscreen_observer_.Add(bubble_view_context_->GetExclusiveAccessManager()
content::Source<FullscreenController>( ->fullscreen_controller());
bubble_view_context_->GetExclusiveAccessManager()
->fullscreen_controller()));
UpdateMouseWatcher(); UpdateMouseWatcher();
} }
...@@ -275,11 +271,7 @@ bool ExclusiveAccessBubbleViews::CanTriggerOnMouse() const { ...@@ -275,11 +271,7 @@ bool ExclusiveAccessBubbleViews::CanTriggerOnMouse() const {
return bubble_view_context_->CanTriggerOnMouse(); return bubble_view_context_->CanTriggerOnMouse();
} }
void ExclusiveAccessBubbleViews::Observe( void ExclusiveAccessBubbleViews::OnFullscreenStateChanged() {
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
DCHECK_EQ(chrome::NOTIFICATION_FULLSCREEN_CHANGED, type);
UpdateMouseWatcher(); UpdateMouseWatcher();
} }
......
...@@ -9,10 +9,11 @@ ...@@ -9,10 +9,11 @@
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/scoped_observer.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_bubble.h" #include "chrome/browser/ui/exclusive_access/exclusive_access_bubble.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_bubble_hide_callback.h" #include "chrome/browser/ui/exclusive_access/exclusive_access_bubble_hide_callback.h"
#include "content/public/browser/notification_observer.h" #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
#include "content/public/browser/notification_registrar.h" #include "chrome/browser/ui/exclusive_access/fullscreen_observer.h"
#include "ui/views/widget/widget_observer.h" #include "ui/views/widget/widget_observer.h"
class ExclusiveAccessBubbleViewsContext; class ExclusiveAccessBubbleViewsContext;
...@@ -32,7 +33,7 @@ class SubtleNotificationView; ...@@ -32,7 +33,7 @@ class SubtleNotificationView;
// a click target. The bubble auto-hides, and re-shows when the user moves to // a click target. The bubble auto-hides, and re-shows when the user moves to
// the screen top. // the screen top.
class ExclusiveAccessBubbleViews : public ExclusiveAccessBubble, class ExclusiveAccessBubbleViews : public ExclusiveAccessBubble,
public content::NotificationObserver, public FullscreenObserver,
public views::WidgetObserver { public views::WidgetObserver {
public: public:
ExclusiveAccessBubbleViews( ExclusiveAccessBubbleViews(
...@@ -84,10 +85,8 @@ class ExclusiveAccessBubbleViews : public ExclusiveAccessBubble, ...@@ -84,10 +85,8 @@ class ExclusiveAccessBubbleViews : public ExclusiveAccessBubble,
bool IsAnimating() override; bool IsAnimating() override;
bool CanTriggerOnMouse() const override; bool CanTriggerOnMouse() const override;
// content::NotificationObserver: // FullscreenObserver:
void Observe(int type, void OnFullscreenStateChanged() override;
const content::NotificationSource& source,
const content::NotificationDetails& details) override;
// views::WidgetObserver: // views::WidgetObserver:
void OnWidgetDestroyed(views::Widget* widget) override; void OnWidgetDestroyed(views::Widget* widget) override;
...@@ -111,7 +110,8 @@ class ExclusiveAccessBubbleViews : public ExclusiveAccessBubble, ...@@ -111,7 +110,8 @@ class ExclusiveAccessBubbleViews : public ExclusiveAccessBubble,
SubtleNotificationView* view_; SubtleNotificationView* view_;
base::string16 browser_fullscreen_exit_accelerator_; base::string16 browser_fullscreen_exit_accelerator_;
content::NotificationRegistrar registrar_; ScopedObserver<FullscreenController, FullscreenObserver> fullscreen_observer_{
this};
DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessBubbleViews); DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessBubbleViews);
}; };
......
...@@ -98,7 +98,7 @@ namespace { ...@@ -98,7 +98,7 @@ namespace {
// Toggles fullscreen mode and waits for the notification. // Toggles fullscreen mode and waits for the notification.
void ToggleFullscreenModeAndWait(Browser* browser) { void ToggleFullscreenModeAndWait(Browser* browser) {
FullscreenNotificationObserver waiter; FullscreenNotificationObserver waiter(browser);
chrome::ToggleFullscreenMode(browser); chrome::ToggleFullscreenMode(browser);
waiter.Wait(); waiter.Wait();
} }
...@@ -106,7 +106,7 @@ void ToggleFullscreenModeAndWait(Browser* browser) { ...@@ -106,7 +106,7 @@ void ToggleFullscreenModeAndWait(Browser* browser) {
// Enters fullscreen mode for tab and waits for the notification. // Enters fullscreen mode for tab and waits for the notification.
void EnterFullscreenModeForTabAndWait(Browser* browser, void EnterFullscreenModeForTabAndWait(Browser* browser,
content::WebContents* web_contents) { content::WebContents* web_contents) {
FullscreenNotificationObserver waiter; FullscreenNotificationObserver waiter(browser);
browser->exclusive_access_manager() browser->exclusive_access_manager()
->fullscreen_controller() ->fullscreen_controller()
->EnterFullscreenModeForTab(web_contents, GURL()); ->EnterFullscreenModeForTab(web_contents, GURL());
...@@ -116,20 +116,13 @@ void EnterFullscreenModeForTabAndWait(Browser* browser, ...@@ -116,20 +116,13 @@ void EnterFullscreenModeForTabAndWait(Browser* browser,
// Exits fullscreen mode for tab and waits for the notification. // Exits fullscreen mode for tab and waits for the notification.
void ExitFullscreenModeForTabAndWait(Browser* browser, void ExitFullscreenModeForTabAndWait(Browser* browser,
content::WebContents* web_contents) { content::WebContents* web_contents) {
FullscreenNotificationObserver waiter; FullscreenNotificationObserver waiter(browser);
browser->exclusive_access_manager() browser->exclusive_access_manager()
->fullscreen_controller() ->fullscreen_controller()
->ExitFullscreenModeForTab(web_contents); ->ExitFullscreenModeForTab(web_contents);
waiter.Wait(); waiter.Wait();
} }
// Exits fullscreen mode and waits for the notification.
void ExitFullscreenModeAndWait(BrowserView* browser_view) {
FullscreenNotificationObserver waiter;
browser_view->ExitFullscreen();
waiter.Wait();
}
void StartOverview() { void StartOverview() {
ash::Shell::Get()->overview_controller()->StartOverview(); ash::Shell::Get()->overview_controller()->StartOverview();
} }
...@@ -490,7 +483,11 @@ IN_PROC_BROWSER_TEST_P(ImmersiveModeBrowserViewTest, ImmersiveFullscreen) { ...@@ -490,7 +483,11 @@ IN_PROC_BROWSER_TEST_P(ImmersiveModeBrowserViewTest, ImmersiveFullscreen) {
// Exiting immersive fullscreen should make the caption buttons and the frame // Exiting immersive fullscreen should make the caption buttons and the frame
// visible again. // visible again.
ExitFullscreenModeAndWait(browser_view); {
FullscreenNotificationObserver waiter(browser());
browser_view->ExitFullscreen();
waiter.Wait();
}
EXPECT_FALSE(immersive_mode_controller->IsEnabled()); EXPECT_FALSE(immersive_mode_controller->IsEnabled());
EXPECT_TRUE(frame_view->ShouldPaint()); EXPECT_TRUE(frame_view->ShouldPaint());
EXPECT_LT(0, frame_view->GetBoundsForTabStripRegion(browser_view->tabstrip()) EXPECT_LT(0, frame_view->GetBoundsForTabStripRegion(browser_view->tabstrip())
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "ash/public/cpp/immersive/immersive_fullscreen_controller_test_api.h" #include "ash/public/cpp/immersive/immersive_fullscreen_controller_test_api.h"
#include "chrome/browser/extensions/extension_browsertest.h" #include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
#include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h" #include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h"
#include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/hosted_app_button_container.h" #include "chrome/browser/ui/views/frame/hosted_app_button_container.h"
...@@ -71,7 +72,7 @@ IN_PROC_BROWSER_TEST_F(HostedAppAshInteractiveUITest, MenuButtonClickable) { ...@@ -71,7 +72,7 @@ IN_PROC_BROWSER_TEST_F(HostedAppAshInteractiveUITest, MenuButtonClickable) {
// Test that the hosted app menu button opens a menu on click in immersive mode. // Test that the hosted app menu button opens a menu on click in immersive mode.
IN_PROC_BROWSER_TEST_F(HostedAppAshInteractiveUITest, IN_PROC_BROWSER_TEST_F(HostedAppAshInteractiveUITest,
ImmersiveMenuButtonClickable) { ImmersiveMenuButtonClickable) {
FullscreenNotificationObserver waiter; FullscreenNotificationObserver waiter(browser());
chrome::ToggleFullscreenMode(browser()); chrome::ToggleFullscreenMode(browser());
waiter.Wait(); waiter.Wait();
......
...@@ -7,15 +7,12 @@ ...@@ -7,15 +7,12 @@
#include "ash/public/cpp/immersive/immersive_revealed_lock.h" #include "ash/public/cpp/immersive/immersive_revealed_lock.h"
#include "ash/public/cpp/window_properties.h" #include "ash/public/cpp/window_properties.h"
#include "base/macros.h" #include "base/macros.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/platform_util.h" #include "chrome/browser/platform_util.h"
#include "chrome/browser/ui/ash/tablet_mode_client.h" #include "chrome/browser/ui/ash/tablet_mode_client.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
#include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
#include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/top_container_view.h" #include "chrome/browser/ui/views/frame/top_container_view.h"
#include "chrome/browser/ui/views/tabs/tab_strip.h" #include "chrome/browser/ui/views/tabs/tab_strip.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
...@@ -83,12 +80,10 @@ void ImmersiveModeControllerAsh::SetEnabled(bool enabled) { ...@@ -83,12 +80,10 @@ void ImmersiveModeControllerAsh::SetEnabled(bool enabled) {
if (controller_.IsEnabled() == enabled) if (controller_.IsEnabled() == enabled)
return; return;
if (registrar_.IsEmpty()) { if (!fullscreen_observer_.IsObservingSources()) {
content::Source<FullscreenController> source( fullscreen_observer_.Add(browser_view_->browser()
browser_view_->browser() ->exclusive_access_manager()
->exclusive_access_manager() ->fullscreen_controller());
->fullscreen_controller());
registrar_.Add(this, chrome::NOTIFICATION_FULLSCREEN_CHANGED, source);
} }
ash::ImmersiveFullscreenController::EnableForWidget(browser_view_->frame(), ash::ImmersiveFullscreenController::EnableForWidget(browser_view_->frame(),
...@@ -221,16 +216,14 @@ std::vector<gfx::Rect> ImmersiveModeControllerAsh::GetVisibleBoundsInScreen() ...@@ -221,16 +216,14 @@ std::vector<gfx::Rect> ImmersiveModeControllerAsh::GetVisibleBoundsInScreen()
return bounds_in_screen; return bounds_in_screen;
} }
void ImmersiveModeControllerAsh::Observe( void ImmersiveModeControllerAsh::OnFullscreenStateChanged() {
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
DCHECK_EQ(chrome::NOTIFICATION_FULLSCREEN_CHANGED, type);
if (!controller_.IsEnabled()) if (!controller_.IsEnabled())
return; return;
// Auto hide the shelf in immersive browser fullscreen. // Auto hide the shelf in immersive browser fullscreen.
bool in_tab_fullscreen = content::Source<FullscreenController>(source) bool in_tab_fullscreen = browser_view_->browser()
->exclusive_access_manager()
->fullscreen_controller()
->IsWindowFullscreenForTabOrPending(); ->IsWindowFullscreenForTabOrPending();
browser_view_->GetNativeWindow()->SetProperty( browser_view_->GetNativeWindow()->SetProperty(
ash::kHideShelfWhenFullscreenKey, in_tab_fullscreen); ash::kHideShelfWhenFullscreenKey, in_tab_fullscreen);
......
...@@ -11,9 +11,9 @@ ...@@ -11,9 +11,9 @@
#include "ash/public/cpp/immersive/immersive_fullscreen_controller_delegate.h" #include "ash/public/cpp/immersive/immersive_fullscreen_controller_delegate.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/scoped_observer.h" #include "base/scoped_observer.h"
#include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
#include "chrome/browser/ui/exclusive_access/fullscreen_observer.h"
#include "chrome/browser/ui/views/frame/immersive_mode_controller.h" #include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "ui/aura/window_observer.h" #include "ui/aura/window_observer.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
...@@ -24,7 +24,7 @@ class Window; ...@@ -24,7 +24,7 @@ class Window;
class ImmersiveModeControllerAsh class ImmersiveModeControllerAsh
: public ImmersiveModeController, : public ImmersiveModeController,
public ash::ImmersiveFullscreenControllerDelegate, public ash::ImmersiveFullscreenControllerDelegate,
public content::NotificationObserver, public FullscreenObserver,
public aura::WindowObserver { public aura::WindowObserver {
public: public:
ImmersiveModeControllerAsh(); ImmersiveModeControllerAsh();
...@@ -59,12 +59,10 @@ class ImmersiveModeControllerAsh ...@@ -59,12 +59,10 @@ class ImmersiveModeControllerAsh
void SetVisibleFraction(double visible_fraction) override; void SetVisibleFraction(double visible_fraction) override;
std::vector<gfx::Rect> GetVisibleBoundsInScreen() const override; std::vector<gfx::Rect> GetVisibleBoundsInScreen() const override;
// content::NotificationObserver override: // FullscreenObserver:
void Observe(int type, void OnFullscreenStateChanged() override;
const content::NotificationSource& source,
const content::NotificationDetails& details) override;
// aura::WindowObserver override: // aura::WindowObserver:
void OnWindowPropertyChanged(aura::Window* window, void OnWindowPropertyChanged(aura::Window* window,
const void* key, const void* key,
intptr_t old) override; intptr_t old) override;
...@@ -82,7 +80,8 @@ class ImmersiveModeControllerAsh ...@@ -82,7 +80,8 @@ class ImmersiveModeControllerAsh
// the top-of-window views are not revealed. // the top-of-window views are not revealed.
double visible_fraction_ = 1.0; double visible_fraction_ = 1.0;
content::NotificationRegistrar registrar_; ScopedObserver<FullscreenController, FullscreenObserver> fullscreen_observer_{
this};
ScopedObserver<aura::Window, aura::WindowObserver> observed_windows_{this}; ScopedObserver<aura::Window, aura::WindowObserver> observed_windows_{this};
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "chrome/browser/profiles/profile_io_data.h" #include "chrome/browser/profiles/profile_io_data.h"
#include "chrome/browser/ui/ash/tablet_mode_client.h" #include "chrome/browser/ui/ash/tablet_mode_client.h"
#include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
#include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
#include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h" #include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h"
#include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h"
...@@ -24,11 +25,8 @@ ...@@ -24,11 +25,8 @@
#include "chrome/browser/ui/views/toolbar/toolbar_view.h" #include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "chrome/common/web_application_info.h" #include "chrome/common/web_application_info.h"
#include "chrome/test/base/ui_test_utils.h" #include "chrome/test/base/ui_test_utils.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/service_manager_connection.h"
#include "content/public/test/content_mock_cert_verifier.h" #include "content/public/test/content_mock_cert_verifier.h"
#include "net/cert/mock_cert_verifier.h" #include "net/cert/mock_cert_verifier.h"
#include "services/service_manager/public/cpp/connector.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
#include "ui/views/animation/test/ink_drop_host_view_test_api.h" #include "ui/views/animation/test/ink_drop_host_view_test_api.h"
#include "ui/views/window/frame_caption_button.h" #include "ui/views/window/frame_caption_button.h"
...@@ -97,12 +95,12 @@ class ImmersiveModeControllerAshHostedAppBrowserTest ...@@ -97,12 +95,12 @@ class ImmersiveModeControllerAshHostedAppBrowserTest
// Toggle the browser's fullscreen state. // Toggle the browser's fullscreen state.
void ToggleFullscreen() { void ToggleFullscreen() {
// NOTIFICATION_FULLSCREEN_CHANGED is sent asynchronously. The notification // The fullscreen change notification is sent asynchronously. The
// is used to trigger changes in whether the shelf is auto hidden. // notification is used to trigger changes in whether the shelf is auto
std::unique_ptr<FullscreenNotificationObserver> waiter( // hidden.
new FullscreenNotificationObserver()); FullscreenNotificationObserver waiter(browser());
chrome::ToggleFullscreenMode(browser()); chrome::ToggleFullscreenMode(browser());
waiter->Wait(); waiter.Wait();
} }
// Attempt revealing the top-of-window views. // Attempt revealing the top-of-window views.
......
...@@ -54,22 +54,20 @@ class ImmersiveModeControllerAshTest : public TestWithBrowserView { ...@@ -54,22 +54,20 @@ class ImmersiveModeControllerAshTest : public TestWithBrowserView {
// Toggle the browser's fullscreen state. // Toggle the browser's fullscreen state.
void ToggleFullscreen() { void ToggleFullscreen() {
// NOTIFICATION_FULLSCREEN_CHANGED is sent asynchronously. The notification // The fullscreen change notification is sent asynchronously. The
// is used to trigger changes in whether the shelf is auto hidden and // notification is used to trigger changes in whether the shelf is auto
// whether a "light bar" version of the tab strip is used when the // hidden and whether a "light bar" version of the tab strip is used when
// top-of-window views are hidden. // the top-of-window views are hidden.
std::unique_ptr<FullscreenNotificationObserver> waiter( FullscreenNotificationObserver waiter(browser());
new FullscreenNotificationObserver());
chrome::ToggleFullscreenMode(browser()); chrome::ToggleFullscreenMode(browser());
waiter->Wait(); waiter.Wait();
} }
// Set whether the browser is in tab fullscreen. // Set whether the browser is in tab fullscreen.
void SetTabFullscreen(bool tab_fullscreen) { void SetTabFullscreen(bool tab_fullscreen) {
content::WebContents* web_contents = content::WebContents* web_contents =
browser_view()->contents_web_view()->GetWebContents(); browser_view()->contents_web_view()->GetWebContents();
std::unique_ptr<FullscreenNotificationObserver> waiter( FullscreenNotificationObserver waiter(browser());
new FullscreenNotificationObserver());
if (tab_fullscreen) { if (tab_fullscreen) {
browser() browser()
->exclusive_access_manager() ->exclusive_access_manager()
...@@ -81,7 +79,7 @@ class ImmersiveModeControllerAshTest : public TestWithBrowserView { ...@@ -81,7 +79,7 @@ class ImmersiveModeControllerAshTest : public TestWithBrowserView {
->fullscreen_controller() ->fullscreen_controller()
->ExitFullscreenModeForTab(web_contents); ->ExitFullscreenModeForTab(web_contents);
} }
waiter->Wait(); waiter.Wait();
} }
// Attempt revealing the top-of-window views. // Attempt revealing the top-of-window views.
......
...@@ -12,16 +12,15 @@ ...@@ -12,16 +12,15 @@
#include "base/test/scoped_feature_list.h" #include "base/test/scoped_feature_list.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h" #include "chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
#include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h"
#include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/fullscreen_control/fullscreen_control_host.h" #include "chrome/browser/ui/views/fullscreen_control/fullscreen_control_host.h"
#include "chrome/browser/ui/views/fullscreen_control/fullscreen_control_view.h" #include "chrome/browser/ui/views/fullscreen_control/fullscreen_control_view.h"
#include "chrome/common/chrome_features.h" #include "chrome/common/chrome_features.h"
#include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h" #include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/common/content_features.h" #include "content/public/common/content_features.h"
#include "content/public/test/browser_test_utils.h" #include "content/public/test/browser_test_utils.h"
...@@ -44,19 +43,6 @@ namespace { ...@@ -44,19 +43,6 @@ namespace {
constexpr base::TimeDelta kPopupEventTimeout = base::TimeDelta::FromSeconds(5); constexpr base::TimeDelta kPopupEventTimeout = base::TimeDelta::FromSeconds(5);
// Observer for NOTIFICATION_FULLSCREEN_CHANGED notifications.
class FullscreenNotificationObserver
: public content::WindowedNotificationObserver {
public:
FullscreenNotificationObserver()
: WindowedNotificationObserver(
chrome::NOTIFICATION_FULLSCREEN_CHANGED,
content::NotificationService::AllSources()) {}
private:
DISALLOW_COPY_AND_ASSIGN(FullscreenNotificationObserver);
};
} // namespace } // namespace
class FullscreenControlViewTest : public InProcessBrowserTest { class FullscreenControlViewTest : public InProcessBrowserTest {
...@@ -120,7 +106,7 @@ class FullscreenControlViewTest : public InProcessBrowserTest { ...@@ -120,7 +106,7 @@ class FullscreenControlViewTest : public InProcessBrowserTest {
bool IsPopupCreated() { return GetFullscreenControlHost()->IsPopupCreated(); } bool IsPopupCreated() { return GetFullscreenControlHost()->IsPopupCreated(); }
void EnterActiveTabFullscreen() { void EnterActiveTabFullscreen() {
FullscreenNotificationObserver fullscreen_observer; FullscreenNotificationObserver fullscreen_observer(browser());
content::WebContentsDelegate* delegate = content::WebContentsDelegate* delegate =
static_cast<content::WebContentsDelegate*>(browser()); static_cast<content::WebContentsDelegate*>(browser());
delegate->EnterFullscreenModeForTab(GetActiveWebContents(), delegate->EnterFullscreenModeForTab(GetActiveWebContents(),
......
...@@ -5,13 +5,10 @@ ...@@ -5,13 +5,10 @@
#include "chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view.h" #include "chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
#include "chrome/browser/ui/layout_constants.h" #include "chrome/browser/ui/layout_constants.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/render_view_host.h" #include "content/public/browser/render_view_host.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
...@@ -52,10 +49,8 @@ LocationBarBubbleDelegateView::LocationBarBubbleDelegateView( ...@@ -52,10 +49,8 @@ LocationBarBubbleDelegateView::LocationBarBubbleDelegateView(
// Add observer to close the bubble if the fullscreen state changes. // Add observer to close the bubble if the fullscreen state changes.
if (web_contents) { if (web_contents) {
Browser* browser = chrome::FindBrowserWithWebContents(web_contents); Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
registrar_.Add( fullscreen_observer_.Add(
this, chrome::NOTIFICATION_FULLSCREEN_CHANGED, browser->exclusive_access_manager()->fullscreen_controller());
content::Source<FullscreenController>(
browser->exclusive_access_manager()->fullscreen_controller()));
} }
if (!anchor_view) if (!anchor_view)
SetAnchorRect(gfx::Rect(anchor_point, gfx::Size())); SetAnchorRect(gfx::Rect(anchor_point, gfx::Size()));
...@@ -86,11 +81,7 @@ void LocationBarBubbleDelegateView::ShowForReason(DisplayReason reason, ...@@ -86,11 +81,7 @@ void LocationBarBubbleDelegateView::ShowForReason(DisplayReason reason,
} }
} }
void LocationBarBubbleDelegateView::Observe( void LocationBarBubbleDelegateView::OnFullscreenStateChanged() {
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
DCHECK_EQ(chrome::NOTIFICATION_FULLSCREEN_CHANGED, type);
GetWidget()->SetVisibilityAnimationTransition(views::Widget::ANIMATE_NONE); GetWidget()->SetVisibilityAnimationTransition(views::Widget::ANIMATE_NONE);
CloseBubble(); CloseBubble();
} }
......
...@@ -6,16 +6,15 @@ ...@@ -6,16 +6,15 @@
#define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_BUBBLE_DELEGATE_VIEW_H_ #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_BUBBLE_DELEGATE_VIEW_H_
#include "base/macros.h" #include "base/macros.h"
#include "content/public/browser/notification_observer.h" #include "base/scoped_observer.h"
#include "content/public/browser/notification_registrar.h" #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
#include "chrome/browser/ui/exclusive_access/fullscreen_observer.h"
#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_observer.h"
#include "ui/events/event_observer.h" #include "ui/events/event_observer.h"
#include "ui/views/bubble/bubble_dialog_delegate_view.h" #include "ui/views/bubble/bubble_dialog_delegate_view.h"
#include "ui/views/event_monitor.h" #include "ui/views/event_monitor.h"
namespace content { namespace content {
class NotificationDetails;
class NotificationSource;
class WebContents; class WebContents;
} // namespace content } // namespace content
...@@ -24,7 +23,7 @@ class WebContents; ...@@ -24,7 +23,7 @@ class WebContents;
// mode. // mode.
// TODO(https://crbug.com/788051): Move to chrome/browser/ui/views/page_action/. // TODO(https://crbug.com/788051): Move to chrome/browser/ui/views/page_action/.
class LocationBarBubbleDelegateView : public views::BubbleDialogDelegateView, class LocationBarBubbleDelegateView : public views::BubbleDialogDelegateView,
public content::NotificationObserver, public FullscreenObserver,
public content::WebContentsObserver { public content::WebContentsObserver {
public: public:
enum DisplayReason { enum DisplayReason {
...@@ -56,10 +55,8 @@ class LocationBarBubbleDelegateView : public views::BubbleDialogDelegateView, ...@@ -56,10 +55,8 @@ class LocationBarBubbleDelegateView : public views::BubbleDialogDelegateView,
// user). // user).
void ShowForReason(DisplayReason reason, bool allow_refocus_alert = true); void ShowForReason(DisplayReason reason, bool allow_refocus_alert = true);
// content::NotificationObserver: // FullscreenObserver:
void Observe(int type, void OnFullscreenStateChanged() override;
const content::NotificationSource& source,
const content::NotificationDetails& details) override;
// content::WebContentsObserver: // content::WebContentsObserver:
void OnVisibilityChanged(content::Visibility visibility) override; void OnVisibilityChanged(content::Visibility visibility) override;
...@@ -99,8 +96,8 @@ class LocationBarBubbleDelegateView : public views::BubbleDialogDelegateView, ...@@ -99,8 +96,8 @@ class LocationBarBubbleDelegateView : public views::BubbleDialogDelegateView,
virtual void CloseBubble(); virtual void CloseBubble();
private: private:
// Used to register for fullscreen change notifications. ScopedObserver<FullscreenController, FullscreenObserver> fullscreen_observer_{
content::NotificationRegistrar registrar_; this};
DISALLOW_COPY_AND_ASSIGN(LocationBarBubbleDelegateView); DISALLOW_COPY_AND_ASSIGN(LocationBarBubbleDelegateView);
}; };
......
...@@ -62,15 +62,14 @@ IN_PROC_BROWSER_TEST_F(ZoomBubbleBrowserTest, NonImmersiveFullscreen) { ...@@ -62,15 +62,14 @@ IN_PROC_BROWSER_TEST_F(ZoomBubbleBrowserTest, NonImmersiveFullscreen) {
// Entering fullscreen should close the bubble. (We enter into tab fullscreen // Entering fullscreen should close the bubble. (We enter into tab fullscreen
// here because tab fullscreen is non-immersive even on Chrome OS.) // here because tab fullscreen is non-immersive even on Chrome OS.)
{ {
// NOTIFICATION_FULLSCREEN_CHANGED is sent asynchronously. Wait for the // The fullscreen change notification is sent asynchronously. Wait for the
// notification before testing the zoom bubble visibility. // notification before testing the zoom bubble visibility.
std::unique_ptr<FullscreenNotificationObserver> waiter( FullscreenNotificationObserver waiter(browser());
new FullscreenNotificationObserver());
browser() browser()
->exclusive_access_manager() ->exclusive_access_manager()
->fullscreen_controller() ->fullscreen_controller()
->EnterFullscreenModeForTab(web_contents, GURL()); ->EnterFullscreenModeForTab(web_contents, GURL());
waiter->Wait(); waiter.Wait();
} }
ASSERT_FALSE(browser_view->immersive_mode_controller()->IsEnabled()); ASSERT_FALSE(browser_view->immersive_mode_controller()->IsEnabled());
EXPECT_FALSE(ZoomBubbleView::GetZoomBubble()); EXPECT_FALSE(ZoomBubbleView::GetZoomBubble());
...@@ -85,10 +84,9 @@ IN_PROC_BROWSER_TEST_F(ZoomBubbleBrowserTest, NonImmersiveFullscreen) { ...@@ -85,10 +84,9 @@ IN_PROC_BROWSER_TEST_F(ZoomBubbleBrowserTest, NonImmersiveFullscreen) {
// Exit fullscreen before ending the test for the sake of sanity. // Exit fullscreen before ending the test for the sake of sanity.
{ {
std::unique_ptr<FullscreenNotificationObserver> waiter( FullscreenNotificationObserver waiter(browser());
new FullscreenNotificationObserver());
chrome::ToggleFullscreenMode(browser()); chrome::ToggleFullscreenMode(browser());
waiter->Wait(); waiter.Wait();
} }
} }
...@@ -108,10 +106,9 @@ IN_PROC_BROWSER_TEST_F(ZoomBubbleBrowserTest, ImmersiveFullscreen) { ...@@ -108,10 +106,9 @@ IN_PROC_BROWSER_TEST_F(ZoomBubbleBrowserTest, ImmersiveFullscreen) {
// Enter immersive fullscreen. // Enter immersive fullscreen.
{ {
std::unique_ptr<FullscreenNotificationObserver> waiter( FullscreenNotificationObserver waiter(browser());
new FullscreenNotificationObserver());
chrome::ToggleFullscreenMode(browser()); chrome::ToggleFullscreenMode(browser());
waiter->Wait(); waiter.Wait();
} }
ASSERT_TRUE(immersive_controller->IsEnabled()); ASSERT_TRUE(immersive_controller->IsEnabled());
ASSERT_FALSE(immersive_controller->IsRevealed()); ASSERT_FALSE(immersive_controller->IsRevealed());
...@@ -151,10 +148,9 @@ IN_PROC_BROWSER_TEST_F(ZoomBubbleBrowserTest, ImmersiveFullscreen) { ...@@ -151,10 +148,9 @@ IN_PROC_BROWSER_TEST_F(ZoomBubbleBrowserTest, ImmersiveFullscreen) {
// Exit fullscreen before ending the test for the sake of sanity. // Exit fullscreen before ending the test for the sake of sanity.
{ {
std::unique_ptr<FullscreenNotificationObserver> waiter( FullscreenNotificationObserver waiter(browser());
new FullscreenNotificationObserver());
chrome::ToggleFullscreenMode(browser()); chrome::ToggleFullscreenMode(browser());
waiter->Wait(); waiter.Wait();
} }
} }
#endif // OS_CHROMEOS #endif // OS_CHROMEOS
......
...@@ -34,9 +34,9 @@ OobeWebUITest.prototype = { ...@@ -34,9 +34,9 @@ OobeWebUITest.prototype = {
/** @override */ /** @override */
testGenPreamble: function() { testGenPreamble: function() {
// OobeWebUI should run in fullscreen. // OobeWebUI should run in fullscreen.
GEN(' FullscreenNotificationObserver fullscreen_observer;'); GEN('FullscreenNotificationObserver fullscreen_observer(browser());');
GEN(' chrome::ToggleFullscreenMode(browser());'); GEN('chrome::ToggleFullscreenMode(browser());');
GEN(' fullscreen_observer.Wait();'); GEN('fullscreen_observer.Wait();');
}, },
/** @override */ /** @override */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment