Chromium Code Reviews| Index: chrome/browser/ui/exclusive_access/exclusive_access_bubble.cc |
| diff --git a/chrome/browser/ui/exclusive_access/exclusive_access_bubble.cc b/chrome/browser/ui/exclusive_access/exclusive_access_bubble.cc |
| index 5d9f554eec880e5b3584878a3d46513e6ef81156..dc7754bf79dc2da84df6ad090d825c2ec12af323 100644 |
| --- a/chrome/browser/ui/exclusive_access/exclusive_access_bubble.cc |
| +++ b/chrome/browser/ui/exclusive_access/exclusive_access_bubble.cc |
| @@ -25,6 +25,8 @@ const int ExclusiveAccessBubble::kPaddingPx = 15; |
| #endif |
| const int ExclusiveAccessBubble::kInitialDelayMs = 3800; |
| const int ExclusiveAccessBubble::kIdleTimeMs = 2300; |
| +const int ExclusiveAccessBubble::kInitialDebounceTimeMs = 500; |
|
msw
2015/08/04 18:21:50
nit: rename this |kInitialNotifyTimeMs| to match |
Matt Giuca
2015/08/05 03:27:20
Since scheib told me to rename kRenotifyTimeMs, I'
|
| +const int ExclusiveAccessBubble::kRenotifyTimeMs = 60000; // 1 minute. |
| const int ExclusiveAccessBubble::kPositionCheckHz = 10; |
| const int ExclusiveAccessBubble::kSlideInRegionHeightPx = 4; |
| const int ExclusiveAccessBubble::kSlideInDurationMs = 350; |
| @@ -37,6 +39,14 @@ ExclusiveAccessBubble::ExclusiveAccessBubble( |
| ExclusiveAccessBubbleType bubble_type) |
| : manager_(manager), url_(url), bubble_type_(bubble_type) { |
| DCHECK_NE(EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE, bubble_type_); |
| + |
| + // Wait for a short time to let the user stop moving the mouse. After this |
| + // time elapses, we will notify the user upon the next mouse/keyboard input. |
|
msw
2015/08/04 18:21:51
nit: no keyboard...
Matt Giuca
2015/08/05 03:27:20
Done.
|
| + if (ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) { |
| + aggressive_notify_timeout_.Start( |
| + FROM_HERE, base::TimeDelta::FromMilliseconds(kInitialDebounceTimeMs), |
| + this, &ExclusiveAccessBubble::CheckMousePosition); |
| + } |
| } |
| ExclusiveAccessBubble::~ExclusiveAccessBubble() { |
| @@ -44,9 +54,11 @@ ExclusiveAccessBubble::~ExclusiveAccessBubble() { |
| void ExclusiveAccessBubble::StartWatchingMouse() { |
| // Start the initial delay timer and begin watching the mouse. |
|
msw
2015/08/04 18:21:50
nit: update comment ('initial delay')?
Matt Giuca
2015/08/05 03:27:19
I think this comment is OK (we are using hide_time
|
| - initial_delay_.Start(FROM_HERE, |
| - base::TimeDelta::FromMilliseconds(kInitialDelayMs), this, |
| - &ExclusiveAccessBubble::CheckMousePosition); |
| + if (!ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) { |
| + hide_timeout_.Start(FROM_HERE, |
| + base::TimeDelta::FromMilliseconds(kInitialDelayMs), |
| + this, &ExclusiveAccessBubble::CheckMousePosition); |
| + } |
| gfx::Point cursor_pos = GetCursorScreenPoint(); |
| last_mouse_pos_ = cursor_pos; |
| mouse_position_checker_.Start( |
| @@ -55,7 +67,7 @@ void ExclusiveAccessBubble::StartWatchingMouse() { |
| } |
| void ExclusiveAccessBubble::StopWatchingMouse() { |
| - initial_delay_.Stop(); |
| + hide_timeout_.Stop(); |
| idle_timeout_.Stop(); |
| mouse_position_checker_.Stop(); |
| } |
| @@ -94,6 +106,29 @@ void ExclusiveAccessBubble::CheckMousePosition() { |
| idle_timeout_.Start(FROM_HERE, |
| base::TimeDelta::FromMilliseconds(kIdleTimeMs), this, |
| &ExclusiveAccessBubble::CheckMousePosition); |
| + |
| + if (ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) { |
| + // If the aggressive notification timer has elapsed, show the notification |
| + // regardless of where the mouse is on the screen. |
| + if (!aggressive_notify_timeout_.IsRunning()) { |
| + Show(); |
| + // Do not allow the notification to hide for a few seconds. |
| + hide_timeout_.Start(FROM_HERE, |
| + base::TimeDelta::FromMilliseconds(kIdleTimeMs), |
| + this, &ExclusiveAccessBubble::CheckMousePosition); |
| + // Do not aggressively show the notification again until a long time has |
|
msw
2015/08/04 18:21:50
nit: remove 'aggressively', maybe rephrase to some
Matt Giuca
2015/08/05 03:27:19
Done.
|
| + // elapsed. |
| + aggressive_notify_timeout_.Start( |
| + FROM_HERE, base::TimeDelta::FromMilliseconds(kRenotifyTimeMs), this, |
| + &ExclusiveAccessBubble::CheckMousePosition); |
| + return; |
| + } else { |
| + // The timer has not elapsed, but the user moved the mouse. Reset the |
| + // timer. (We only want to re-show the message after a period of |
| + // inactivity.) |
| + aggressive_notify_timeout_.Reset(); |
| + } |
| + } |
| } |
| last_mouse_pos_ = cursor_pos; |
| @@ -101,7 +136,7 @@ void ExclusiveAccessBubble::CheckMousePosition() { |
| (cursor_pos.y() >= GetPopupRect(true).bottom()) || |
| !idle_timeout_.IsRunning()) { |
| // The cursor is offscreen, in the slide-out region, or idle. |
| - if (!initial_delay_.IsRunning()) { |
| + if (!hide_timeout_.IsRunning()) { |
| Hide(); |
| } |
| } else if (cursor_pos.y() < kSlideInRegionHeightPx && |