OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 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 // This is the GTK implementation of the First Run bubble, the dialog box |
| 6 // presented on first run of Chromium. There can only ever be a single |
| 7 // bubble open, so the class presents only static methods. |
| 8 |
| 9 #ifndef CHROME_BROWSER_UI_GTK_FIRST_RUN_BUBBLE_H_ |
| 10 #define CHROME_BROWSER_UI_GTK_FIRST_RUN_BUBBLE_H_ |
| 11 #pragma once |
| 12 |
| 13 #include <gtk/gtk.h> |
| 14 |
| 15 #include <vector> |
| 16 |
| 17 #include "base/basictypes.h" |
| 18 #include "chrome/browser/first_run/first_run.h" |
| 19 #include "chrome/browser/gtk/info_bubble_gtk.h" |
| 20 #include "chrome/common/notification_observer.h" |
| 21 #include "chrome/common/notification_registrar.h" |
| 22 |
| 23 class Profile; |
| 24 |
| 25 class FirstRunBubble : public InfoBubbleGtkDelegate, |
| 26 public NotificationObserver { |
| 27 public: |
| 28 // Shows the first run bubble, pointing at |rect|. |
| 29 static void Show(Profile* profile, |
| 30 GtkWidget* anchor, |
| 31 const gfx::Rect& rect, |
| 32 FirstRun::BubbleType bubble_type); |
| 33 |
| 34 // Implements the InfoBubbleGtkDelegate. We are notified when the bubble |
| 35 // is about to be closed. |
| 36 virtual void InfoBubbleClosing(InfoBubbleGtk* info_bubble, |
| 37 bool closed_by_escape); |
| 38 virtual bool CloseOnEscape(); |
| 39 |
| 40 // Overridden from NotificationObserver: |
| 41 virtual void Observe(NotificationType type, |
| 42 const NotificationSource& source, |
| 43 const NotificationDetails& details); |
| 44 |
| 45 private: |
| 46 FirstRunBubble(Profile* profile, |
| 47 GtkWidget* anchor, |
| 48 const gfx::Rect& rect, |
| 49 FirstRun::BubbleType bubble_type); |
| 50 virtual ~FirstRunBubble(); |
| 51 |
| 52 // Create and pack widgets for different bubble types. |
| 53 void InitializeContentForLarge(); |
| 54 void InitializeContentForOEM(); |
| 55 void InitializeContentForMinimal(); |
| 56 |
| 57 // Contains some common set up for the labels in the bubble. |width| is a |
| 58 // resource that holds the desired width for the labels. |
| 59 void InitializeLabels(int width_resource); |
| 60 |
| 61 CHROMEGTK_CALLBACK_0(FirstRunBubble, void, HandleDestroy); |
| 62 CHROMEGTK_CALLBACK_0(FirstRunBubble, void, HandleKeepButton); |
| 63 CHROMEGTK_CALLBACK_0(FirstRunBubble, void, HandleChangeButton); |
| 64 |
| 65 // Our current profile. |
| 66 Profile* profile_; |
| 67 |
| 68 // Provides colors and stuff. |
| 69 GtkThemeProvider* theme_provider_; |
| 70 |
| 71 // The widget we anchor to, and a descendant of the toplevel window we |
| 72 // are transient for. |
| 73 GtkWidget* anchor_; |
| 74 |
| 75 // We let the InfoBubble own our content, and then we delete ourself |
| 76 // when the widget is destroyed (when the InfoBubble is destroyed). |
| 77 GtkWidget* content_; |
| 78 |
| 79 // The various labels in the interface. We keep track of them for theme |
| 80 // changes. |
| 81 std::vector<GtkWidget*> labels_; |
| 82 |
| 83 InfoBubbleGtk* bubble_; |
| 84 |
| 85 NotificationRegistrar registrar_; |
| 86 |
| 87 DISALLOW_COPY_AND_ASSIGN(FirstRunBubble); |
| 88 }; |
| 89 |
| 90 #endif // CHROME_BROWSER_UI_GTK_FIRST_RUN_BUBBLE_H_ |
OLD | NEW |