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

Side by Side Diff: chrome/browser/ui/fullscreen_exit_bubble.h

Issue 7740044: Implement fullscreen info bubble on Win and Mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win work Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_FULLSCREEN_EXIT_BUBBLE_H_ 5 #ifndef CHROME_BROWSER_UI_FULLSCREEN_EXIT_BUBBLE_H_
6 #define CHROME_BROWSER_UI_FULLSCREEN_EXIT_BUBBLE_H_ 6 #define CHROME_BROWSER_UI_FULLSCREEN_EXIT_BUBBLE_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/timer.h" 10 #include "base/timer.h"
11 #include "chrome/browser/command_updater.h" 11 #include "chrome/browser/command_updater.h"
12 #include "googleurl/src/gurl.h"
12 #include "ui/base/animation/animation_delegate.h" 13 #include "ui/base/animation/animation_delegate.h"
13 #include "ui/gfx/point.h" 14 #include "ui/gfx/point.h"
14 15
16 class Browser;
17
15 namespace ui { 18 namespace ui {
16 class SlideAnimation; 19 class SlideAnimation;
17 } 20 }
18 21
19 namespace gfx { 22 namespace gfx {
20 class Rect; 23 class Rect;
21 } 24 }
22 25
23 class FullscreenExitBubble : public ui::AnimationDelegate { 26 class FullscreenExitBubble : public ui::AnimationDelegate {
24 public: 27 public:
25 explicit FullscreenExitBubble( 28 explicit FullscreenExitBubble(Browser* browser);
26 CommandUpdater::CommandUpdaterDelegate* delegate);
27 virtual ~FullscreenExitBubble(); 29 virtual ~FullscreenExitBubble();
28 30
29 protected: 31 protected:
30 static const double kOpacity; // Opacity of the bubble, 0.0 - 1.0 32 static const double kOpacity; // Opacity of the bubble, 0.0 - 1.0
31 static const int kPaddingPx; // Amount of padding around the link 33 static const int kPaddingPx; // Amount of padding around the link
32 static const int kInitialDelayMs; // Initial time bubble remains onscreen 34 static const int kInitialDelayMs; // Initial time bubble remains onscreen
33 static const int kIdleTimeMs; // Time before mouse idle triggers hide 35 static const int kIdleTimeMs; // Time before mouse idle triggers hide
34 static const int kPositionCheckHz; // How fast to check the mouse position 36 static const int kPositionCheckHz; // How fast to check the mouse position
35 static const int kSlideInRegionHeightPx; 37 static const int kSlideInRegionHeightPx;
36 // Height of region triggering slide-in 38 // Height of region triggering slide-in
(...skipping 22 matching lines...) Expand all
59 virtual bool IsAnimating() = 0; 61 virtual bool IsAnimating() = 0;
60 62
61 // Called repeatedly to get the current mouse position and animate the bubble 63 // Called repeatedly to get the current mouse position and animate the bubble
62 // on or off the screen as appropriate. 64 // on or off the screen as appropriate.
63 void CheckMousePosition(); 65 void CheckMousePosition();
64 66
65 void StartWatchingMouse(); 67 void StartWatchingMouse();
66 68
67 void ToggleFullscreen(); 69 void ToggleFullscreen();
68 70
71 void AcceptFullscreen(const GURL& url);
72
73 void CancelFullscreen();
74
75 // The browser this bubble is in.
76 Browser* browser_;
77
69 private: 78 private:
70 // Someone who can toggle fullscreen mode on and off when the user requests
71 // it.
72 CommandUpdater::CommandUpdaterDelegate* delegate_;
73
74 // Timer to delay before allowing the bubble to hide after it's initially 79 // Timer to delay before allowing the bubble to hide after it's initially
75 // shown. 80 // shown.
76 base::OneShotTimer<FullscreenExitBubble> initial_delay_; 81 base::OneShotTimer<FullscreenExitBubble> initial_delay_;
77 82
78 // Timer to see how long the mouse has been idle. 83 // Timer to see how long the mouse has been idle.
79 base::OneShotTimer<FullscreenExitBubble> idle_timeout_; 84 base::OneShotTimer<FullscreenExitBubble> idle_timeout_;
80 85
81 // Timer to poll the current mouse position. We can't just listen for mouse 86 // Timer to poll the current mouse position. We can't just listen for mouse
82 // events without putting a non-empty HWND onscreen (or hooking Windows, which 87 // events without putting a non-empty HWND onscreen (or hooking Windows, which
83 // has other problems), so instead we run a low-frequency poller to see if the 88 // has other problems), so instead we run a low-frequency poller to see if the
84 // user has moved in or out of our show/hide regions. 89 // user has moved in or out of our show/hide regions.
85 base::RepeatingTimer<FullscreenExitBubble> mouse_position_checker_; 90 base::RepeatingTimer<FullscreenExitBubble> mouse_position_checker_;
86 91
87 // The most recently seen mouse position, in screen coordinates. Used to see 92 // The most recently seen mouse position, in screen coordinates. Used to see
88 // if the mouse has moved since our last check. 93 // if the mouse has moved since our last check.
89 gfx::Point last_mouse_pos_; 94 gfx::Point last_mouse_pos_;
90 }; 95 };
91 96
92 #endif // CHROME_BROWSER_UI_FULLSCREEN_EXIT_BUBBLE_H_ 97 #endif // CHROME_BROWSER_UI_FULLSCREEN_EXIT_BUBBLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698