| 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_EXCLUSIVE_ACCESS_BUBBLE_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_EXCLUSIVE_ACCESS_BUBBLE_VIEWS_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_EXCLUSIVE_ACCESS_BUBBLE_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_EXCLUSIVE_ACCESS_BUBBLE_VIEWS_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "chrome/browser/ui/exclusive_access/exclusive_access_bubble.h" | 12 #include "chrome/browser/ui/exclusive_access/exclusive_access_bubble.h" |
| 13 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
| 14 #include "content/public/browser/notification_registrar.h" | 14 #include "content/public/browser/notification_registrar.h" |
| 15 #include "ui/views/controls/link_listener.h" |
| 15 #include "ui/views/widget/widget_observer.h" | 16 #include "ui/views/widget/widget_observer.h" |
| 16 | 17 |
| 17 class ExclusiveAccessBubbleViewsContext; | 18 class ExclusiveAccessBubbleViewsContext; |
| 18 class GURL; | 19 class GURL; |
| 19 namespace gfx { | 20 namespace gfx { |
| 20 class SlideAnimation; | 21 class SlideAnimation; |
| 21 } | 22 } |
| 22 namespace views { | 23 namespace views { |
| 23 class View; | 24 class View; |
| 24 class Widget; | 25 class Widget; |
| 25 } | 26 } |
| 26 | 27 |
| 28 class SubtleNotificationView; |
| 29 |
| 27 // ExclusiveAccessBubbleViews is responsible for showing a bubble atop the | 30 // ExclusiveAccessBubbleViews is responsible for showing a bubble atop the |
| 28 // screen in fullscreen/mouse lock mode, telling users how to exit and providing | 31 // screen in fullscreen/mouse lock mode, telling users how to exit and providing |
| 29 // a click target. The bubble auto-hides, and re-shows when the user moves to | 32 // a click target. The bubble auto-hides, and re-shows when the user moves to |
| 30 // the screen top. | 33 // the screen top. |
| 31 class ExclusiveAccessBubbleViews : public ExclusiveAccessBubble, | 34 class ExclusiveAccessBubbleViews : public ExclusiveAccessBubble, |
| 32 public content::NotificationObserver, | 35 public content::NotificationObserver, |
| 33 public views::WidgetObserver { | 36 public views::WidgetObserver, |
| 37 public views::LinkListener { |
| 34 public: | 38 public: |
| 35 ExclusiveAccessBubbleViews(ExclusiveAccessBubbleViewsContext* context, | 39 ExclusiveAccessBubbleViews(ExclusiveAccessBubbleViewsContext* context, |
| 36 const GURL& url, | 40 const GURL& url, |
| 37 ExclusiveAccessBubbleType bubble_type); | 41 ExclusiveAccessBubbleType bubble_type); |
| 38 ~ExclusiveAccessBubbleViews() override; | 42 ~ExclusiveAccessBubbleViews() override; |
| 39 | 43 |
| 40 void UpdateContent(const GURL& url, ExclusiveAccessBubbleType bubble_type); | 44 void UpdateContent(const GURL& url, ExclusiveAccessBubbleType bubble_type); |
| 41 | 45 |
| 42 // Repositions |popup_| if it is visible. | 46 // Repositions |popup_| if it is visible. |
| 43 void RepositionIfVisible(); | 47 void RepositionIfVisible(); |
| 44 | 48 |
| 45 views::View* GetView(); | 49 views::View* GetView(); |
| 46 | 50 |
| 47 private: | 51 private: |
| 48 class ExclusiveAccessView; | |
| 49 | |
| 50 // Starts or stops polling the mouse location based on |popup_| and | 52 // Starts or stops polling the mouse location based on |popup_| and |
| 51 // |bubble_type_|. | 53 // |bubble_type_|. |
| 52 void UpdateMouseWatcher(); | 54 void UpdateMouseWatcher(); |
| 53 | 55 |
| 54 // Updates |popup|'s bounds given |animation_| and |animated_attribute_|. | 56 // Updates |popup|'s bounds given |animation_| and |animated_attribute_|. |
| 55 void UpdateBounds(); | 57 void UpdateBounds(); |
| 56 | 58 |
| 59 void UpdateViewContent(ExclusiveAccessBubbleType bubble_type); |
| 60 |
| 57 // Returns the root view containing |browser_view_|. | 61 // Returns the root view containing |browser_view_|. |
| 58 views::View* GetBrowserRootView() const; | 62 views::View* GetBrowserRootView() const; |
| 59 | 63 |
| 60 // ExclusiveAccessBubble overrides: | 64 // ExclusiveAccessBubble overrides: |
| 61 void AnimationProgressed(const gfx::Animation* animation) override; | 65 void AnimationProgressed(const gfx::Animation* animation) override; |
| 62 void AnimationEnded(const gfx::Animation* animation) override; | 66 void AnimationEnded(const gfx::Animation* animation) override; |
| 63 gfx::Rect GetPopupRect(bool ignore_animation_state) const override; | 67 gfx::Rect GetPopupRect(bool ignore_animation_state) const override; |
| 64 gfx::Point GetCursorScreenPoint() override; | 68 gfx::Point GetCursorScreenPoint() override; |
| 65 bool WindowContainsPoint(gfx::Point pos) override; | 69 bool WindowContainsPoint(gfx::Point pos) override; |
| 66 bool IsWindowActive() override; | 70 bool IsWindowActive() override; |
| 67 void Hide() override; | 71 void Hide() override; |
| 68 void Show() override; | 72 void Show() override; |
| 69 bool IsAnimating() override; | 73 bool IsAnimating() override; |
| 70 bool CanMouseTriggerSlideIn() const override; | 74 bool CanMouseTriggerSlideIn() const override; |
| 71 | 75 |
| 72 // content::NotificationObserver override: | 76 // content::NotificationObserver override: |
| 73 void Observe(int type, | 77 void Observe(int type, |
| 74 const content::NotificationSource& source, | 78 const content::NotificationSource& source, |
| 75 const content::NotificationDetails& details) override; | 79 const content::NotificationDetails& details) override; |
| 76 | 80 |
| 77 // views::WidgetObserver override: | 81 // views::WidgetObserver override: |
| 78 void OnWidgetVisibilityChanged(views::Widget* widget, bool visible) override; | 82 void OnWidgetVisibilityChanged(views::Widget* widget, bool visible) override; |
| 79 | 83 |
| 84 // views::LinkListener override: |
| 85 void LinkClicked(views::Link* source, int event_flags) override; |
| 86 |
| 80 ExclusiveAccessBubbleViewsContext* const bubble_view_context_; | 87 ExclusiveAccessBubbleViewsContext* const bubble_view_context_; |
| 81 | 88 |
| 82 views::Widget* popup_; | 89 views::Widget* popup_; |
| 83 | 90 |
| 84 // Animation controlling showing/hiding of the exit bubble. | 91 // Animation controlling showing/hiding of the exit bubble. |
| 85 std::unique_ptr<gfx::SlideAnimation> animation_; | 92 std::unique_ptr<gfx::SlideAnimation> animation_; |
| 86 | 93 |
| 87 // The contents of the popup. | 94 // The contents of the popup. |
| 88 ExclusiveAccessView* view_; | 95 SubtleNotificationView* view_; |
| 96 base::string16 browser_fullscreen_exit_accelerator_; |
| 89 | 97 |
| 90 content::NotificationRegistrar registrar_; | 98 content::NotificationRegistrar registrar_; |
| 91 | 99 |
| 92 DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessBubbleViews); | 100 DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessBubbleViews); |
| 93 }; | 101 }; |
| 94 | 102 |
| 95 #endif // CHROME_BROWSER_UI_VIEWS_EXCLUSIVE_ACCESS_BUBBLE_VIEWS_H_ | 103 #endif // CHROME_BROWSER_UI_VIEWS_EXCLUSIVE_ACCESS_BUBBLE_VIEWS_H_ |
| OLD | NEW |