| 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" |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 SyncSetupFlow::GetArgsForConfigure(sync_service, &args); | 370 SyncSetupFlow::GetArgsForConfigure(sync_service, &args); |
| 371 | 371 |
| 372 web_ui_->CallJavascriptFunction("PersonalOptions.setRegisteredDataTypes", | 372 web_ui_->CallJavascriptFunction("PersonalOptions.setRegisteredDataTypes", |
| 373 args); | 373 args); |
| 374 } else { | 374 } else { |
| 375 web_ui_->CallJavascriptFunction("options.PersonalOptions.hideSyncSection"); | 375 web_ui_->CallJavascriptFunction("options.PersonalOptions.hideSyncSection"); |
| 376 } | 376 } |
| 377 } | 377 } |
| 378 | 378 |
| 379 void PersonalOptionsHandler::ThemesReset(const ListValue* args) { | 379 void PersonalOptionsHandler::ThemesReset(const ListValue* args) { |
| 380 UserMetricsRecordAction(UserMetricsAction("Options_ThemesReset")); | 380 UserMetrics::RecordAction(UserMetricsAction("Options_ThemesReset")); |
| 381 ThemeServiceFactory::GetForProfile(web_ui_->GetProfile())->UseDefaultTheme(); | 381 ThemeServiceFactory::GetForProfile(web_ui_->GetProfile())->UseDefaultTheme(); |
| 382 } | 382 } |
| 383 | 383 |
| 384 #if defined(TOOLKIT_GTK) | 384 #if defined(TOOLKIT_GTK) |
| 385 void PersonalOptionsHandler::ThemesSetGTK(const ListValue* args) { | 385 void PersonalOptionsHandler::ThemesSetGTK(const ListValue* args) { |
| 386 UserMetricsRecordAction(UserMetricsAction("Options_GtkThemeSet")); | 386 UserMetrics::RecordAction(UserMetricsAction("Options_GtkThemeSet")); |
| 387 ThemeServiceFactory::GetForProfile(web_ui_->GetProfile())->SetNativeTheme(); | 387 ThemeServiceFactory::GetForProfile(web_ui_->GetProfile())->SetNativeTheme(); |
| 388 } | 388 } |
| 389 #endif | 389 #endif |
| 390 | 390 |
| 391 #if defined(OS_CHROMEOS) | 391 #if defined(OS_CHROMEOS) |
| 392 void PersonalOptionsHandler::LoadAccountPicture(const ListValue* args) { | 392 void PersonalOptionsHandler::LoadAccountPicture(const ListValue* args) { |
| 393 const chromeos::UserManager::User& user = | 393 const chromeos::UserManager::User& user = |
| 394 chromeos::UserManager::Get()->logged_in_user(); | 394 chromeos::UserManager::Get()->logged_in_user(); |
| 395 std::string email = user.email(); | 395 std::string email = user.email(); |
| 396 if (!email.empty()) { | 396 if (!email.empty()) { |
| 397 // int64 is either long or long long, but we need a certain format | 397 // int64 is either long or long long, but we need a certain format |
| 398 // specifier. | 398 // specifier. |
| 399 long long timestamp = base::TimeTicks::Now().ToInternalValue(); | 399 long long timestamp = base::TimeTicks::Now().ToInternalValue(); |
| 400 StringValue image_url( | 400 StringValue image_url( |
| 401 StringPrintf("%s%s?id=%lld", | 401 StringPrintf("%s%s?id=%lld", |
| 402 chrome::kChromeUIUserImageURL, | 402 chrome::kChromeUIUserImageURL, |
| 403 email.c_str(), | 403 email.c_str(), |
| 404 timestamp)); | 404 timestamp)); |
| 405 web_ui_->CallJavascriptFunction("PersonalOptions.setAccountPicture", | 405 web_ui_->CallJavascriptFunction("PersonalOptions.setAccountPicture", |
| 406 image_url); | 406 image_url); |
| 407 | 407 |
| 408 StringValue email_value(email); | 408 StringValue email_value(email); |
| 409 web_ui_->CallJavascriptFunction("AccountsOptions.updateAccountPicture", | 409 web_ui_->CallJavascriptFunction("AccountsOptions.updateAccountPicture", |
| 410 email_value, image_url); | 410 email_value, image_url); |
| 411 } | 411 } |
| 412 } | 412 } |
| 413 #endif | 413 #endif |
| OLD | NEW |