1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_MANAGER_H_
6 #define CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_MANAGER_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h"
10 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
11 #include "chrome/browser/ui/exclusive_access/mouse_lock_controller.h"
13 class ExclusiveAccessContext
;
14 class FullscreenController
;
16 class MouseLockController
;
22 // This class combines the different exclusive access modes (like fullscreen and
23 // mouse lock) which are each handled by respective controller. It also updates
24 // the exit bubble to reflect the combined state.
25 class ExclusiveAccessManager
{
27 explicit ExclusiveAccessManager(
28 ExclusiveAccessContext
* exclusive_access_context
);
29 ~ExclusiveAccessManager();
31 FullscreenController
* fullscreen_controller() {
32 return &fullscreen_controller_
;
35 MouseLockController
* mouse_lock_controller() {
36 return &mouse_lock_controller_
;
39 ExclusiveAccessContext
* context() const { return exclusive_access_context_
; }
41 ExclusiveAccessBubbleType
GetExclusiveAccessExitBubbleType() const;
42 void UpdateExclusiveAccessExitBubbleContent();
44 GURL
GetExclusiveAccessBubbleURL() const;
46 static bool IsSimplifiedFullscreenUIEnabled();
48 // Callbacks ////////////////////////////////////////////////////////////////
50 // Called by Browser::TabDeactivated.
51 void OnTabDeactivated(content::WebContents
* web_contents
);
53 // Called by Browser::ActiveTabChanged.
54 void OnTabDetachedFromView(content::WebContents
* web_contents
);
56 // Called by Browser::TabClosingAt.
57 void OnTabClosing(content::WebContents
* web_contents
);
59 // Called by Browser::PreHandleKeyboardEvent
60 bool HandleUserPressedEscape();
62 // Called by platform ExclusiveAccessExitBubble.
63 void OnAcceptExclusiveAccessPermission();
64 void OnDenyExclusiveAccessPermission();
65 void ExitExclusiveAccess();
68 ExclusiveAccessContext
* const exclusive_access_context_
;
69 FullscreenController fullscreen_controller_
;
70 MouseLockController mouse_lock_controller_
;
72 DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessManager
);
75 #endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_MANAGER_H_