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

Side by Side Diff: chrome/browser/ui/webui/options/personal_options_handler.cc

Issue 7649006: more changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix another typo 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
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/webui/options/personal_options_handler.h" 5 #include "chrome/browser/ui/webui/options/personal_options_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 #else 140 #else
141 localized_strings->SetString("themes", 141 localized_strings->SetString("themes",
142 l10n_util::GetStringUTF16(IDS_THEMES_GROUP_NAME)); 142 l10n_util::GetStringUTF16(IDS_THEMES_GROUP_NAME));
143 localized_strings->SetString("themesReset", 143 localized_strings->SetString("themesReset",
144 l10n_util::GetStringUTF16(IDS_THEMES_RESET_BUTTON)); 144 l10n_util::GetStringUTF16(IDS_THEMES_RESET_BUTTON));
145 #endif 145 #endif
146 146
147 // Sync select control. 147 // Sync select control.
148 ListValue* sync_select_list = new ListValue; 148 ListValue* sync_select_list = new ListValue;
149 ListValue* datatypes = new ListValue; 149 ListValue* datatypes = new ListValue;
150 datatypes->Append(Value::CreateBooleanValue(false)); 150 datatypes->Append(base::FalseValue());
151 datatypes->Append( 151 datatypes->Append(
152 Value::CreateStringValue( 152 base::StringValue::New(
153 l10n_util::GetStringUTF8(IDS_SYNC_OPTIONS_SELECT_DATATYPES))); 153 l10n_util::GetStringUTF8(IDS_SYNC_OPTIONS_SELECT_DATATYPES)));
154 sync_select_list->Append(datatypes); 154 sync_select_list->Append(datatypes);
155 ListValue* everything = new ListValue; 155 ListValue* everything = new ListValue;
156 everything->Append(Value::CreateBooleanValue(true)); 156 everything->Append(base::TrueValue());
157 everything->Append( 157 everything->Append(
158 Value::CreateStringValue( 158 base::StringValue::New(
159 l10n_util::GetStringUTF8(IDS_SYNC_OPTIONS_SELECT_EVERYTHING))); 159 l10n_util::GetStringUTF8(IDS_SYNC_OPTIONS_SELECT_EVERYTHING)));
160 sync_select_list->Append(everything); 160 sync_select_list->Append(everything);
161 localized_strings->Set("syncSelectList", sync_select_list); 161 localized_strings->Set("syncSelectList", sync_select_list);
162 162
163 // Sync page. 163 // Sync page.
164 localized_strings->SetString("syncPage", 164 localized_strings->SetString("syncPage",
165 l10n_util::GetStringUTF16(IDS_SYNC_NTP_SYNC_SECTION_TITLE)); 165 l10n_util::GetStringUTF16(IDS_SYNC_NTP_SYNC_SECTION_TITLE));
166 localized_strings->SetString("sync_title", 166 localized_strings->SetString("sync_title",
167 l10n_util::GetStringUTF16(IDS_CUSTOMIZE_SYNC_DESCRIPTION)); 167 l10n_util::GetStringUTF16(IDS_CUSTOMIZE_SYNC_DESCRIPTION));
168 localized_strings->SetString("syncsettings", 168 localized_strings->SetString("syncsettings",
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 l10n_util::GetStringUTF16(IDS_SYNC_NTP_SETUP_IN_PROGRESS); 274 l10n_util::GetStringUTF16(IDS_SYNC_NTP_SETUP_IN_PROGRESS);
275 is_start_stop_button_visible = true; 275 is_start_stop_button_visible = true;
276 is_start_stop_button_enabled = false; 276 is_start_stop_button_enabled = false;
277 } else { 277 } else {
278 start_stop_button_label = 278 start_stop_button_label =
279 l10n_util::GetStringUTF16(IDS_SYNC_START_SYNC_BUTTON_LABEL); 279 l10n_util::GetStringUTF16(IDS_SYNC_START_SYNC_BUTTON_LABEL);
280 is_start_stop_button_visible = true; 280 is_start_stop_button_visible = true;
281 is_start_stop_button_enabled = !managed; 281 is_start_stop_button_enabled = !managed;
282 } 282 }
283 283
284 scoped_ptr<Value> completed(Value::CreateBooleanValue(sync_setup_completed)); 284 scoped_ptr<Value> completed(base::BooleanValue::New(sync_setup_completed));
285 web_ui_->CallJavascriptFunction("PersonalOptions.setSyncSetupCompleted", 285 web_ui_->CallJavascriptFunction("PersonalOptions.setSyncSetupCompleted",
286 *completed); 286 *completed);
287 287
288 scoped_ptr<Value> label(Value::CreateStringValue(status_label)); 288 scoped_ptr<Value> label(base::StringValue::New(status_label));
289 web_ui_->CallJavascriptFunction("PersonalOptions.setSyncStatus", *label); 289 web_ui_->CallJavascriptFunction("PersonalOptions.setSyncStatus", *label);
290 290
291 scoped_ptr<Value> enabled( 291 scoped_ptr<Value> enabled(
292 Value::CreateBooleanValue(is_start_stop_button_enabled)); 292 base::BooleanValue::New(is_start_stop_button_enabled));
293 web_ui_->CallJavascriptFunction("PersonalOptions.setStartStopButtonEnabled", 293 web_ui_->CallJavascriptFunction("PersonalOptions.setStartStopButtonEnabled",
294 *enabled); 294 *enabled);
295 295
296 scoped_ptr<Value> visible( 296 scoped_ptr<Value> visible(
297 Value::CreateBooleanValue(is_start_stop_button_visible)); 297 base::BooleanValue::New(is_start_stop_button_visible));
298 web_ui_->CallJavascriptFunction("PersonalOptions.setStartStopButtonVisible", 298 web_ui_->CallJavascriptFunction("PersonalOptions.setStartStopButtonVisible",
299 *visible); 299 *visible);
300 300
301 label.reset(Value::CreateStringValue(start_stop_button_label)); 301 label.reset(base::StringValue::New(start_stop_button_label));
302 web_ui_->CallJavascriptFunction("PersonalOptions.setStartStopButtonLabel", 302 web_ui_->CallJavascriptFunction("PersonalOptions.setStartStopButtonLabel",
303 *label); 303 *label);
304 304
305 label.reset(Value::CreateStringValue(link_label)); 305 label.reset(base::StringValue::New(link_label));
306 web_ui_->CallJavascriptFunction("PersonalOptions.setSyncActionLinkLabel", 306 web_ui_->CallJavascriptFunction("PersonalOptions.setSyncActionLinkLabel",
307 *label); 307 *label);
308 308
309 enabled.reset(Value::CreateBooleanValue(!managed)); 309 enabled.reset(base::BooleanValue::New(!managed));
310 web_ui_->CallJavascriptFunction("PersonalOptions.setSyncActionLinkEnabled", 310 web_ui_->CallJavascriptFunction("PersonalOptions.setSyncActionLinkEnabled",
311 *enabled); 311 *enabled);
312 312
313 visible.reset(Value::CreateBooleanValue(status_has_error)); 313 visible.reset(base::BooleanValue::New(status_has_error));
314 web_ui_->CallJavascriptFunction("PersonalOptions.setSyncStatusErrorVisible", 314 web_ui_->CallJavascriptFunction("PersonalOptions.setSyncStatusErrorVisible",
315 *visible); 315 *visible);
316 316
317 visible.reset(Value::CreateBooleanValue(service->AreCredentialsAvailable())); 317 visible.reset(base::BooleanValue::New(service->AreCredentialsAvailable()));
318 web_ui_->CallJavascriptFunction("PersonalOptions.setAutoLoginVisible", 318 web_ui_->CallJavascriptFunction("PersonalOptions.setAutoLoginVisible",
319 *visible); 319 *visible);
320 320
321 // Set profile creation text and button if multi-profiles switch is on. 321 // Set profile creation text and button if multi-profiles switch is on.
322 visible.reset(Value::CreateBooleanValue(multiprofile_)); 322 visible.reset(base::BooleanValue::New(multiprofile_));
323 web_ui_->CallJavascriptFunction("PersonalOptions.setProfilesSectionVisible", 323 web_ui_->CallJavascriptFunction("PersonalOptions.setProfilesSectionVisible",
324 *visible); 324 *visible);
325 if (multiprofile_) 325 if (multiprofile_)
326 SendProfilesInfo(); 326 SendProfilesInfo();
327 } 327 }
328 328
329 void PersonalOptionsHandler::OnLoginSuccess() { 329 void PersonalOptionsHandler::OnLoginSuccess() {
330 OnStateChanged(); 330 OnStateChanged();
331 } 331 }
332 332
333 void PersonalOptionsHandler::OnLoginFailure( 333 void PersonalOptionsHandler::OnLoginFailure(
334 const GoogleServiceAuthError& error) { 334 const GoogleServiceAuthError& error) {
335 OnStateChanged(); 335 OnStateChanged();
336 } 336 }
337 337
338 void PersonalOptionsHandler::ObserveThemeChanged() { 338 void PersonalOptionsHandler::ObserveThemeChanged() {
339 Profile* profile = Profile::FromWebUI(web_ui_); 339 Profile* profile = Profile::FromWebUI(web_ui_);
340 #if defined(TOOLKIT_GTK) 340 #if defined(TOOLKIT_GTK)
341 GtkThemeService* theme_service = GtkThemeService::GetFrom(profile); 341 GtkThemeService* theme_service = GtkThemeService::GetFrom(profile);
342 bool is_gtk_theme = theme_service->UsingNativeTheme(); 342 bool is_gtk_theme = theme_service->UsingNativeTheme();
343 base::FundamentalValue gtk_enabled(!is_gtk_theme); 343 base::BooleanValue gtk_enabled(!is_gtk_theme);
344 web_ui_->CallJavascriptFunction( 344 web_ui_->CallJavascriptFunction(
345 "options.PersonalOptions.setGtkThemeButtonEnabled", gtk_enabled); 345 "options.PersonalOptions.setGtkThemeButtonEnabled", gtk_enabled);
346 #else 346 #else
347 ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile); 347 ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile);
348 bool is_gtk_theme = false; 348 bool is_gtk_theme = false;
349 #endif 349 #endif
350 350
351 bool is_classic_theme = !is_gtk_theme && theme_service->UsingDefaultTheme(); 351 bool is_classic_theme = !is_gtk_theme && theme_service->UsingDefaultTheme();
352 base::FundamentalValue enabled(!is_classic_theme); 352 base::BooleanValue enabled(!is_classic_theme);
353 web_ui_->CallJavascriptFunction( 353 web_ui_->CallJavascriptFunction(
354 "options.PersonalOptions.setThemesResetButtonEnabled", enabled); 354 "options.PersonalOptions.setThemesResetButtonEnabled", enabled);
355 } 355 }
356 356
357 void PersonalOptionsHandler::Initialize() { 357 void PersonalOptionsHandler::Initialize() {
358 Profile* profile = Profile::FromWebUI(web_ui_); 358 Profile* profile = Profile::FromWebUI(web_ui_);
359 359
360 // Listen for theme installation. 360 // Listen for theme installation.
361 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, 361 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
362 Source<ThemeService>(ThemeServiceFactory::GetForProfile( 362 Source<ThemeService>(ThemeServiceFactory::GetForProfile(
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 } 434 }
435 435
436 web_ui_->CallJavascriptFunction("PersonalOptions.setProfilesInfo", 436 web_ui_->CallJavascriptFunction("PersonalOptions.setProfilesInfo",
437 profile_info_list); 437 profile_info_list);
438 } 438 }
439 439
440 void PersonalOptionsHandler::CreateProfile(const ListValue* args) { 440 void PersonalOptionsHandler::CreateProfile(const ListValue* args) {
441 ProfileManager::CreateMultiProfileAsync(); 441 ProfileManager::CreateMultiProfileAsync();
442 } 442 }
443 443
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/password_manager_handler.cc ('k') | chrome/browser/ui/webui/plugins_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698