OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 11 matching lines...) Expand all Loading... |
22 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" | 22 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" |
23 #include "chrome/browser/ui/gtk/gtk_util.h" | 23 #include "chrome/browser/ui/gtk/gtk_util.h" |
24 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
25 #include "chrome/common/url_constants.h" | 25 #include "chrome/common/url_constants.h" |
26 #include "chrome/installer/util/google_update_settings.h" | 26 #include "chrome/installer/util/google_update_settings.h" |
27 #include "grit/chromium_strings.h" | 27 #include "grit/chromium_strings.h" |
28 #include "grit/generated_resources.h" | 28 #include "grit/generated_resources.h" |
29 #include "grit/locale_settings.h" | 29 #include "grit/locale_settings.h" |
30 #include "grit/theme_resources.h" | 30 #include "grit/theme_resources.h" |
31 #include "ui/base/gtk/gtk_floating_container.h" | 31 #include "ui/base/gtk/gtk_floating_container.h" |
32 #include "ui/base/gtk/gtk_hig_constants.h" | |
33 #include "ui/base/l10n/l10n_util.h" | 32 #include "ui/base/l10n/l10n_util.h" |
34 #include "ui/base/resource/resource_bundle.h" | 33 #include "ui/base/resource/resource_bundle.h" |
35 #include "ui/gfx/image/image.h" | 34 #include "ui/gfx/image/image.h" |
36 | 35 |
37 #if defined(USE_LINUX_BREAKPAD) | 36 #if defined(USE_LINUX_BREAKPAD) |
38 #include "chrome/app/breakpad_linux.h" | 37 #include "chrome/app/breakpad_linux.h" |
39 #endif | 38 #endif |
40 | 39 |
41 #if defined(GOOGLE_CHROME_BUILD) | 40 #if defined(GOOGLE_CHROME_BUILD) |
42 #include "chrome/browser/browser_process.h" | 41 #include "chrome/browser/browser_process.h" |
(...skipping 29 matching lines...) Expand all Loading... |
72 void SetWelcomePosition(GtkFloatingContainer* container, | 71 void SetWelcomePosition(GtkFloatingContainer* container, |
73 GtkAllocation* allocation, | 72 GtkAllocation* allocation, |
74 GtkWidget* label) { | 73 GtkWidget* label) { |
75 GValue value = { 0, }; | 74 GValue value = { 0, }; |
76 g_value_init(&value, G_TYPE_INT); | 75 g_value_init(&value, G_TYPE_INT); |
77 | 76 |
78 GtkRequisition req; | 77 GtkRequisition req; |
79 gtk_widget_size_request(label, &req); | 78 gtk_widget_size_request(label, &req); |
80 | 79 |
81 int x = base::i18n::IsRTL() ? | 80 int x = base::i18n::IsRTL() ? |
82 allocation->width - req.width - ui::kContentAreaSpacing : | 81 allocation->width - req.width - gtk_util::kContentAreaSpacing : |
83 ui::kContentAreaSpacing; | 82 gtk_util::kContentAreaSpacing; |
84 g_value_set_int(&value, x); | 83 g_value_set_int(&value, x); |
85 gtk_container_child_set_property(GTK_CONTAINER(container), | 84 gtk_container_child_set_property(GTK_CONTAINER(container), |
86 label, "x", &value); | 85 label, "x", &value); |
87 | 86 |
88 int y = allocation->height / 2 - req.height / 2; | 87 int y = allocation->height / 2 - req.height / 2; |
89 g_value_set_int(&value, y); | 88 g_value_set_int(&value, y); |
90 gtk_container_child_set_property(GTK_CONTAINER(container), | 89 gtk_container_child_set_property(GTK_CONTAINER(container), |
91 label, "y", &value); | 90 label, "y", &value); |
92 g_value_unset(&value); | 91 g_value_unset(&value); |
93 } | 92 } |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 gtk_floating_container_add_floating(GTK_FLOATING_CONTAINER(top_area), | 206 gtk_floating_container_add_floating(GTK_FLOATING_CONTAINER(top_area), |
208 welcome_message); | 207 welcome_message); |
209 g_signal_connect(top_area, "set-floating-position", | 208 g_signal_connect(top_area, "set-floating-position", |
210 G_CALLBACK(SetWelcomePosition), welcome_message); | 209 G_CALLBACK(SetWelcomePosition), welcome_message); |
211 | 210 |
212 gtk_box_pack_start(GTK_BOX(content_area), top_area, | 211 gtk_box_pack_start(GTK_BOX(content_area), top_area, |
213 FALSE, FALSE, 0); | 212 FALSE, FALSE, 0); |
214 | 213 |
215 GtkWidget* bubble_area_background = gtk_event_box_new(); | 214 GtkWidget* bubble_area_background = gtk_event_box_new(); |
216 gtk_widget_modify_bg(bubble_area_background, | 215 gtk_widget_modify_bg(bubble_area_background, |
217 GTK_STATE_NORMAL, &ui::kGdkWhite); | 216 GTK_STATE_NORMAL, >k_util::kGdkWhite); |
218 | 217 |
219 GtkWidget* bubble_area_box = gtk_vbox_new(FALSE, 0); | 218 GtkWidget* bubble_area_box = gtk_vbox_new(FALSE, 0); |
220 gtk_container_set_border_width(GTK_CONTAINER(bubble_area_box), | 219 gtk_container_set_border_width(GTK_CONTAINER(bubble_area_box), |
221 ui::kContentAreaSpacing); | 220 gtk_util::kContentAreaSpacing); |
222 gtk_container_add(GTK_CONTAINER(bubble_area_background), | 221 gtk_container_add(GTK_CONTAINER(bubble_area_background), |
223 bubble_area_box); | 222 bubble_area_box); |
224 | 223 |
225 GtkWidget* explanation = gtk_label_new( | 224 GtkWidget* explanation = gtk_label_new( |
226 l10n_util::GetStringFUTF8(IDS_FR_SEARCH_TEXT, | 225 l10n_util::GetStringFUTF8(IDS_FR_SEARCH_TEXT, |
227 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)).c_str()); | 226 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)).c_str()); |
228 gtk_util::SetLabelColor(explanation, &ui::kGdkBlack); | 227 gtk_util::SetLabelColor(explanation, >k_util::kGdkBlack); |
229 gtk_util::SetLabelWidth(explanation, kExplanationWidth); | 228 gtk_util::SetLabelWidth(explanation, kExplanationWidth); |
230 gtk_box_pack_start(GTK_BOX(bubble_area_box), explanation, FALSE, FALSE, 0); | 229 gtk_box_pack_start(GTK_BOX(bubble_area_box), explanation, FALSE, FALSE, 0); |
231 | 230 |
232 // We will fill this in after the TemplateURLService has loaded. | 231 // We will fill this in after the TemplateURLService has loaded. |
233 // GtkHButtonBox because we want all children to have the same size. | 232 // GtkHButtonBox because we want all children to have the same size. |
234 search_engine_hbox_ = gtk_hbutton_box_new(); | 233 search_engine_hbox_ = gtk_hbutton_box_new(); |
235 gtk_box_set_spacing(GTK_BOX(search_engine_hbox_), kSearchEngineSpacing); | 234 gtk_box_set_spacing(GTK_BOX(search_engine_hbox_), kSearchEngineSpacing); |
236 gtk_box_pack_start(GTK_BOX(bubble_area_box), search_engine_hbox_, | 235 gtk_box_pack_start(GTK_BOX(bubble_area_box), search_engine_hbox_, |
237 FALSE, FALSE, 0); | 236 FALSE, FALSE, 0); |
238 | 237 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 ballot_engines.end()) { | 320 ballot_engines.end()) { |
322 ballot_engines.push_back(default_search_engine); | 321 ballot_engines.push_back(default_search_engine); |
323 } | 322 } |
324 | 323 |
325 std::string choose_text = l10n_util::GetStringUTF8(IDS_FR_SEARCH_CHOOSE); | 324 std::string choose_text = l10n_util::GetStringUTF8(IDS_FR_SEARCH_CHOOSE); |
326 for (std::vector<const TemplateURL*>::iterator search_engine_iter = | 325 for (std::vector<const TemplateURL*>::iterator search_engine_iter = |
327 ballot_engines.begin(); | 326 ballot_engines.begin(); |
328 search_engine_iter < ballot_engines.end(); | 327 search_engine_iter < ballot_engines.end(); |
329 ++search_engine_iter) { | 328 ++search_engine_iter) { |
330 // Create a container for the search engine widgets. | 329 // Create a container for the search engine widgets. |
331 GtkWidget* vbox = gtk_vbox_new(FALSE, ui::kControlSpacing); | 330 GtkWidget* vbox = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); |
332 | 331 |
333 // We show text on Chromium and images on Google Chrome. | 332 // We show text on Chromium and images on Google Chrome. |
334 bool show_images = false; | 333 bool show_images = false; |
335 #if defined(GOOGLE_CHROME_BUILD) | 334 #if defined(GOOGLE_CHROME_BUILD) |
336 show_images = true; | 335 show_images = true; |
337 #endif | 336 #endif |
338 | 337 |
339 // Create the image (maybe). | 338 // Create the image (maybe). |
340 int logo_id = (*search_engine_iter)->logo_id(); | 339 int logo_id = (*search_engine_iter)->logo_id(); |
341 if (show_images && logo_id > 0) { | 340 if (show_images && logo_id > 0) { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 } | 431 } |
433 | 432 |
434 void FirstRunDialog::FirstRunDone() { | 433 void FirstRunDialog::FirstRunDone() { |
435 FirstRun::SetShowWelcomePagePref(); | 434 FirstRun::SetShowWelcomePagePref(); |
436 | 435 |
437 if (dialog_) | 436 if (dialog_) |
438 gtk_widget_destroy(dialog_); | 437 gtk_widget_destroy(dialog_); |
439 MessageLoop::current()->Quit(); | 438 MessageLoop::current()->Quit(); |
440 delete this; | 439 delete this; |
441 } | 440 } |
OLD | NEW |