Chromium Code Reviews| OLD | NEW |
|---|---|
| 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" |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 public: | 24 public: |
| 25 explicit ExclusiveAccessBubble(ExclusiveAccessManager* manager, | 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 // Time to show initial message (simplified fullscreen UI). | |
| 35 static const int kInitialDebounceTimeMs; | |
| 36 // Time to re-notify user (simplified fullscreen UI). | |
| 37 static const int kRenotifyTimeMs; | |
|
scheib
2015/08/04 19:36:28
kRenotifyTimeM -> kSnoozeNotificationsTimeMs
And c
Matt Giuca
2015/08/05 03:27:20
Done.
scheib
2015/08/05 05:24:19
Thanks. OK to leave like this, but BTW I think it'
Matt Giuca
2015/08/06 03:33:03
Done.
| |
| 34 static const int kPositionCheckHz; // How fast to check the mouse position | 38 static const int kPositionCheckHz; // How fast to check the mouse position |
| 35 static const int kSlideInRegionHeightPx; | 39 static const int kSlideInRegionHeightPx; |
| 36 // Height of region triggering | 40 // Height of region triggering |
| 37 // slide-in | 41 // slide-in |
| 38 static const int kPopupTopPx; // Space between the popup and the top | 42 static const int kPopupTopPx; // Space between the popup and the top |
| 39 // of the screen. | 43 // of the screen. |
| 40 static const int kSlideInDurationMs; // Duration of slide-in animation | 44 static const int kSlideInDurationMs; // Duration of slide-in animation |
| 41 static const int kSlideOutDurationMs; // Duration of slide-out animation | 45 static const int kSlideOutDurationMs; // Duration of slide-out animation |
| 42 | 46 |
| 43 // Returns the current desirable rect for the popup window. If | 47 // Returns the current desirable rect for the popup window. If |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 // The Manager associated with this bubble. | 92 // The Manager associated with this bubble. |
| 89 ExclusiveAccessManager* const manager_; | 93 ExclusiveAccessManager* const manager_; |
| 90 | 94 |
| 91 // The host the bubble is for, can be empty. | 95 // The host the bubble is for, can be empty. |
| 92 GURL url_; | 96 GURL url_; |
| 93 | 97 |
| 94 // The type of the bubble; controls e.g. which buttons to show. | 98 // The type of the bubble; controls e.g. which buttons to show. |
| 95 ExclusiveAccessBubbleType bubble_type_; | 99 ExclusiveAccessBubbleType bubble_type_; |
| 96 | 100 |
| 97 private: | 101 private: |
| 98 // Timer to delay before allowing the bubble to hide after it's initially | 102 // When this timer is active, prevent the bubble from hiding. This ensures it |
| 99 // shown. | 103 // will be displayed for a minimum amount of time (which can be extended by |
| 100 base::OneShotTimer<ExclusiveAccessBubble> initial_delay_; | 104 // the user moving the mouse to the top of the screen and holding it there). |
| 105 base::OneShotTimer<ExclusiveAccessBubble> hide_timeout_; | |
| 101 | 106 |
| 102 // Timer to see how long the mouse has been idle. | 107 // Timer to see how long the mouse has been idle. |
| 103 base::OneShotTimer<ExclusiveAccessBubble> idle_timeout_; | 108 base::OneShotTimer<ExclusiveAccessBubble> idle_timeout_; |
| 104 | 109 |
| 110 // When this timer has elapsed, we will aggressively notify the user about | |
|
msw
2015/08/04 18:21:51
What's aggressive about this? Remove 'aggressive'
Matt Giuca
2015/08/05 03:27:20
Done. (And renamed to suppress_notify_timeout_).
| |
| 111 // currently active exclusive access (on the next mouse/keyboard input). While | |
|
msw
2015/08/04 18:21:51
nit: no keyboard...
Matt Giuca
2015/08/05 03:27:20
Done.
scheib
2015/08/05 05:24:19
Long term we'd want keyboard too, though, right?
Matt Giuca
2015/08/06 03:33:03
Yeah. I originally had that comment there because
| |
| 112 // the timer is ticking, we do not notify unless the user mouses to the top of | |
|
scheib
2015/08/04 19:36:28
Mouse location should have no impact on notificati
Matt Giuca
2015/08/05 03:27:20
Done.
Matt Giuca
2015/08/05 03:35:08
Oh sorry, by "Done" I mean "not done" (just update
scheib
2015/08/05 05:24:19
Acknowledged. Follow patch is fine.
| |
| 113 // the screen. | |
| 114 // | |
| 115 // This has two uses: 1. a short debounce period when first entering exclusive | |
| 116 // access (so we do not immediately notify the user), and 2. a very long | |
| 117 // period after already notifying the user once, to re-notify them. | |
| 118 base::OneShotTimer<ExclusiveAccessBubble> aggressive_notify_timeout_; | |
| 119 | |
| 105 // Timer to poll the current mouse position. We can't just listen for mouse | 120 // 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 | 121 // 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 | 122 // 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. | 123 // user has moved in or out of our show/hide regions. |
| 109 base::RepeatingTimer<ExclusiveAccessBubble> mouse_position_checker_; | 124 base::RepeatingTimer<ExclusiveAccessBubble> mouse_position_checker_; |
| 110 | 125 |
| 111 // The most recently seen mouse position, in screen coordinates. Used to see | 126 // The most recently seen mouse position, in screen coordinates. Used to see |
| 112 // if the mouse has moved since our last check. | 127 // if the mouse has moved since our last check. |
| 113 gfx::Point last_mouse_pos_; | 128 gfx::Point last_mouse_pos_; |
| 114 | 129 |
| 115 DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessBubble); | 130 DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessBubble); |
| 116 }; | 131 }; |
| 117 | 132 |
| 118 #endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_BUBBLE_H_ | 133 #endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_BUBBLE_H_ |
| OLD | NEW |