Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Side by Side Diff: chrome/browser/ui/exclusive_access/mouse_lock_controller.h

Issue 836933005: Refactor fullscreen_controller. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync to TOT Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 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_VIEWS_WEBSITE_SETTINGS_PERMISSION_SELECTOR_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_MOUSE_LOCK_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_PERMISSION_SELECTOR_VIEW_H_ 6 #define CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_MOUSE_LOCK_CONTROLLER_H_
7 7
8 #include "base/basictypes.h" 8 #include "chrome/browser/ui/exclusive_access/exclusive_access_controller_base.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/observer_list.h"
12 #include "base/strings/string16.h"
13 #include "chrome/browser/ui/views/website_settings/permission_selector_view_obse rver.h"
14 #include "chrome/browser/ui/website_settings/permission_menu_model.h"
15 #include "chrome/browser/ui/website_settings/website_settings_ui.h"
16 #include "components/content_settings/core/common/content_settings.h" 9 #include "components/content_settings/core/common/content_settings.h"
17 #include "components/content_settings/core/common/content_settings_types.h"
18 #include "ui/views/controls/button/menu_button_listener.h"
19 #include "ui/views/view.h"
20 10
21 namespace internal { 11 // This class implements mouselock behavior.
22 class PermissionMenuButton; 12 class MouseLockController : public ExclusiveAccessControllerBase {
23 } 13 public:
14 MouseLockController(ExclusiveAccessManager* manager, Browser* browser);
15 ~MouseLockController() override;
24 16
25 namespace views { 17 bool IsMouseLocked() const;
26 class ImageView; 18 bool IsMouseLockSilentlyAccepted() const;
27 class MenuRunner; 19 bool IsMouseLockRequested() const;
28 }
29 20
30 // A custom view for selecting a permission setting for the given permission 21 void RequestToLockMouse(content::WebContents* web_contents,
31 // |type|. 22 bool user_gesture,
32 class PermissionSelectorView : public views::View { 23 bool last_unlocked_by_target);
33 public:
34 PermissionSelectorView(const GURL& url,
35 const WebsiteSettingsUI::PermissionInfo& permission);
36 24
37 void AddObserver(PermissionSelectorViewObserver* observer); 25 // Override from ExclusiveAccessControllerBase
26 bool HandleUserPressedEscape() override;
38 27
39 void PermissionChanged(const WebsiteSettingsUI::PermissionInfo& permission); 28 void ExitExclusiveAccessToPreviousState() override;
29 bool OnAcceptExclusiveAccessPermission() override;
30 bool OnDenyExclusiveAccessPermission() override;
40 31
41 protected: 32 // Called by Browser::LostMouseLock.
42 // Overridden from views::View. 33 void LostMouseLock();
43 void ChildPreferredSizeChanged(View* child) override; 34
35 void UnlockMouse();
44 36
45 private: 37 private:
46 ~PermissionSelectorView() override; 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
47 };
47 48
48 // Model for the permission's menu. 49 void NotifyMouseLockChange();
49 scoped_ptr<PermissionMenuModel> menu_model_;
50 50
51 views::ImageView* icon_; // Owned by the views hierachy. 51 void ExitExclusiveAccessIfNecessary() override;
52 internal::PermissionMenuButton* menu_button_; // Owned by the views hierachy. 52 void NotifyTabExclusiveAccessLost() override;
53 53
54 ObserverList<PermissionSelectorViewObserver, false> observer_list_; 54 ContentSetting GetMouseLockSetting(const GURL& url) const;
55 55
56 DISALLOW_COPY_AND_ASSIGN(PermissionSelectorView); 56 MouseLockState mouse_lock_state_;
57
58 DISALLOW_COPY_AND_ASSIGN(MouseLockController);
57 }; 59 };
58 60
59 #endif // CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_PERMISSION_SELECTOR_VIEW_H_ 61 #endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_MOUSE_LOCK_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698