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