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

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

Issue 1254543002: Change exclusive access popup behaviour with simplified-fullscreen-ui. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@exclusiveaccess-remove-confirmation
Patch Set: Respond to nits. Created 5 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/ui/exclusive_access/exclusive_access_bubble.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ExclusiveAccessManager; 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 //
24 // Notification display design note: if the #simplified-fullscreen-ui flag is
25 // enabled, the bubble has the following behaviour:
26 // - Upon taking exclusive access, wait kDebounceNotificationsTimeMs, then for
27 // user input, before displaying the bubble.
28 // - The bubble is shown for kIdleTimeMs, then hides.
29 // - After a bubble has been shown, notifications are suppressed for
30 // kSnoozeNotificationsTimeMs, to avoid bothering the user. After this time
31 // has elapsed, the next user input re-displays the bubble.
23 class ExclusiveAccessBubble : public gfx::AnimationDelegate { 32 class ExclusiveAccessBubble : public gfx::AnimationDelegate {
24 public: 33 public:
25 explicit ExclusiveAccessBubble(ExclusiveAccessManager* manager, 34 explicit ExclusiveAccessBubble(ExclusiveAccessManager* manager,
26 const GURL& url, 35 const GURL& url,
27 ExclusiveAccessBubbleType bubble_type); 36 ExclusiveAccessBubbleType bubble_type);
28 ~ExclusiveAccessBubble() override; 37 ~ExclusiveAccessBubble() override;
29 38
30 protected: 39 protected:
31 static const int kPaddingPx; // Amount of padding around the link 40 static const int kPaddingPx; // Amount of padding around the link
32 static const int kInitialDelayMs; // Initial time bubble remains onscreen 41 static const int kInitialDelayMs; // Initial time bubble remains onscreen
33 static const int kIdleTimeMs; // Time before mouse idle triggers hide 42 static const int kIdleTimeMs; // Time before mouse idle triggers hide
43 // See notification display design note above.
44 static const int kDebounceNotificationsTimeMs;
45 static const int kSnoozeNotificationsTimeMs;
34 static const int kPositionCheckHz; // How fast to check the mouse position 46 static const int kPositionCheckHz; // How fast to check the mouse position
35 static const int kSlideInRegionHeightPx; 47 static const int kSlideInRegionHeightPx;
36 // Height of region triggering 48 // Height of region triggering
37 // slide-in 49 // slide-in
38 static const int kPopupTopPx; // Space between the popup and the top 50 static const int kPopupTopPx; // Space between the popup and the top
39 // of the screen. 51 // of the screen.
40 static const int kSlideInDurationMs; // Duration of slide-in animation 52 static const int kSlideInDurationMs; // Duration of slide-in animation
41 static const int kSlideOutDurationMs; // Duration of slide-out animation 53 static const int kSlideOutDurationMs; // Duration of slide-out animation
42 54
43 // Returns the current desirable rect for the popup window. If 55 // Returns the current desirable rect for the popup window. If
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // The Manager associated with this bubble. 100 // The Manager associated with this bubble.
89 ExclusiveAccessManager* const manager_; 101 ExclusiveAccessManager* const manager_;
90 102
91 // The host the bubble is for, can be empty. 103 // The host the bubble is for, can be empty.
92 GURL url_; 104 GURL url_;
93 105
94 // The type of the bubble; controls e.g. which buttons to show. 106 // The type of the bubble; controls e.g. which buttons to show.
95 ExclusiveAccessBubbleType bubble_type_; 107 ExclusiveAccessBubbleType bubble_type_;
96 108
97 private: 109 private:
98 // Timer to delay before allowing the bubble to hide after it's initially 110 // When this timer is active, prevent the bubble from hiding. This ensures it
99 // shown. 111 // will be displayed for a minimum amount of time (which can be extended by
100 base::OneShotTimer<ExclusiveAccessBubble> initial_delay_; 112 // the user moving the mouse to the top of the screen and holding it there).
113 base::OneShotTimer<ExclusiveAccessBubble> hide_timeout_;
101 114
102 // Timer to see how long the mouse has been idle. 115 // Timer to see how long the mouse has been idle.
103 base::OneShotTimer<ExclusiveAccessBubble> idle_timeout_; 116 base::OneShotTimer<ExclusiveAccessBubble> idle_timeout_;
104 117
118 // When this timer has elapsed, on the next mouse input, we will notify the
119 // user about any currently active exclusive access. This is used to enact
120 // both the initial debounce period, and the snooze period before re-notifying
121 // the user (see notification display design note above).
122 base::OneShotTimer<ExclusiveAccessBubble> suppress_notify_timeout_;
123
105 // Timer to poll the current mouse position. We can't just listen for mouse 124 // 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 125 // 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 126 // 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. 127 // user has moved in or out of our show/hide regions.
109 base::RepeatingTimer<ExclusiveAccessBubble> mouse_position_checker_; 128 base::RepeatingTimer<ExclusiveAccessBubble> mouse_position_checker_;
110 129
111 // The most recently seen mouse position, in screen coordinates. Used to see 130 // The most recently seen mouse position, in screen coordinates. Used to see
112 // if the mouse has moved since our last check. 131 // if the mouse has moved since our last check.
113 gfx::Point last_mouse_pos_; 132 gfx::Point last_mouse_pos_;
114 133
115 DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessBubble); 134 DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessBubble);
116 }; 135 };
117 136
118 #endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_BUBBLE_H_ 137 #endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_BUBBLE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/exclusive_access/exclusive_access_bubble.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698