| 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/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" |
| 11 #include "base/command_line.h" |
| 11 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 12 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
| 13 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
| 14 #include "base/stringprintf.h" | 15 #include "base/stringprintf.h" |
| 15 #include "base/time.h" | 16 #include "base/time.h" |
| 16 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
| 17 #include "base/value_conversions.h" | 18 #include "base/value_conversions.h" |
| 18 #include "base/values.h" | 19 #include "base/values.h" |
| 19 #include "build/build_config.h" | 20 #include "build/build_config.h" |
| 20 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 *label); | 308 *label); |
| 308 | 309 |
| 309 enabled.reset(Value::CreateBooleanValue(!managed)); | 310 enabled.reset(Value::CreateBooleanValue(!managed)); |
| 310 web_ui_->CallJavascriptFunction("PersonalOptions.setSyncActionLinkEnabled", | 311 web_ui_->CallJavascriptFunction("PersonalOptions.setSyncActionLinkEnabled", |
| 311 *enabled); | 312 *enabled); |
| 312 | 313 |
| 313 visible.reset(Value::CreateBooleanValue(status_has_error)); | 314 visible.reset(Value::CreateBooleanValue(status_has_error)); |
| 314 web_ui_->CallJavascriptFunction("PersonalOptions.setSyncStatusErrorVisible", | 315 web_ui_->CallJavascriptFunction("PersonalOptions.setSyncStatusErrorVisible", |
| 315 *visible); | 316 *visible); |
| 316 | 317 |
| 317 visible.reset(Value::CreateBooleanValue(service->AreCredentialsAvailable())); | 318 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAutologin)) { |
| 318 web_ui_->CallJavascriptFunction("PersonalOptions.setAutoLoginVisible", | 319 visible.reset(Value::CreateBooleanValue( |
| 319 *visible); | 320 service->AreCredentialsAvailable())); |
| 321 web_ui_->CallJavascriptFunction("PersonalOptions.setAutoLoginVisible", |
| 322 *visible); |
| 323 } |
| 320 | 324 |
| 321 // Set profile creation text and button if multi-profiles switch is on. | 325 // Set profile creation text and button if multi-profiles switch is on. |
| 322 visible.reset(Value::CreateBooleanValue(multiprofile_)); | 326 visible.reset(Value::CreateBooleanValue(multiprofile_)); |
| 323 web_ui_->CallJavascriptFunction("PersonalOptions.setProfilesSectionVisible", | 327 web_ui_->CallJavascriptFunction("PersonalOptions.setProfilesSectionVisible", |
| 324 *visible); | 328 *visible); |
| 325 if (multiprofile_) | 329 if (multiprofile_) |
| 326 SendProfilesInfo(); | 330 SendProfilesInfo(); |
| 327 } | 331 } |
| 328 | 332 |
| 329 void PersonalOptionsHandler::ObserveThemeChanged() { | 333 void PersonalOptionsHandler::ObserveThemeChanged() { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 } | 429 } |
| 426 | 430 |
| 427 web_ui_->CallJavascriptFunction("PersonalOptions.setProfilesInfo", | 431 web_ui_->CallJavascriptFunction("PersonalOptions.setProfilesInfo", |
| 428 profile_info_list); | 432 profile_info_list); |
| 429 } | 433 } |
| 430 | 434 |
| 431 void PersonalOptionsHandler::CreateProfile(const ListValue* args) { | 435 void PersonalOptionsHandler::CreateProfile(const ListValue* args) { |
| 432 ProfileManager::CreateMultiProfileAsync(); | 436 ProfileManager::CreateMultiProfileAsync(); |
| 433 } | 437 } |
| 434 | 438 |
| OLD | NEW |