OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef CHROME_BROWSER_UI_GTK_FULLSCREEN_EXIT_BUBBLE_GTK_H_ | |
6 #define CHROME_BROWSER_UI_GTK_FULLSCREEN_EXIT_BUBBLE_GTK_H_ | |
7 | |
8 #include "chrome/browser/ui/fullscreen/fullscreen_exit_bubble.h" | |
9 #include "chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.h" | |
10 #include "chrome/browser/ui/gtk/slide_animator_gtk.h" | |
11 #include "content/public/browser/notification_observer.h" | |
12 #include "content/public/browser/notification_registrar.h" | |
13 #include "ui/base/gtk/gtk_signal.h" | |
14 #include "ui/base/gtk/gtk_signal_registrar.h" | |
15 | |
16 class GtkThemeService; | |
17 | |
18 typedef struct _GtkFloatingContainer GtkFloatingContainer; | |
19 typedef struct _GtkWidget GtkWidget; | |
20 | |
21 // FullscreenExitBubbleGTK is responsible for showing a bubble atop the screen | |
22 // in fullscreen mode, telling users how to exit and providing a click target. | |
23 class FullscreenExitBubbleGtk : public FullscreenExitBubble, | |
24 public content::NotificationObserver { | |
25 public: | |
26 // We place the bubble in |container|. | |
27 FullscreenExitBubbleGtk( | |
28 GtkFloatingContainer* container, | |
29 Browser* delegate, | |
30 const GURL& url, | |
31 FullscreenExitBubbleType bubble_type); | |
32 virtual ~FullscreenExitBubbleGtk(); | |
33 | |
34 void UpdateContent(const GURL& url, | |
35 FullscreenExitBubbleType bubble_type); | |
36 protected: | |
37 // FullScreenExitBubble | |
38 virtual gfx::Rect GetPopupRect(bool ignore_animation_state) const OVERRIDE; | |
39 virtual gfx::Point GetCursorScreenPoint() OVERRIDE; | |
40 virtual bool WindowContainsPoint(gfx::Point pos) OVERRIDE; | |
41 virtual bool IsWindowActive() OVERRIDE; | |
42 virtual void Hide() OVERRIDE; | |
43 virtual void Show() OVERRIDE; | |
44 virtual bool IsAnimating() OVERRIDE; | |
45 virtual bool CanMouseTriggerSlideIn() const OVERRIDE; | |
46 | |
47 private: | |
48 void InitWidgets(); | |
49 std::string GetMessage(const GURL& url); | |
50 void StartWatchingMouseIfNecessary(); | |
51 | |
52 GtkWidget* widget() const { | |
53 return slide_widget_->widget(); | |
54 } | |
55 | |
56 CHROMEGTK_CALLBACK_1(FullscreenExitBubbleGtk, void, OnSetFloatingPosition, | |
57 GtkAllocation*); | |
58 CHROMEGTK_CALLBACK_0(FullscreenExitBubbleGtk, void, OnLinkClicked); | |
59 CHROMEGTK_CALLBACK_0(FullscreenExitBubbleGtk, void, OnAllowClicked); | |
60 CHROMEGTK_CALLBACK_0(FullscreenExitBubbleGtk, void, OnDenyClicked); | |
61 | |
62 // Overridden from content::NotificationObserver: | |
63 virtual void Observe(int type, | |
64 const content::NotificationSource& source, | |
65 const content::NotificationDetails& details) OVERRIDE; | |
66 | |
67 GtkThemeService* theme_service_; | |
68 | |
69 GtkWidget* bubble_; | |
70 | |
71 // A pointer to the floating container that is our parent. | |
72 GtkFloatingContainer* container_; | |
73 | |
74 // The widget that contains the UI. | |
75 ui::OwnedWidgetGtk ui_container_; | |
76 GtkWidget* instruction_label_; | |
77 GtkWidget* hbox_; | |
78 GtkWidget* message_label_; | |
79 GtkWidget* link_; | |
80 GtkWidget* allow_button_; | |
81 GtkWidget* deny_button_; | |
82 | |
83 // The widget that animates the slide-out of fullscreen exit bubble. | |
84 scoped_ptr<SlideAnimatorGtk> slide_widget_; | |
85 | |
86 // The timer that does the initial hiding of the exit bubble. | |
87 base::OneShotTimer<FullscreenExitBubbleGtk> initial_delay_; | |
88 | |
89 ui::GtkSignalRegistrar signals_; | |
90 | |
91 content::NotificationRegistrar registrar_; | |
92 | |
93 DISALLOW_COPY_AND_ASSIGN(FullscreenExitBubbleGtk); | |
94 }; | |
95 | |
96 #endif // CHROME_BROWSER_UI_GTK_FULLSCREEN_EXIT_BUBBLE_GTK_H_ | |
OLD | NEW |