| OLD | NEW |
| 1 // Copyright (c) 2012 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 #include "chrome/browser/ui/gtk/first_run_dialog.h" | 5 #include "chrome/browser/ui/gtk/first_run_dialog.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "ui/base/gtk/gtk_floating_container.h" | 27 #include "ui/base/gtk/gtk_floating_container.h" |
| 28 #include "ui/base/gtk/gtk_hig_constants.h" | 28 #include "ui/base/gtk/gtk_hig_constants.h" |
| 29 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
| 30 #include "ui/base/resource/resource_bundle.h" | 30 #include "ui/base/resource/resource_bundle.h" |
| 31 | 31 |
| 32 #if defined(GOOGLE_CHROME_BUILD) | 32 #if defined(GOOGLE_CHROME_BUILD) |
| 33 #include "base/prefs/pref_service.h" | 33 #include "base/prefs/pref_service.h" |
| 34 #include "chrome/browser/browser_process.h" | 34 #include "chrome/browser/browser_process.h" |
| 35 #endif | 35 #endif |
| 36 | 36 |
| 37 namespace { | |
| 38 | |
| 39 // Set the (x, y) coordinates of the welcome message (which floats on top of | |
| 40 // the omnibox image at the top of the first run dialog). | |
| 41 void SetWelcomePosition(GtkFloatingContainer* container, | |
| 42 GtkAllocation* allocation, | |
| 43 GtkWidget* label) { | |
| 44 GValue value = { 0, }; | |
| 45 g_value_init(&value, G_TYPE_INT); | |
| 46 | |
| 47 GtkRequisition req; | |
| 48 gtk_widget_size_request(label, &req); | |
| 49 | |
| 50 int x = base::i18n::IsRTL() ? | |
| 51 allocation->width - req.width - ui::kContentAreaSpacing : | |
| 52 ui::kContentAreaSpacing; | |
| 53 g_value_set_int(&value, x); | |
| 54 gtk_container_child_set_property(GTK_CONTAINER(container), | |
| 55 label, "x", &value); | |
| 56 | |
| 57 int y = allocation->height / 2 - req.height / 2; | |
| 58 g_value_set_int(&value, y); | |
| 59 gtk_container_child_set_property(GTK_CONTAINER(container), | |
| 60 label, "y", &value); | |
| 61 g_value_unset(&value); | |
| 62 } | |
| 63 | |
| 64 } // namespace | |
| 65 | |
| 66 namespace first_run { | 37 namespace first_run { |
| 67 | 38 |
| 68 bool ShowFirstRunDialog(Profile* profile) { | 39 bool ShowFirstRunDialog(Profile* profile) { |
| 69 return FirstRunDialog::Show(); | 40 return FirstRunDialog::Show(); |
| 70 } | 41 } |
| 71 | 42 |
| 72 } // namespace first_run | 43 } // namespace first_run |
| 73 | 44 |
| 74 // static | 45 // static |
| 75 bool FirstRunDialog::Show() { | 46 bool FirstRunDialog::Show() { |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 } | 154 } |
| 184 | 155 |
| 185 void FirstRunDialog::FirstRunDone() { | 156 void FirstRunDialog::FirstRunDone() { |
| 186 first_run::SetShouldShowWelcomePage(); | 157 first_run::SetShouldShowWelcomePage(); |
| 187 | 158 |
| 188 if (dialog_) | 159 if (dialog_) |
| 189 gtk_widget_destroy(dialog_); | 160 gtk_widget_destroy(dialog_); |
| 190 base::MessageLoop::current()->Quit(); | 161 base::MessageLoop::current()->Quit(); |
| 191 delete this; | 162 delete this; |
| 192 } | 163 } |
| OLD | NEW |