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 // Callbacks ////////////////////////////////////////////////////////////////
48 // Called by Browser::TabDeactivated.
49 void OnTabDeactivated(content::WebContents
* web_contents
);
51 // Called by Browser::ActiveTabChanged.
52 void OnTabDetachedFromView(content::WebContents
* web_contents
);
54 // Called by Browser::TabClosingAt.
55 void OnTabClosing(content::WebContents
* web_contents
);
57 // Called by Browser::PreHandleKeyboardEvent
58 bool HandleUserPressedEscape();
60 // Called by platform ExclusiveAccessExitBubble.
61 void OnAcceptExclusiveAccessPermission();
62 void OnDenyExclusiveAccessPermission();
63 void ExitExclusiveAccess();
66 ExclusiveAccessContext
* const exclusive_access_context_
;
67 FullscreenController fullscreen_controller_
;
68 MouseLockController mouse_lock_controller_
;
70 DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessManager
);
73 #endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_MANAGER_H_