| 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" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // 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 |
| 27 // 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 |
| 28 // screen top. | 28 // screen top. |
| 29 class FullscreenExitBubbleViews : public FullscreenExitBubble, | 29 class FullscreenExitBubbleViews : public FullscreenExitBubble, |
| 30 public content::NotificationObserver, | 30 public content::NotificationObserver, |
| 31 public views::WidgetObserver { | 31 public views::WidgetObserver { |
| 32 public: | 32 public: |
| 33 FullscreenExitBubbleViews(BrowserView* browser, | 33 FullscreenExitBubbleViews(BrowserView* browser, |
| 34 const GURL& url, | 34 const GURL& url, |
| 35 FullscreenExitBubbleType bubble_type); | 35 FullscreenExitBubbleType bubble_type); |
| 36 virtual ~FullscreenExitBubbleViews(); | 36 ~FullscreenExitBubbleViews() override; |
| 37 | 37 |
| 38 void UpdateContent(const GURL& url, FullscreenExitBubbleType bubble_type); | 38 void UpdateContent(const GURL& url, FullscreenExitBubbleType bubble_type); |
| 39 | 39 |
| 40 // Repositions |popup_| if it is visible. | 40 // Repositions |popup_| if it is visible. |
| 41 void RepositionIfVisible(); | 41 void RepositionIfVisible(); |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 class FullscreenExitView; | 44 class FullscreenExitView; |
| 45 | 45 |
| 46 enum AnimatedAttribute { | 46 enum AnimatedAttribute { |
| 47 ANIMATED_ATTRIBUTE_BOUNDS, | 47 ANIMATED_ATTRIBUTE_BOUNDS, |
| 48 ANIMATED_ATTRIBUTE_OPACITY | 48 ANIMATED_ATTRIBUTE_OPACITY |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 // Starts or stops polling the mouse location based on |popup_| and | 51 // Starts or stops polling the mouse location based on |popup_| and |
| 52 // |bubble_type_|. | 52 // |bubble_type_|. |
| 53 void UpdateMouseWatcher(); | 53 void UpdateMouseWatcher(); |
| 54 | 54 |
| 55 // Updates any state which depends on whether the user is in immersive | 55 // Updates any state which depends on whether the user is in immersive |
| 56 // fullscreen. | 56 // fullscreen. |
| 57 void UpdateForImmersiveState(); | 57 void UpdateForImmersiveState(); |
| 58 | 58 |
| 59 // Updates |popup|'s bounds given |animation_| and |animated_attribute_|. | 59 // Updates |popup|'s bounds given |animation_| and |animated_attribute_|. |
| 60 void UpdateBounds(); | 60 void UpdateBounds(); |
| 61 | 61 |
| 62 // Returns the root view containing |browser_view_|. | 62 // Returns the root view containing |browser_view_|. |
| 63 views::View* GetBrowserRootView() const; | 63 views::View* GetBrowserRootView() const; |
| 64 | 64 |
| 65 // FullScreenExitBubble overrides: | 65 // FullScreenExitBubble overrides: |
| 66 virtual void AnimationProgressed(const gfx::Animation* animation) override; | 66 void AnimationProgressed(const gfx::Animation* animation) override; |
| 67 virtual void AnimationEnded(const gfx::Animation* animation) override; | 67 void AnimationEnded(const gfx::Animation* animation) override; |
| 68 virtual gfx::Rect GetPopupRect(bool ignore_animation_state) const override; | 68 gfx::Rect GetPopupRect(bool ignore_animation_state) const override; |
| 69 virtual gfx::Point GetCursorScreenPoint() override; | 69 gfx::Point GetCursorScreenPoint() override; |
| 70 virtual bool WindowContainsPoint(gfx::Point pos) override; | 70 bool WindowContainsPoint(gfx::Point pos) override; |
| 71 virtual bool IsWindowActive() override; | 71 bool IsWindowActive() override; |
| 72 virtual void Hide() override; | 72 void Hide() override; |
| 73 virtual void Show() override; | 73 void Show() override; |
| 74 virtual bool IsAnimating() override; | 74 bool IsAnimating() override; |
| 75 virtual bool CanMouseTriggerSlideIn() const override; | 75 bool CanMouseTriggerSlideIn() const override; |
| 76 | 76 |
| 77 // content::NotificationObserver override: | 77 // content::NotificationObserver override: |
| 78 virtual void Observe(int type, | 78 void Observe(int type, |
| 79 const content::NotificationSource& source, | 79 const content::NotificationSource& source, |
| 80 const content::NotificationDetails& details) override; | 80 const content::NotificationDetails& details) override; |
| 81 | 81 |
| 82 // views::WidgetObserver override: | 82 // views::WidgetObserver override: |
| 83 virtual void OnWidgetVisibilityChanged(views::Widget* widget, | 83 void OnWidgetVisibilityChanged(views::Widget* widget, bool visible) override; |
| 84 bool visible) override; | |
| 85 | 84 |
| 86 BrowserView* browser_view_; | 85 BrowserView* browser_view_; |
| 87 | 86 |
| 88 views::Widget* popup_; | 87 views::Widget* popup_; |
| 89 | 88 |
| 90 // Animation controlling showing/hiding of the exit bubble. | 89 // Animation controlling showing/hiding of the exit bubble. |
| 91 scoped_ptr<gfx::SlideAnimation> animation_; | 90 scoped_ptr<gfx::SlideAnimation> animation_; |
| 92 | 91 |
| 93 // Attribute animated by |animation_|. | 92 // Attribute animated by |animation_|. |
| 94 AnimatedAttribute animated_attribute_; | 93 AnimatedAttribute animated_attribute_; |
| 95 | 94 |
| 96 // The contents of the popup. | 95 // The contents of the popup. |
| 97 FullscreenExitView* view_; | 96 FullscreenExitView* view_; |
| 98 | 97 |
| 99 content::NotificationRegistrar registrar_; | 98 content::NotificationRegistrar registrar_; |
| 100 | 99 |
| 101 DISALLOW_COPY_AND_ASSIGN(FullscreenExitBubbleViews); | 100 DISALLOW_COPY_AND_ASSIGN(FullscreenExitBubbleViews); |
| 102 }; | 101 }; |
| 103 | 102 |
| 104 #endif // CHROME_BROWSER_UI_VIEWS_FULLSCREEN_EXIT_BUBBLE_VIEWS_H_ | 103 #endif // CHROME_BROWSER_UI_VIEWS_FULLSCREEN_EXIT_BUBBLE_VIEWS_H_ |
| OLD | NEW |