summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/fullscreen_exit_bubble.h
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-20 16:47:46 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-20 16:47:46 +0000
commitfcdc0700d90834cd669059b639b49442fa35b80d (patch)
treee7b659b31b88b81ba4dd00a2f4c87893e1e8621e /chrome/browser/views/fullscreen_exit_bubble.h
parent07214a8e5f5b2c3aa5aa55d6c24e67f2e829a60a (diff)
downloadchromium_src-fcdc0700d90834cd669059b639b49442fa35b80d.zip
chromium_src-fcdc0700d90834cd669059b639b49442fa35b80d.tar.gz
chromium_src-fcdc0700d90834cd669059b639b49442fa35b80d.tar.bz2
Hide the Fullscreen exit bubble if the mouse goes idle. It took a depressing amount of time for me to think my way through this algorithm :(
Along the way I added an operator=() to convert from POINT to gfx::Point() since doing explicit temp conversion for a case like this annoys me. BUG=10568 Review URL: http://codereview.chromium.org/67265 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14031 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/fullscreen_exit_bubble.h')
-rw-r--r--chrome/browser/views/fullscreen_exit_bubble.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/chrome/browser/views/fullscreen_exit_bubble.h b/chrome/browser/views/fullscreen_exit_bubble.h
index b5e6b1e..7e354bd 100644
--- a/chrome/browser/views/fullscreen_exit_bubble.h
+++ b/chrome/browser/views/fullscreen_exit_bubble.h
@@ -29,6 +29,7 @@ class FullscreenExitBubble : public views::LinkController,
static const double kOpacity; // Opacity of the bubble, 0.0 - 1.0
static const int kInitialDelayMs; // Initial time bubble remains onscreen
+ static const int kIdleTimeMs; // Time before mouse idle triggers hide
static const int kPositionCheckHz; // How fast to check the mouse position
static const int kSlideInRegionHeightPx;
// Height of region triggering slide-in
@@ -42,13 +43,14 @@ class FullscreenExitBubble : public views::LinkController,
virtual void AnimationProgressed(const Animation* animation);
virtual void AnimationEnded(const Animation* animation);
- // Called after the initial delay to start checking the mouse position.
- void AfterInitialDelay();
-
// Called repeatedly to get the current mouse position and animate the bubble
// on or off the screen as appropriate.
void CheckMousePosition();
+ // Hides the bubble. This is a separate function so it can be called by a
+ // timer.
+ void Hide();
+
// Returns the current desirable rect for the popup window. If
// |ignore_animation_state| is true this returns the rect assuming the popup
// is fully onscreen.
@@ -71,15 +73,23 @@ class FullscreenExitBubble : public views::LinkController,
// Animation controlling sliding into/out of the top of the screen.
scoped_ptr<SlideAnimation> size_animation_;
- // Timer to delay before starting the mouse checking/bubble hiding code.
+ // Timer to delay before allowing the bubble to hide after it's initially
+ // shown.
base::OneShotTimer<FullscreenExitBubble> initial_delay_;
+ // Timer to see how long the mouse has been idle.
+ base::OneShotTimer<FullscreenExitBubble> idle_timeout_;
+
// Timer to poll the current mouse position. We can't just listen for mouse
// events without putting a non-empty HWND onscreen (or hooking Windows, which
// has other problems), so instead we run a low-frequency poller to see if the
// user has moved in or out of our show/hide regions.
base::RepeatingTimer<FullscreenExitBubble> mouse_position_checker_;
+ // The most recently seen mouse position, in screen coordinates. Used to see
+ // if the mouse has moved since our last check.
+ gfx::Point last_mouse_pos_;
+
DISALLOW_COPY_AND_ASSIGN(FullscreenExitBubble);
};