| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_MOUSE_LOCK_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_MOUSE_LOCK_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_MOUSE_LOCK_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_MOUSE_LOCK_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "chrome/browser/ui/exclusive_access/exclusive_access_controller_base.h" | 9 #include "chrome/browser/ui/exclusive_access/exclusive_access_controller_base.h" |
| 10 #include "components/content_settings/core/common/content_settings.h" | 10 #include "components/content_settings/core/common/content_settings.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 void ExitExclusiveAccessToPreviousState() override; | 29 void ExitExclusiveAccessToPreviousState() override; |
| 30 bool OnAcceptExclusiveAccessPermission() override; | 30 bool OnAcceptExclusiveAccessPermission() override; |
| 31 bool OnDenyExclusiveAccessPermission() override; | 31 bool OnDenyExclusiveAccessPermission() override; |
| 32 | 32 |
| 33 // Called by Browser::LostMouseLock. | 33 // Called by Browser::LostMouseLock. |
| 34 void LostMouseLock(); | 34 void LostMouseLock(); |
| 35 | 35 |
| 36 void UnlockMouse(); | 36 void UnlockMouse(); |
| 37 | 37 |
| 38 // If true, does not call into the WebContents to lock the mouse. Just assumes |
| 39 // that it works. This may be necessary when calling |
| 40 // Browser::RequestToLockMouse in tests, because the proper signal will not |
| 41 // have been passed to the RenderViewHost. |
| 42 void set_fake_mouse_lock_for_test(bool value) { |
| 43 fake_mouse_lock_for_test_ = value; |
| 44 } |
| 45 |
| 38 private: | 46 private: |
| 39 enum MouseLockState { | 47 enum MouseLockState { |
| 40 MOUSELOCK_NOT_REQUESTED, | 48 MOUSELOCK_NOT_REQUESTED, |
| 41 // The page requests to lock the mouse and the user hasn't responded to the | 49 // The page requests to lock the mouse and the user hasn't responded to the |
| 42 // request. | 50 // request. |
| 43 MOUSELOCK_REQUESTED, | 51 MOUSELOCK_REQUESTED, |
| 44 // Mouse lock has been allowed by the user. | 52 // Mouse lock has been allowed by the user. |
| 45 MOUSELOCK_ACCEPTED, | 53 MOUSELOCK_ACCEPTED, |
| 46 // Mouse lock has been silently accepted, no notification to user. | 54 // Mouse lock has been silently accepted, no notification to user. |
| 47 MOUSELOCK_ACCEPTED_SILENTLY | 55 MOUSELOCK_ACCEPTED_SILENTLY |
| 48 }; | 56 }; |
| 49 | 57 |
| 50 void NotifyMouseLockChange(); | 58 void NotifyMouseLockChange(); |
| 51 | 59 |
| 52 void ExitExclusiveAccessIfNecessary() override; | 60 void ExitExclusiveAccessIfNecessary() override; |
| 53 void NotifyTabExclusiveAccessLost() override; | 61 void NotifyTabExclusiveAccessLost() override; |
| 54 | 62 |
| 55 ContentSetting GetMouseLockSetting(const GURL& url) const; | 63 ContentSetting GetMouseLockSetting(const GURL& url) const; |
| 56 | 64 |
| 57 MouseLockState mouse_lock_state_; | 65 MouseLockState mouse_lock_state_; |
| 58 | 66 |
| 67 bool fake_mouse_lock_for_test_; |
| 68 |
| 59 DISALLOW_COPY_AND_ASSIGN(MouseLockController); | 69 DISALLOW_COPY_AND_ASSIGN(MouseLockController); |
| 60 }; | 70 }; |
| 61 | 71 |
| 62 #endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_MOUSE_LOCK_CONTROLLER_H_ | 72 #endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_MOUSE_LOCK_CONTROLLER_H_ |
| OLD | NEW |