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"
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(Browser
* browser
);
28 ~ExclusiveAccessManager();
30 FullscreenController
* fullscreen_controller() {
31 return &fullscreen_controller_
;
34 MouseLockController
* mouse_lock_controller() {
35 return &mouse_lock_controller_
;
38 ExclusiveAccessBubbleType
GetExclusiveAccessExitBubbleType() const;
39 void UpdateExclusiveAccessExitBubbleContent();
41 GURL
GetExclusiveAccessBubbleURL() const;
43 // Callbacks ////////////////////////////////////////////////////////////////
45 // Called by Browser::TabDeactivated.
46 void OnTabDeactivated(content::WebContents
* web_contents
);
48 // Called by Browser::ActiveTabChanged.
49 void OnTabDetachedFromView(content::WebContents
* web_contents
);
51 // Called by Browser::TabClosingAt.
52 void OnTabClosing(content::WebContents
* web_contents
);
54 // Called by Browser::PreHandleKeyboardEvent
55 bool HandleUserPressedEscape();
57 // Called by platform ExclusiveAccessExitBubble.
58 void OnAcceptExclusiveAccessPermission();
59 void OnDenyExclusiveAccessPermission();
62 Browser
* const browser_
;
63 FullscreenController fullscreen_controller_
;
64 MouseLockController mouse_lock_controller_
;
66 DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessManager
);
69 #endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_MANAGER_H_