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_VIEWS_FULLSCREEN_EXIT_BUBBLE_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_FULLSCREEN_EXIT_BUBBLE_VIEWS_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_FULLSCREEN_EXIT_BUBBLE_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_FULLSCREEN_EXIT_BUBBLE_VIEWS_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/ui/fullscreen/fullscreen_exit_bubble.h" | 10 #include "chrome/browser/ui/fullscreen/fullscreen_exit_bubble.h" |
| 11 #include "content/public/browser/notification_observer.h" |
| 12 #include "content/public/browser/notification_registrar.h" |
| 13 #include "ui/views/widget/widget_observer.h" |
11 | 14 |
| 15 class BrowserView; |
12 class GURL; | 16 class GURL; |
13 namespace ui { | 17 namespace ui { |
14 class SlideAnimation; | 18 class SlideAnimation; |
15 } | 19 } |
16 namespace views { | 20 namespace views { |
17 class View; | 21 class View; |
18 class Widget; | 22 class Widget; |
19 } | 23 } |
20 | 24 |
21 // FullscreenExitBubbleViews is responsible for showing a bubble atop the | 25 // FullscreenExitBubbleViews is responsible for showing a bubble atop the |
22 // screen in fullscreen mode, telling users how to exit and providing a click | 26 // screen in fullscreen mode, telling users how to exit and providing a click |
23 // target. The bubble auto-hides, and re-shows when the user moves to the | 27 // target. The bubble auto-hides, and re-shows when the user moves to the |
24 // screen top. | 28 // screen top. |
25 class FullscreenExitBubbleViews : public FullscreenExitBubble { | 29 class FullscreenExitBubbleViews : public FullscreenExitBubble, |
| 30 public content::NotificationObserver, |
| 31 public views::WidgetObserver { |
26 public: | 32 public: |
27 FullscreenExitBubbleViews(views::Widget* frame, | 33 FullscreenExitBubbleViews(BrowserView* browser, |
28 Browser* browser, | |
29 const GURL& url, | 34 const GURL& url, |
30 FullscreenExitBubbleType bubble_type); | 35 FullscreenExitBubbleType bubble_type); |
31 virtual ~FullscreenExitBubbleViews(); | 36 virtual ~FullscreenExitBubbleViews(); |
32 | 37 |
33 void UpdateContent(const GURL& url, FullscreenExitBubbleType bubble_type); | 38 void UpdateContent(const GURL& url, FullscreenExitBubbleType bubble_type); |
34 | 39 |
35 private: | 40 private: |
36 class FullscreenExitView; | 41 class FullscreenExitView; |
37 | 42 |
38 // FullScreenExitBubble | 43 enum AnimatedAttribute { |
| 44 ANIMATED_ATTRIBUTE_BOUNDS, |
| 45 ANIMATED_ATTRIBUTE_OPACITY |
| 46 }; |
| 47 |
| 48 // Starts or stops polling the mouse location based on |popup_| and |
| 49 // |bubble_type_|. |
| 50 void UpdateMouseWatcher(); |
| 51 |
| 52 // Updates any state which depends on whether the user is in immersive |
| 53 // fullscreen. |
| 54 void UpdateForImmersiveState(); |
| 55 |
| 56 // Updates |popup|'s bounds given |animation_| and |animated_attribute_|. |
| 57 void UpdateBounds(); |
| 58 |
| 59 // Returns the root view containing |browser_view_|. |
| 60 views::View* GetBrowserRootView() const; |
| 61 |
| 62 // FullScreenExitBubble overrides: |
39 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 63 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
40 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | 64 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
41 virtual gfx::Rect GetPopupRect(bool ignore_animation_state) const OVERRIDE; | 65 virtual gfx::Rect GetPopupRect(bool ignore_animation_state) const OVERRIDE; |
42 virtual gfx::Point GetCursorScreenPoint() OVERRIDE; | 66 virtual gfx::Point GetCursorScreenPoint() OVERRIDE; |
43 virtual bool WindowContainsPoint(gfx::Point pos) OVERRIDE; | 67 virtual bool WindowContainsPoint(gfx::Point pos) OVERRIDE; |
44 virtual bool IsWindowActive() OVERRIDE; | 68 virtual bool IsWindowActive() OVERRIDE; |
45 virtual void Hide() OVERRIDE; | 69 virtual void Hide() OVERRIDE; |
46 virtual void Show() OVERRIDE; | 70 virtual void Show() OVERRIDE; |
47 virtual bool IsAnimating() OVERRIDE; | 71 virtual bool IsAnimating() OVERRIDE; |
| 72 virtual bool CanMouseTriggerSlideIn() const OVERRIDE; |
48 | 73 |
49 void StartWatchingMouseIfNecessary(); | 74 // content::NotificationObserver override: |
| 75 virtual void Observe(int type, |
| 76 const content::NotificationSource& source, |
| 77 const content::NotificationDetails& details) OVERRIDE; |
50 | 78 |
51 // The root view containing us. | 79 // views::WidgetObserver override: |
52 views::View* root_view_; | 80 virtual void OnWidgetVisibilityChanged(views::Widget* widget, |
| 81 bool visible) OVERRIDE; |
| 82 |
| 83 BrowserView* browser_view_; |
53 | 84 |
54 views::Widget* popup_; | 85 views::Widget* popup_; |
55 | 86 |
56 // Animation controlling sliding into/out of the top of the screen. | 87 // Animation controlling showing/hiding of the exit bubble. |
57 scoped_ptr<ui::SlideAnimation> size_animation_; | 88 scoped_ptr<ui::SlideAnimation> animation_; |
| 89 |
| 90 // Attribute animated by |animation_|. |
| 91 AnimatedAttribute animated_attribute_; |
58 | 92 |
59 // The contents of the popup. | 93 // The contents of the popup. |
60 FullscreenExitView* view_; | 94 FullscreenExitView* view_; |
61 | 95 |
| 96 content::NotificationRegistrar registrar_; |
| 97 |
62 DISALLOW_COPY_AND_ASSIGN(FullscreenExitBubbleViews); | 98 DISALLOW_COPY_AND_ASSIGN(FullscreenExitBubbleViews); |
63 }; | 99 }; |
64 | 100 |
65 #endif // CHROME_BROWSER_UI_VIEWS_FULLSCREEN_EXIT_BUBBLE_VIEWS_H_ | 101 #endif // CHROME_BROWSER_UI_VIEWS_FULLSCREEN_EXIT_BUBBLE_VIEWS_H_ |
OLD | NEW |