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

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: Fix build break 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 explicit MouseLockController(ExclusiveAccessManager* manager,
miu 2015/01/16 22:17:39 no explicit needed for 2-arg ctor
Sriram 2015/01/21 01:38:57 Done.
15 Browser* browser);
16 ~MouseLockController() override;
24 17
25 namespace views { 18 bool IsMouseLocked() const;
26 class ImageView; 19 bool IsMouseLockSilentlyAccepted() const;
27 class MenuRunner; 20 bool IsMouseLockRequested() const;
28 }
29 21
30 // A custom view for selecting a permission setting for the given permission 22 void RequestToLockMouse(content::WebContents* web_contents,
31 // |type|. 23 bool user_gesture,
32 class PermissionSelectorView : public views::View { 24 bool last_unlocked_by_target);
33 public:
34 PermissionSelectorView(const GURL& url,
35 const WebsiteSettingsUI::PermissionInfo& permission);
36 25
37 void AddObserver(PermissionSelectorViewObserver* observer); 26 // Override from ExclusiveAccessControllerBase
27 bool HandleUserPressedEscape() override;
38 28
39 void PermissionChanged(const WebsiteSettingsUI::PermissionInfo& permission); 29 void ExitExclusiveAccessToPreviousState() override;
30 bool OnAcceptExclusiveAccessPermission() override;
31 bool OnDenyExclusiveAccessPermission() override;
40 32
41 protected: 33 // Called by Browser::LostMouseLock.
42 // Overridden from views::View. 34 void LostMouseLock();
43 void ChildPreferredSizeChanged(View* child) override; 35
36 void UnlockMouse();
44 37
45 private: 38 private:
46 ~PermissionSelectorView() override; 39 enum MouseLockState {
40 MOUSELOCK_NOT_REQUESTED,
41 // The page requests to lock the mouse and the user hasn't responded to the
42 // request.
43 MOUSELOCK_REQUESTED,
44 // Mouse lock has been allowed by the user.
45 MOUSELOCK_ACCEPTED,
46 // Mouse lock has been silently accepted, no notification to user.
47 MOUSELOCK_ACCEPTED_SILENTLY
48 };
47 49
48 // Model for the permission's menu. 50 void NotifyMouseLockChange();
49 scoped_ptr<PermissionMenuModel> menu_model_;
50 51
51 views::ImageView* icon_; // Owned by the views hierachy. 52 void ExitExclusiveAccessIfNecessary() override;
52 internal::PermissionMenuButton* menu_button_; // Owned by the views hierachy. 53 void NotifyTabOfExclusiveAccessChange() override;
53 54
54 ObserverList<PermissionSelectorViewObserver, false> observer_list_; 55 ContentSetting GetMouseLockSetting(const GURL& url) const;
55 56
56 DISALLOW_COPY_AND_ASSIGN(PermissionSelectorView); 57 MouseLockState mouse_lock_state_;
58
59 DISALLOW_COPY_AND_ASSIGN(MouseLockController);
57 }; 60 };
58 61
59 #endif // CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_PERMISSION_SELECTOR_VIEW_H_ 62 #endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_MOUSE_LOCK_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698