Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Unified Diff: chrome/browser/ui/browser.cc

Issue 836933005: Refactor fullscreen_controller. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build break Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/browser.cc
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 6c926b9ecb866c7407bf0e3b20b6b4cdb4dcb9ec..ba8114c9220de05e37d3c8151f0ad546aa1d3fa5 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -105,6 +105,7 @@
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/chrome_select_file_policy.h"
#include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
+#include "chrome/browser/ui/exclusive_access/mouse_lock_controller.h"
#include "chrome/browser/ui/fast_unload_controller.h"
#include "chrome/browser/ui/find_bar/find_bar.h"
#include "chrome/browser/ui/find_bar/find_bar_controller.h"
@@ -445,7 +446,7 @@ Browser::Browser(const CreateParams& params)
#endif // defined(OS_WIN)
}
- fullscreen_controller_.reset(new FullscreenController(this));
+ exclusive_access_manager_.reset(new ExclusiveAccessManager(this));
// Must be initialized after window_.
// Also: surprise! a modal dialog host is not necessary to host modal dialogs
@@ -785,7 +786,8 @@ Browser::DownloadClosePreventionType Browser::OkToCloseWithInProgressDownloads(
// Browser, Tab adding/showing functions:
void Browser::WindowFullscreenStateChanged() {
- fullscreen_controller_->WindowFullscreenStateChanged();
+ exclusive_access_manager_->GetFullscreenController()
+ ->WindowFullscreenStateChanged();
command_controller_->FullscreenStateChanged();
UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TOGGLE_FULLSCREEN);
}
@@ -794,8 +796,8 @@ void Browser::WindowFullscreenStateChanged() {
// Browser, Assorted browser commands:
void Browser::ToggleFullscreenModeWithExtension(const GURL& extension_url) {
- fullscreen_controller_->
- ToggleBrowserFullscreenModeWithExtension(extension_url);
+ exclusive_access_manager_->GetFullscreenController()
+ ->ToggleBrowserFullscreenModeWithExtension(extension_url);
}
bool Browser::SupportsWindowFeature(WindowFeature feature) const {
@@ -945,7 +947,7 @@ void Browser::TabInsertedAt(WebContents* contents,
void Browser::TabClosingAt(TabStripModel* tab_strip_model,
WebContents* contents,
int index) {
- fullscreen_controller_->OnTabClosing(contents);
+ exclusive_access_manager_->OnTabClosing(contents);
SessionService* session_service =
SessionServiceFactory::GetForProfile(profile_);
if (session_service)
@@ -981,7 +983,7 @@ void Browser::TabDetachedAt(WebContents* contents, int index) {
}
void Browser::TabDeactivated(WebContents* contents) {
- fullscreen_controller_->OnTabDeactivated(contents);
+ exclusive_access_manager_->OnTabDeactivated(contents);
search_delegate_->OnTabDeactivated(contents);
SearchTabHelper::FromWebContents(contents)->OnTabDeactivated();
@@ -1009,7 +1011,7 @@ void Browser::ActiveTabChanged(WebContents* old_contents,
// is updated.
window_->OnActiveTabChanged(old_contents, new_contents, index, reason);
- fullscreen_controller_->OnTabDetachedFromView(old_contents);
+ exclusive_access_manager_->OnTabDetachedFromView(old_contents);
// Discarded tabs always get reloaded.
if (tab_strip_model_->IsTabDiscarded(index)) {
@@ -1081,7 +1083,7 @@ void Browser::TabReplacedAt(TabStripModel* tab_strip_model,
WebContents* new_contents,
int index) {
TabDetachedAtImpl(old_contents, index, DETACH_TYPE_REPLACE);
- fullscreen_controller_->OnTabClosing(old_contents);
+ exclusive_access_manager_->OnTabClosing(old_contents);
SessionService* session_service =
SessionServiceFactory::GetForProfile(profile_);
if (session_service)
@@ -1184,7 +1186,7 @@ bool Browser::PreHandleKeyboardEvent(content::WebContents* source,
// Escape exits tabbed fullscreen mode.
// TODO(koz): Write a test for this http://crbug.com/100441.
if (event.windowsKeyCode == 27 &&
- fullscreen_controller_->HandleUserPressedEscape()) {
+ exclusive_access_manager_->HandleUserPressedEscape()) {
return true;
}
return window()->PreHandleKeyboardEvent(event, is_keyboard_shortcut);
@@ -1262,7 +1264,7 @@ bool Browser::CanDragEnter(content::WebContents* source,
}
bool Browser::IsMouseLocked() const {
- return fullscreen_controller_->IsMouseLocked();
+ return exclusive_access_manager_->GetMouseLockController()->IsMouseLocked();
}
void Browser::OnWindowDidShow() {
@@ -1666,13 +1668,14 @@ bool Browser::EmbedsFullscreenWidget() const {
void Browser::ToggleFullscreenModeForTab(WebContents* web_contents,
bool enter_fullscreen) {
- fullscreen_controller_->ToggleFullscreenModeForTab(web_contents,
- enter_fullscreen);
+ exclusive_access_manager_->GetFullscreenController()
+ ->ToggleFullscreenModeForTab(web_contents, enter_fullscreen);
}
bool Browser::IsFullscreenForTabOrPending(
const WebContents* web_contents) const {
- return fullscreen_controller_->IsFullscreenForTabOrPending(web_contents);
+ return exclusive_access_manager_->GetFullscreenController()
+ ->IsFullscreenForTabOrPending(web_contents);
}
void Browser::RegisterProtocolHandler(WebContents* web_contents,
@@ -1768,13 +1771,12 @@ void Browser::FindReply(WebContents* web_contents,
void Browser::RequestToLockMouse(WebContents* web_contents,
bool user_gesture,
bool last_unlocked_by_target) {
- fullscreen_controller_->RequestToLockMouse(web_contents,
- user_gesture,
- last_unlocked_by_target);
+ exclusive_access_manager_->GetMouseLockController()->RequestToLockMouse(
+ web_contents, user_gesture, last_unlocked_by_target);
}
void Browser::LostMouseLock() {
- fullscreen_controller_->LostMouseLock();
+ exclusive_access_manager_->GetMouseLockController()->LostMouseLock();
}
void Browser::RequestMediaAccessPermission(

Powered by Google App Engine
This is Rietveld 408576698