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_GTK_FULLSCREEN_EXIT_BUBBLE_GTK_H_
6 #define CHROME_BROWSER_UI_GTK_FULLSCREEN_EXIT_BUBBLE_GTK_H_
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"
16 class GtkThemeService
;
18 typedef struct _GtkFloatingContainer GtkFloatingContainer
;
19 typedef struct _GtkWidget GtkWidget
;
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
{
26 // We place the bubble in |container|.
27 FullscreenExitBubbleGtk(
28 GtkFloatingContainer
* container
,
31 FullscreenExitBubbleType bubble_type
);
32 virtual ~FullscreenExitBubbleGtk();
34 void UpdateContent(const GURL
& url
,
35 FullscreenExitBubbleType bubble_type
);
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
;
49 std::string
GetMessage(const GURL
& url
);
50 void StartWatchingMouseIfNecessary();
52 GtkWidget
* widget() const {
53 return slide_widget_
->widget();
56 CHROMEGTK_CALLBACK_1(FullscreenExitBubbleGtk
, void, OnSetFloatingPosition
,
58 CHROMEGTK_CALLBACK_0(FullscreenExitBubbleGtk
, void, OnLinkClicked
);
59 CHROMEGTK_CALLBACK_0(FullscreenExitBubbleGtk
, void, OnAllowClicked
);
60 CHROMEGTK_CALLBACK_0(FullscreenExitBubbleGtk
, void, OnDenyClicked
);
62 // Overridden from content::NotificationObserver:
63 virtual void Observe(int type
,
64 const content::NotificationSource
& source
,
65 const content::NotificationDetails
& details
) OVERRIDE
;
67 GtkThemeService
* theme_service_
;
71 // A pointer to the floating container that is our parent.
72 GtkFloatingContainer
* container_
;
74 // The widget that contains the UI.
75 ui::OwnedWidgetGtk ui_container_
;
76 GtkWidget
* instruction_label_
;
78 GtkWidget
* message_label_
;
80 GtkWidget
* allow_button_
;
81 GtkWidget
* deny_button_
;
83 // The widget that animates the slide-out of fullscreen exit bubble.
84 scoped_ptr
<SlideAnimatorGtk
> slide_widget_
;
86 // The timer that does the initial hiding of the exit bubble.
87 base::OneShotTimer
<FullscreenExitBubbleGtk
> initial_delay_
;
89 ui::GtkSignalRegistrar signals_
;
91 content::NotificationRegistrar registrar_
;
93 DISALLOW_COPY_AND_ASSIGN(FullscreenExitBubbleGtk
);
96 #endif // CHROME_BROWSER_UI_GTK_FULLSCREEN_EXIT_BUBBLE_GTK_H_