Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / views / fullscreen_exit_bubble_views.h
blob116a8d914f86ed043ba75fb6c4d7b06ff0864742
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_VIEWS_FULLSCREEN_EXIT_BUBBLE_VIEWS_H_
6 #define CHROME_BROWSER_UI_VIEWS_FULLSCREEN_EXIT_BUBBLE_VIEWS_H_
8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.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"
15 class BrowserView;
16 class GURL;
17 namespace gfx {
18 class SlideAnimation;
20 namespace views {
21 class View;
22 class Widget;
25 // FullscreenExitBubbleViews is responsible for showing a bubble atop the
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
28 // screen top.
29 class FullscreenExitBubbleViews : public FullscreenExitBubble,
30 public content::NotificationObserver,
31 public views::WidgetObserver {
32 public:
33 FullscreenExitBubbleViews(BrowserView* browser,
34 const GURL& url,
35 FullscreenExitBubbleType bubble_type);
36 virtual ~FullscreenExitBubbleViews();
38 void UpdateContent(const GURL& url, FullscreenExitBubbleType bubble_type);
40 // Repositions |popup_| if it is visible.
41 void RepositionIfVisible();
43 private:
44 class FullscreenExitView;
46 enum AnimatedAttribute {
47 ANIMATED_ATTRIBUTE_BOUNDS,
48 ANIMATED_ATTRIBUTE_OPACITY
51 // Starts or stops polling the mouse location based on |popup_| and
52 // |bubble_type_|.
53 void UpdateMouseWatcher();
55 // Updates any state which depends on whether the user is in immersive
56 // fullscreen.
57 void UpdateForImmersiveState();
59 // Updates |popup|'s bounds given |animation_| and |animated_attribute_|.
60 void UpdateBounds();
62 // Returns the root view containing |browser_view_|.
63 views::View* GetBrowserRootView() const;
65 // FullScreenExitBubble overrides:
66 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
67 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE;
68 virtual gfx::Rect GetPopupRect(bool ignore_animation_state) const OVERRIDE;
69 virtual gfx::Point GetCursorScreenPoint() OVERRIDE;
70 virtual bool WindowContainsPoint(gfx::Point pos) OVERRIDE;
71 virtual bool IsWindowActive() OVERRIDE;
72 virtual void Hide() OVERRIDE;
73 virtual void Show() OVERRIDE;
74 virtual bool IsAnimating() OVERRIDE;
75 virtual bool CanMouseTriggerSlideIn() const OVERRIDE;
77 // content::NotificationObserver override:
78 virtual void Observe(int type,
79 const content::NotificationSource& source,
80 const content::NotificationDetails& details) OVERRIDE;
82 // views::WidgetObserver override:
83 virtual void OnWidgetVisibilityChanged(views::Widget* widget,
84 bool visible) OVERRIDE;
86 BrowserView* browser_view_;
88 views::Widget* popup_;
90 // Animation controlling showing/hiding of the exit bubble.
91 scoped_ptr<gfx::SlideAnimation> animation_;
93 // Attribute animated by |animation_|.
94 AnimatedAttribute animated_attribute_;
96 // The contents of the popup.
97 FullscreenExitView* view_;
99 content::NotificationRegistrar registrar_;
101 DISALLOW_COPY_AND_ASSIGN(FullscreenExitBubbleViews);
104 #endif // CHROME_BROWSER_UI_VIEWS_FULLSCREEN_EXIT_BUBBLE_VIEWS_H_