Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(607)

Side by Side Diff: chrome/browser/ui/gtk/first_run_dialog.cc

Issue 7748026: content: Reapply "Start splitting up chrome/browser/ui/gtk/gtk_util.h" (r98287) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase on Monday. Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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"
32 #include "ui/base/l10n/l10n_util.h" 33 #include "ui/base/l10n/l10n_util.h"
33 #include "ui/base/resource/resource_bundle.h" 34 #include "ui/base/resource/resource_bundle.h"
34 #include "ui/gfx/image/image.h" 35 #include "ui/gfx/image/image.h"
35 36
36 #if defined(USE_LINUX_BREAKPAD) 37 #if defined(USE_LINUX_BREAKPAD)
37 #include "chrome/app/breakpad_linux.h" 38 #include "chrome/app/breakpad_linux.h"
38 #endif 39 #endif
39 40
40 #if defined(GOOGLE_CHROME_BUILD) 41 #if defined(GOOGLE_CHROME_BUILD)
41 #include "chrome/browser/browser_process.h" 42 #include "chrome/browser/browser_process.h"
(...skipping 29 matching lines...) Expand all
71 void SetWelcomePosition(GtkFloatingContainer* container, 72 void SetWelcomePosition(GtkFloatingContainer* container,
72 GtkAllocation* allocation, 73 GtkAllocation* allocation,
73 GtkWidget* label) { 74 GtkWidget* label) {
74 GValue value = { 0, }; 75 GValue value = { 0, };
75 g_value_init(&value, G_TYPE_INT); 76 g_value_init(&value, G_TYPE_INT);
76 77
77 GtkRequisition req; 78 GtkRequisition req;
78 gtk_widget_size_request(label, &req); 79 gtk_widget_size_request(label, &req);
79 80
80 int x = base::i18n::IsRTL() ? 81 int x = base::i18n::IsRTL() ?
81 allocation->width - req.width - gtk_util::kContentAreaSpacing : 82 allocation->width - req.width - ui::kContentAreaSpacing :
82 gtk_util::kContentAreaSpacing; 83 ui::kContentAreaSpacing;
83 g_value_set_int(&value, x); 84 g_value_set_int(&value, x);
84 gtk_container_child_set_property(GTK_CONTAINER(container), 85 gtk_container_child_set_property(GTK_CONTAINER(container),
85 label, "x", &value); 86 label, "x", &value);
86 87
87 int y = allocation->height / 2 - req.height / 2; 88 int y = allocation->height / 2 - req.height / 2;
88 g_value_set_int(&value, y); 89 g_value_set_int(&value, y);
89 gtk_container_child_set_property(GTK_CONTAINER(container), 90 gtk_container_child_set_property(GTK_CONTAINER(container),
90 label, "y", &value); 91 label, "y", &value);
91 g_value_unset(&value); 92 g_value_unset(&value);
92 } 93 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 gtk_floating_container_add_floating(GTK_FLOATING_CONTAINER(top_area), 207 gtk_floating_container_add_floating(GTK_FLOATING_CONTAINER(top_area),
207 welcome_message); 208 welcome_message);
208 g_signal_connect(top_area, "set-floating-position", 209 g_signal_connect(top_area, "set-floating-position",
209 G_CALLBACK(SetWelcomePosition), welcome_message); 210 G_CALLBACK(SetWelcomePosition), welcome_message);
210 211
211 gtk_box_pack_start(GTK_BOX(content_area), top_area, 212 gtk_box_pack_start(GTK_BOX(content_area), top_area,
212 FALSE, FALSE, 0); 213 FALSE, FALSE, 0);
213 214
214 GtkWidget* bubble_area_background = gtk_event_box_new(); 215 GtkWidget* bubble_area_background = gtk_event_box_new();
215 gtk_widget_modify_bg(bubble_area_background, 216 gtk_widget_modify_bg(bubble_area_background,
216 GTK_STATE_NORMAL, &gtk_util::kGdkWhite); 217 GTK_STATE_NORMAL, &ui::kGdkWhite);
217 218
218 GtkWidget* bubble_area_box = gtk_vbox_new(FALSE, 0); 219 GtkWidget* bubble_area_box = gtk_vbox_new(FALSE, 0);
219 gtk_container_set_border_width(GTK_CONTAINER(bubble_area_box), 220 gtk_container_set_border_width(GTK_CONTAINER(bubble_area_box),
220 gtk_util::kContentAreaSpacing); 221 ui::kContentAreaSpacing);
221 gtk_container_add(GTK_CONTAINER(bubble_area_background), 222 gtk_container_add(GTK_CONTAINER(bubble_area_background),
222 bubble_area_box); 223 bubble_area_box);
223 224
224 GtkWidget* explanation = gtk_label_new( 225 GtkWidget* explanation = gtk_label_new(
225 l10n_util::GetStringFUTF8(IDS_FR_SEARCH_TEXT, 226 l10n_util::GetStringFUTF8(IDS_FR_SEARCH_TEXT,
226 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)).c_str()); 227 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)).c_str());
227 gtk_util::SetLabelColor(explanation, &gtk_util::kGdkBlack); 228 gtk_util::SetLabelColor(explanation, &ui::kGdkBlack);
228 gtk_util::SetLabelWidth(explanation, kExplanationWidth); 229 gtk_util::SetLabelWidth(explanation, kExplanationWidth);
229 gtk_box_pack_start(GTK_BOX(bubble_area_box), explanation, FALSE, FALSE, 0); 230 gtk_box_pack_start(GTK_BOX(bubble_area_box), explanation, FALSE, FALSE, 0);
230 231
231 // We will fill this in after the TemplateURLService has loaded. 232 // We will fill this in after the TemplateURLService has loaded.
232 // GtkHButtonBox because we want all children to have the same size. 233 // GtkHButtonBox because we want all children to have the same size.
233 search_engine_hbox_ = gtk_hbutton_box_new(); 234 search_engine_hbox_ = gtk_hbutton_box_new();
234 gtk_box_set_spacing(GTK_BOX(search_engine_hbox_), kSearchEngineSpacing); 235 gtk_box_set_spacing(GTK_BOX(search_engine_hbox_), kSearchEngineSpacing);
235 gtk_box_pack_start(GTK_BOX(bubble_area_box), search_engine_hbox_, 236 gtk_box_pack_start(GTK_BOX(bubble_area_box), search_engine_hbox_,
236 FALSE, FALSE, 0); 237 FALSE, FALSE, 0);
237 238
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 ballot_engines.end()) { 321 ballot_engines.end()) {
321 ballot_engines.push_back(default_search_engine); 322 ballot_engines.push_back(default_search_engine);
322 } 323 }
323 324
324 std::string choose_text = l10n_util::GetStringUTF8(IDS_FR_SEARCH_CHOOSE); 325 std::string choose_text = l10n_util::GetStringUTF8(IDS_FR_SEARCH_CHOOSE);
325 for (std::vector<const TemplateURL*>::iterator search_engine_iter = 326 for (std::vector<const TemplateURL*>::iterator search_engine_iter =
326 ballot_engines.begin(); 327 ballot_engines.begin();
327 search_engine_iter < ballot_engines.end(); 328 search_engine_iter < ballot_engines.end();
328 ++search_engine_iter) { 329 ++search_engine_iter) {
329 // Create a container for the search engine widgets. 330 // Create a container for the search engine widgets.
330 GtkWidget* vbox = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); 331 GtkWidget* vbox = gtk_vbox_new(FALSE, ui::kControlSpacing);
331 332
332 // We show text on Chromium and images on Google Chrome. 333 // We show text on Chromium and images on Google Chrome.
333 bool show_images = false; 334 bool show_images = false;
334 #if defined(GOOGLE_CHROME_BUILD) 335 #if defined(GOOGLE_CHROME_BUILD)
335 show_images = true; 336 show_images = true;
336 #endif 337 #endif
337 338
338 // Create the image (maybe). 339 // Create the image (maybe).
339 int logo_id = (*search_engine_iter)->logo_id(); 340 int logo_id = (*search_engine_iter)->logo_id();
340 if (show_images && logo_id > 0) { 341 if (show_images && logo_id > 0) {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 } 432 }
432 433
433 void FirstRunDialog::FirstRunDone() { 434 void FirstRunDialog::FirstRunDone() {
434 FirstRun::SetShowWelcomePagePref(); 435 FirstRun::SetShowWelcomePagePref();
435 436
436 if (dialog_) 437 if (dialog_)
437 gtk_widget_destroy(dialog_); 438 gtk_widget_destroy(dialog_);
438 MessageLoop::current()->Quit(); 439 MessageLoop::current()->Quit();
439 delete this; 440 delete this;
440 } 441 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/first_run_bubble.cc ('k') | chrome/browser/ui/gtk/fullscreen_exit_bubble_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698