Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / ui / exclusive_access / mouse_lock_controller.h
blob43c89f217d590c0fdd35f98ab707f1f6f93b4bbc
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_MOUSE_LOCK_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_MOUSE_LOCK_CONTROLLER_H_
8 #include "chrome/browser/ui/exclusive_access/exclusive_access_controller_base.h"
9 #include "components/content_settings/core/common/content_settings.h"
11 // This class implements mouselock behavior.
12 class MouseLockController : public ExclusiveAccessControllerBase {
13 public:
14 explicit MouseLockController(ExclusiveAccessManager* manager);
15 ~MouseLockController() override;
17 bool IsMouseLocked() const;
18 bool IsMouseLockSilentlyAccepted() const;
19 bool IsMouseLockRequested() const;
21 void RequestToLockMouse(content::WebContents* web_contents,
22 bool user_gesture,
23 bool last_unlocked_by_target);
25 // Override from ExclusiveAccessControllerBase
26 bool HandleUserPressedEscape() override;
28 void ExitExclusiveAccessToPreviousState() override;
29 bool OnAcceptExclusiveAccessPermission() override;
30 bool OnDenyExclusiveAccessPermission() override;
32 // Called by Browser::LostMouseLock.
33 void LostMouseLock();
35 void UnlockMouse();
37 private:
38 enum MouseLockState {
39 MOUSELOCK_NOT_REQUESTED,
40 // The page requests to lock the mouse and the user hasn't responded to the
41 // request.
42 MOUSELOCK_REQUESTED,
43 // Mouse lock has been allowed by the user.
44 MOUSELOCK_ACCEPTED,
45 // Mouse lock has been silently accepted, no notification to user.
46 MOUSELOCK_ACCEPTED_SILENTLY
49 void NotifyMouseLockChange();
51 void ExitExclusiveAccessIfNecessary() override;
52 void NotifyTabExclusiveAccessLost() override;
54 ContentSetting GetMouseLockSetting(const GURL& url) const;
56 MouseLockState mouse_lock_state_;
58 DISALLOW_COPY_AND_ASSIGN(MouseLockController);
61 #endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_MOUSE_LOCK_CONTROLLER_H_