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

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

Issue 877413004: Refactor away the Browser* dependency in exclusive_access (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove Browser* dependency from ExclusiveAccess* in Cocoa. Created 5 years, 10 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) 2012 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_EXCLUSIVE_ACCESS_BUBBLE_H_ 5 #ifndef CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_BUBBLE_H_
6 #define CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_BUBBLE_H_ 6 #define CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_BUBBLE_H_
7 7
8 #include "base/timer/timer.h" 8 #include "base/timer/timer.h"
9 #include "chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h" 9 #include "chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h"
10 #include "ui/gfx/animation/animation_delegate.h" 10 #include "ui/gfx/animation/animation_delegate.h"
11 #include "ui/gfx/geometry/point.h" 11 #include "ui/gfx/geometry/point.h"
12 #include "url/gurl.h" 12 #include "url/gurl.h"
13 13
14 class Browser; 14 class ExclusiveAccessManager;
15 15
16 namespace gfx { 16 namespace gfx {
17 class Rect; 17 class Rect;
18 } 18 }
19 19
20 // Bubble that informs the user when an exclusive access state is in effect and 20 // Bubble that informs the user when an exclusive access state is in effect and
21 // as to how to exit out of the state. Currently there are two exclusive access 21 // as to how to exit out of the state. Currently there are two exclusive access
22 // state, namely fullscreen and mouse lock. 22 // state, namely fullscreen and mouse lock.
23 class ExclusiveAccessBubble : public gfx::AnimationDelegate { 23 class ExclusiveAccessBubble : public gfx::AnimationDelegate {
24 public: 24 public:
25 explicit ExclusiveAccessBubble(Browser* browser, 25 explicit ExclusiveAccessBubble(ExclusiveAccessManager* manager,
26 const GURL& url, 26 const GURL& url,
27 ExclusiveAccessBubbleType bubble_type); 27 ExclusiveAccessBubbleType bubble_type);
28 ~ExclusiveAccessBubble() override; 28 ~ExclusiveAccessBubble() override;
29 29
30 protected: 30 protected:
31 static const int kPaddingPx; // Amount of padding around the link 31 static const int kPaddingPx; // Amount of padding around the link
32 static const int kInitialDelayMs; // Initial time bubble remains onscreen 32 static const int kInitialDelayMs; // Initial time bubble remains onscreen
33 static const int kIdleTimeMs; // Time before mouse idle triggers hide 33 static const int kIdleTimeMs; // Time before mouse idle triggers hide
34 static const int kPositionCheckHz; // How fast to check the mouse position 34 static const int kPositionCheckHz; // How fast to check the mouse position
35 static const int kSlideInRegionHeightPx; 35 static const int kSlideInRegionHeightPx;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 void Cancel(); 78 void Cancel();
79 79
80 // The following strings may change according to the content type and URL. 80 // The following strings may change according to the content type and URL.
81 base::string16 GetCurrentMessageText() const; 81 base::string16 GetCurrentMessageText() const;
82 base::string16 GetCurrentDenyButtonText() const; 82 base::string16 GetCurrentDenyButtonText() const;
83 83
84 // The following strings never change. 84 // The following strings never change.
85 base::string16 GetAllowButtonText() const; 85 base::string16 GetAllowButtonText() const;
86 base::string16 GetInstructionText() const; 86 base::string16 GetInstructionText() const;
87 87
88 // The browser this bubble is in. 88 // The Manager associated with this bubble.
89 Browser* browser_; 89 ExclusiveAccessManager* manager_;
90 90
91 // The host the bubble is for, can be empty. 91 // The host the bubble is for, can be empty.
92 GURL url_; 92 GURL url_;
93 93
94 // The type of the bubble; controls e.g. which buttons to show. 94 // The type of the bubble; controls e.g. which buttons to show.
95 ExclusiveAccessBubbleType bubble_type_; 95 ExclusiveAccessBubbleType bubble_type_;
96 96
97 private: 97 private:
98 // Timer to delay before allowing the bubble to hide after it's initially 98 // Timer to delay before allowing the bubble to hide after it's initially
99 // shown. 99 // shown.
100 base::OneShotTimer<ExclusiveAccessBubble> initial_delay_; 100 base::OneShotTimer<ExclusiveAccessBubble> initial_delay_;
101 101
102 // Timer to see how long the mouse has been idle. 102 // Timer to see how long the mouse has been idle.
103 base::OneShotTimer<ExclusiveAccessBubble> idle_timeout_; 103 base::OneShotTimer<ExclusiveAccessBubble> idle_timeout_;
104 104
105 // Timer to poll the current mouse position. We can't just listen for mouse 105 // Timer to poll the current mouse position. We can't just listen for mouse
106 // events without putting a non-empty HWND onscreen (or hooking Windows, which 106 // events without putting a non-empty HWND onscreen (or hooking Windows, which
107 // has other problems), so instead we run a low-frequency poller to see if the 107 // has other problems), so instead we run a low-frequency poller to see if the
108 // user has moved in or out of our show/hide regions. 108 // user has moved in or out of our show/hide regions.
109 base::RepeatingTimer<ExclusiveAccessBubble> mouse_position_checker_; 109 base::RepeatingTimer<ExclusiveAccessBubble> mouse_position_checker_;
110 110
111 // The most recently seen mouse position, in screen coordinates. Used to see 111 // The most recently seen mouse position, in screen coordinates. Used to see
112 // if the mouse has moved since our last check. 112 // if the mouse has moved since our last check.
113 gfx::Point last_mouse_pos_; 113 gfx::Point last_mouse_pos_;
114 114
115 DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessBubble); 115 DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessBubble);
116 }; 116 };
117 117
118 #endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_BUBBLE_H_ 118 #endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_BUBBLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698