| OLD | NEW |
| 1 // Copyright (c) 2011 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 // This is the GTK implementation of the First Run bubble, the dialog box | 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 | 6 // presented on first run of Chromium. There can only ever be a single |
| 7 // bubble open, so the class presents only static methods. | 7 // bubble open, so the class presents only static methods. |
| 8 | 8 |
| 9 #ifndef CHROME_BROWSER_UI_GTK_FIRST_RUN_BUBBLE_H_ | 9 #ifndef CHROME_BROWSER_UI_GTK_FIRST_RUN_BUBBLE_H_ |
| 10 #define CHROME_BROWSER_UI_GTK_FIRST_RUN_BUBBLE_H_ | 10 #define CHROME_BROWSER_UI_GTK_FIRST_RUN_BUBBLE_H_ |
| 11 #pragma once | 11 #pragma once |
| 12 | 12 |
| 13 #include <gtk/gtk.h> | 13 #include <gtk/gtk.h> |
| 14 | 14 |
| 15 #include <vector> | |
| 16 | |
| 17 #include "base/basictypes.h" | |
| 18 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 19 #include "chrome/browser/first_run/first_run.h" | |
| 20 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h" | 16 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h" |
| 21 | 17 |
| 22 class Profile; | 18 class Profile; |
| 23 | 19 |
| 24 class FirstRunBubble : public BubbleDelegateGtk { | 20 class FirstRunBubble : public BubbleDelegateGtk { |
| 25 public: | 21 public: |
| 26 // Shows the first run bubble, pointing at |rect|. | 22 // Shows the first run bubble, pointing at |rect|, transient for the toplevel |
| 27 static void Show(Profile* profile, | 23 // window of the |anchor| widget. |
| 28 GtkWidget* anchor, | 24 static void Show(Profile* profile, GtkWidget* anchor, const gfx::Rect& rect); |
| 29 const gfx::Rect& rect, | |
| 30 FirstRun::BubbleType bubble_type); | |
| 31 | 25 |
| 32 // Overridden from BubbleDelegateGtk: | 26 // Overridden from BubbleDelegateGtk: |
| 33 virtual void BubbleClosing(BubbleGtk* bubble, bool closed_by_escape) OVERRIDE; | 27 virtual void BubbleClosing(BubbleGtk* bubble, bool closed_by_escape) OVERRIDE; |
| 34 | 28 |
| 35 private: | 29 private: |
| 36 FirstRunBubble(Profile* profile, | 30 FirstRunBubble(Profile* profile, GtkWidget* anchor, const gfx::Rect& rect); |
| 37 GtkWidget* anchor, | |
| 38 const gfx::Rect& rect, | |
| 39 FirstRun::BubbleType bubble_type); | |
| 40 virtual ~FirstRunBubble(); | 31 virtual ~FirstRunBubble(); |
| 41 | 32 |
| 42 // Create and pack widgets for different bubble types. | 33 CHROMEGTK_CALLBACK_0(FirstRunBubble, void, HandleDestroy); |
| 43 void InitializeContentForLarge(std::vector<GtkWidget*>* labels); | 34 CHROMEGTK_CALLBACK_0(FirstRunBubble, void, HandleChangeLink); |
| 44 void InitializeContentForOEM(std::vector<GtkWidget*>* labels); | |
| 45 void InitializeContentForMinimal(std::vector<GtkWidget*>* labels); | |
| 46 | 35 |
| 47 // Contains some common set up for the labels in the bubble. |width| is a | |
| 48 // resource that holds the desired width for the labels. | |
| 49 void InitializeLabels(int width_resource, std::vector<GtkWidget*>* labels); | |
| 50 | |
| 51 CHROMEGTK_CALLBACK_0(FirstRunBubble, void, HandleDestroy); | |
| 52 CHROMEGTK_CALLBACK_0(FirstRunBubble, void, HandleKeepButton); | |
| 53 CHROMEGTK_CALLBACK_0(FirstRunBubble, void, HandleChangeButton); | |
| 54 | |
| 55 // Our current profile. | |
| 56 Profile* profile_; | 36 Profile* profile_; |
| 57 | |
| 58 // Provides colors and stuff. | |
| 59 GtkThemeService* theme_service_; | |
| 60 | |
| 61 // The widget we anchor to, and a descendant of the toplevel window we | |
| 62 // are transient for. | |
| 63 GtkWidget* anchor_; | |
| 64 | |
| 65 // We let the BubbleGtk own our content, and then we delete ourself when the | |
| 66 // widget is destroyed (when the BubbleGtk is destroyed). | |
| 67 GtkWidget* content_; | |
| 68 | |
| 69 BubbleGtk* bubble_; | 37 BubbleGtk* bubble_; |
| 70 | 38 |
| 71 DISALLOW_COPY_AND_ASSIGN(FirstRunBubble); | 39 DISALLOW_COPY_AND_ASSIGN(FirstRunBubble); |
| 72 }; | 40 }; |
| 73 | 41 |
| 74 #endif // CHROME_BROWSER_UI_GTK_FIRST_RUN_BUBBLE_H_ | 42 #endif // CHROME_BROWSER_UI_GTK_FIRST_RUN_BUBBLE_H_ |
| OLD | NEW |