| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_VIEWS_FULLSCREEN_EXIT_BUBBLE_H__ | 5 #ifndef CHROME_BROWSER_VIEWS_FULLSCREEN_EXIT_BUBBLE_H__ |
| 6 #define CHROME_BROWSER_VIEWS_FULLSCREEN_EXIT_BUBBLE_H__ | 6 #define CHROME_BROWSER_VIEWS_FULLSCREEN_EXIT_BUBBLE_H__ |
| 7 | 7 |
| 8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
| 9 #include "chrome/browser/command_updater.h" | 9 #include "chrome/browser/command_updater.h" |
| 10 #include "chrome/common/slide_animation.h" | 10 #include "chrome/common/slide_animation.h" |
| 11 #include "chrome/views/link.h" | 11 #include "chrome/views/link.h" |
| 12 #include "chrome/views/widget_win.h" | 12 #include "chrome/views/widget_win.h" |
| 13 | 13 |
| 14 // FullscreenExitBubble is responsible for showing a bubble atop the screen in | 14 // FullscreenExitBubble is responsible for showing a bubble atop the screen in |
| 15 // fullscreen mode, telling users how to exit and providing a click target. | 15 // fullscreen mode, telling users how to exit and providing a click target. |
| 16 // The bubble auto-hides, and re-shows when the user moves to the screen top. | 16 // The bubble auto-hides, and re-shows when the user moves to the screen top. |
| 17 | 17 |
| 18 class FullscreenExitBubble : public views::LinkController, | 18 class FullscreenExitBubble : public views::LinkController, |
| 19 public AnimationDelegate { | 19 public AnimationDelegate { |
| 20 public: | 20 public: |
| 21 explicit FullscreenExitBubble( | 21 explicit FullscreenExitBubble( |
| 22 views::Widget* frame, | 22 views::Widget* frame, |
| 23 CommandUpdater::CommandUpdaterDelegate* delegate); | 23 CommandUpdater::CommandUpdaterDelegate* delegate); |
| 24 virtual ~FullscreenExitBubble(); | 24 virtual ~FullscreenExitBubble(); |
| 25 | 25 |
| 26 private: | 26 private: |
| 27 class FullscreenExitView; | 27 class FullscreenExitView; |
| 28 class FullscreenExitPopup; |
| 28 | 29 |
| 29 static const double kOpacity; // Opacity of the bubble, 0.0 - 1.0 | 30 static const double kOpacity; // Opacity of the bubble, 0.0 - 1.0 |
| 30 static const int kInitialDelayMs; // Initial time bubble remains onscreen | 31 static const int kInitialDelayMs; // Initial time bubble remains onscreen |
| 31 static const int kPositionCheckHz; // How fast to check the mouse position | 32 static const int kPositionCheckHz; // How fast to check the mouse position |
| 32 static const int kSlideInRegionHeightPx; | 33 static const int kSlideInRegionHeightPx; |
| 33 // Height of region triggering slide-in | 34 // Height of region triggering slide-in |
| 34 static const int kSlideInDurationMs; // Duration of slide-in animation | 35 static const int kSlideInDurationMs; // Duration of slide-in animation |
| 35 static const int kSlideOutDurationMs; // Duration of slide-out animation | 36 static const int kSlideOutDurationMs; // Duration of slide-out animation |
| 36 | 37 |
| 37 // views::LinkController | 38 // views::LinkController |
| (...skipping 15 matching lines...) Expand all Loading... |
| 53 // is fully onscreen. | 54 // is fully onscreen. |
| 54 gfx::Rect GetPopupRect(bool ignore_animation_state) const; | 55 gfx::Rect GetPopupRect(bool ignore_animation_state) const; |
| 55 | 56 |
| 56 // The root view containing us. | 57 // The root view containing us. |
| 57 views::View* root_view_; | 58 views::View* root_view_; |
| 58 | 59 |
| 59 // Someone who can toggle fullscreen mode on and off when the user requests | 60 // Someone who can toggle fullscreen mode on and off when the user requests |
| 60 // it. | 61 // it. |
| 61 CommandUpdater::CommandUpdaterDelegate* delegate_; | 62 CommandUpdater::CommandUpdaterDelegate* delegate_; |
| 62 | 63 |
| 63 // We use an HWND for the popup so that it may float above any plugins in the | 64 // The popup itself, which is a slightly modified WidgetWin. We need to use |
| 64 // page. | 65 // a WidgetWin (and thus an HWND) to make the popup float over other HWNDs. |
| 65 views::WidgetWin* popup_; | 66 FullscreenExitPopup* popup_; |
| 66 | 67 |
| 67 // The contents of the popup. | 68 // The contents of the popup. |
| 68 FullscreenExitView* view_; | 69 FullscreenExitView* view_; |
| 69 | 70 |
| 70 // Animation controlling sliding into/out of the top of the screen. | 71 // Animation controlling sliding into/out of the top of the screen. |
| 71 scoped_ptr<SlideAnimation> size_animation_; | 72 scoped_ptr<SlideAnimation> size_animation_; |
| 72 | 73 |
| 73 // Timer to delay before starting the mouse checking/bubble hiding code. | 74 // Timer to delay before starting the mouse checking/bubble hiding code. |
| 74 base::OneShotTimer<FullscreenExitBubble> initial_delay_; | 75 base::OneShotTimer<FullscreenExitBubble> initial_delay_; |
| 75 | 76 |
| 76 // Timer to poll the current mouse position. We can't just listen for mouse | 77 // Timer to poll the current mouse position. We can't just listen for mouse |
| 77 // events without putting a non-empty HWND onscreen (or hooking Windows, which | 78 // events without putting a non-empty HWND onscreen (or hooking Windows, which |
| 78 // has other problems), so instead we run a low-frequency poller to see if the | 79 // has other problems), so instead we run a low-frequency poller to see if the |
| 79 // user has moved in or out of our show/hide regions. | 80 // user has moved in or out of our show/hide regions. |
| 80 base::RepeatingTimer<FullscreenExitBubble> mouse_position_checker_; | 81 base::RepeatingTimer<FullscreenExitBubble> mouse_position_checker_; |
| 81 | 82 |
| 82 DISALLOW_COPY_AND_ASSIGN(FullscreenExitBubble); | 83 DISALLOW_COPY_AND_ASSIGN(FullscreenExitBubble); |
| 83 }; | 84 }; |
| 84 | 85 |
| 85 #endif // CHROME_BROWSER_VIEWS_FULLSCREEN_EXIT_BUBBLE_H__ | 86 #endif // CHROME_BROWSER_VIEWS_FULLSCREEN_EXIT_BUBBLE_H__ |
| OLD | NEW |