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

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

Issue 7749017: Revert "content: Start splitting up chrome/browser/ui/gtk/gtk_util.h" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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
« no previous file with comments | « chrome/browser/ui/gtk/find_bar_gtk.cc ('k') | chrome/browser/ui/gtk/first_run_dialog.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_bubble.h" 5 #include "chrome/browser/ui/gtk/first_run_bubble.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "chrome/browser/search_engines/util.h" 12 #include "chrome/browser/search_engines/util.h"
13 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/browser_list.h" 14 #include "chrome/browser/ui/browser_list.h"
15 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 15 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
16 #include "chrome/browser/ui/gtk/gtk_util.h" 16 #include "chrome/browser/ui/gtk/gtk_util.h"
17 #include "grit/chromium_strings.h" 17 #include "grit/chromium_strings.h"
18 #include "grit/generated_resources.h" 18 #include "grit/generated_resources.h"
19 #include "grit/locale_settings.h" 19 #include "grit/locale_settings.h"
20 #include "ui/base/gtk/gtk_hig_constants.h"
21 #include "ui/base/l10n/l10n_util.h" 20 #include "ui/base/l10n/l10n_util.h"
22 21
23 namespace { 22 namespace {
24 // Markup for the text of the Omnibox search label 23 // Markup for the text of the Omnibox search label
25 const char kSearchLabelMarkup[] = "<big><b>%s</b></big>"; 24 const char kSearchLabelMarkup[] = "<big><b>%s</b></big>";
26 25
27 // Padding for the buttons on first run bubble. 26 // Padding for the buttons on first run bubble.
28 const int kButtonPadding = 4; 27 const int kButtonPadding = 4;
29 28
30 // Padding between content and edge of bubble. 29 // Padding between content and edge of bubble.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 NOTREACHED(); 94 NOTREACHED();
96 return; 95 return;
97 } 96 }
98 } 97 }
99 98
100 FirstRunBubble::~FirstRunBubble() { 99 FirstRunBubble::~FirstRunBubble() {
101 } 100 }
102 101
103 void FirstRunBubble::InitializeContentForLarge( 102 void FirstRunBubble::InitializeContentForLarge(
104 std::vector<GtkWidget*>* labels) { 103 std::vector<GtkWidget*>* labels) {
105 GtkWidget* label1 = theme_service_->BuildLabel("", ui::kGdkBlack); 104 GtkWidget* label1 = theme_service_->BuildLabel("", gtk_util::kGdkBlack);
106 labels->push_back(label1); 105 labels->push_back(label1);
107 char* markup = g_markup_printf_escaped(kSearchLabelMarkup, 106 char* markup = g_markup_printf_escaped(kSearchLabelMarkup,
108 l10n_util::GetStringUTF8(IDS_FR_BUBBLE_TITLE).c_str()); 107 l10n_util::GetStringUTF8(IDS_FR_BUBBLE_TITLE).c_str());
109 gtk_label_set_markup(GTK_LABEL(label1), markup); 108 gtk_label_set_markup(GTK_LABEL(label1), markup);
110 g_free(markup); 109 g_free(markup);
111 110
112 GtkWidget* label2 = theme_service_->BuildLabel( 111 GtkWidget* label2 = theme_service_->BuildLabel(
113 l10n_util::GetStringUTF8(IDS_FR_BUBBLE_SUBTEXT), ui::kGdkBlack); 112 l10n_util::GetStringUTF8(IDS_FR_BUBBLE_SUBTEXT), gtk_util::kGdkBlack);
114 labels->push_back(label2); 113 labels->push_back(label2);
115 114
116 string16 search_engine = GetDefaultSearchEngineName(profile_); 115 string16 search_engine = GetDefaultSearchEngineName(profile_);
117 GtkWidget* label3 = theme_service_->BuildLabel( 116 GtkWidget* label3 = theme_service_->BuildLabel(
118 l10n_util::GetStringFUTF8(IDS_FR_BUBBLE_QUESTION, search_engine), 117 l10n_util::GetStringFUTF8(IDS_FR_BUBBLE_QUESTION, search_engine),
119 ui::kGdkBlack); 118 gtk_util::kGdkBlack);
120 labels->push_back(label3); 119 labels->push_back(label3);
121 120
122 GtkWidget* keep_button = gtk_button_new_with_label( 121 GtkWidget* keep_button = gtk_button_new_with_label(
123 l10n_util::GetStringFUTF8(IDS_FR_BUBBLE_OK, search_engine).c_str()); 122 l10n_util::GetStringFUTF8(IDS_FR_BUBBLE_OK, search_engine).c_str());
124 GtkWidget* change_button = gtk_button_new_with_label( 123 GtkWidget* change_button = gtk_button_new_with_label(
125 l10n_util::GetStringUTF8(IDS_FR_BUBBLE_CHANGE).c_str()); 124 l10n_util::GetStringUTF8(IDS_FR_BUBBLE_CHANGE).c_str());
126 125
127 gtk_box_pack_start(GTK_BOX(content_), label1, FALSE, FALSE, 0); 126 gtk_box_pack_start(GTK_BOX(content_), label1, FALSE, FALSE, 0);
128 gtk_box_pack_start(GTK_BOX(content_), label2, FALSE, FALSE, 0); 127 gtk_box_pack_start(GTK_BOX(content_), label2, FALSE, FALSE, 0);
129 // Leave an empty line. 128 // Leave an empty line.
(...skipping 18 matching lines...) Expand all
148 G_CALLBACK(&HandleChangeButtonThunk), this); 147 G_CALLBACK(&HandleChangeButtonThunk), this);
149 } 148 }
150 149
151 void FirstRunBubble::InitializeContentForOEM(std::vector<GtkWidget*>* labels) { 150 void FirstRunBubble::InitializeContentForOEM(std::vector<GtkWidget*>* labels) {
152 NOTIMPLEMENTED() << "Falling back to minimal bubble"; 151 NOTIMPLEMENTED() << "Falling back to minimal bubble";
153 InitializeContentForMinimal(labels); 152 InitializeContentForMinimal(labels);
154 } 153 }
155 154
156 void FirstRunBubble::InitializeContentForMinimal( 155 void FirstRunBubble::InitializeContentForMinimal(
157 std::vector<GtkWidget*>* labels) { 156 std::vector<GtkWidget*>* labels) {
158 GtkWidget* label1 = theme_service_->BuildLabel("", ui::kGdkBlack); 157 GtkWidget* label1 = theme_service_->BuildLabel("", gtk_util::kGdkBlack);
159 labels->push_back(label1); 158 labels->push_back(label1);
160 char* markup = g_markup_printf_escaped(kSearchLabelMarkup, 159 char* markup = g_markup_printf_escaped(kSearchLabelMarkup,
161 l10n_util::GetStringFUTF8( 160 l10n_util::GetStringFUTF8(
162 IDS_FR_SE_BUBBLE_TITLE, 161 IDS_FR_SE_BUBBLE_TITLE,
163 GetDefaultSearchEngineName(profile_)).c_str()); 162 GetDefaultSearchEngineName(profile_)).c_str());
164 gtk_label_set_markup(GTK_LABEL(label1), markup); 163 gtk_label_set_markup(GTK_LABEL(label1), markup);
165 g_free(markup); 164 g_free(markup);
166 165
167 GtkWidget* label2 = theme_service_->BuildLabel( 166 GtkWidget* label2 = theme_service_->BuildLabel(
168 l10n_util::GetStringUTF8(IDS_FR_BUBBLE_SUBTEXT), ui::kGdkBlack); 167 l10n_util::GetStringUTF8(IDS_FR_BUBBLE_SUBTEXT), gtk_util::kGdkBlack);
169 labels->push_back(label2); 168 labels->push_back(label2);
170 169
171 gtk_box_pack_start(GTK_BOX(content_), label1, FALSE, FALSE, 0); 170 gtk_box_pack_start(GTK_BOX(content_), label1, FALSE, FALSE, 0);
172 gtk_box_pack_start(GTK_BOX(content_), label2, FALSE, FALSE, 0); 171 gtk_box_pack_start(GTK_BOX(content_), label2, FALSE, FALSE, 0);
173 } 172 }
174 173
175 void FirstRunBubble::InitializeLabels(int width_resource, 174 void FirstRunBubble::InitializeLabels(int width_resource,
176 std::vector<GtkWidget*>* labels) { 175 std::vector<GtkWidget*>* labels) {
177 int width = -1; 176 int width = -1;
178 177
(...skipping 16 matching lines...) Expand all
195 void FirstRunBubble::HandleKeepButton(GtkWidget* sender) { 194 void FirstRunBubble::HandleKeepButton(GtkWidget* sender) {
196 bubble_->Close(); 195 bubble_->Close();
197 } 196 }
198 197
199 void FirstRunBubble::HandleChangeButton(GtkWidget* sender) { 198 void FirstRunBubble::HandleChangeButton(GtkWidget* sender) {
200 bubble_->Close(); 199 bubble_->Close();
201 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); 200 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
202 DCHECK(browser); 201 DCHECK(browser);
203 browser->OpenSearchEngineOptionsDialog(); 202 browser->OpenSearchEngineOptionsDialog();
204 } 203 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/find_bar_gtk.cc ('k') | chrome/browser/ui/gtk/first_run_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698