| 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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 414 | 414 |
| 415 void PersonalOptionsHandler::SendProfilesInfo() { | 415 void PersonalOptionsHandler::SendProfilesInfo() { |
| 416 ProfileInfoCache& cache = | 416 ProfileInfoCache& cache = |
| 417 g_browser_process->profile_manager()->GetProfileInfoCache(); | 417 g_browser_process->profile_manager()->GetMutableProfileInfo(); |
| 418 ListValue profile_info_list; | 418 ListValue profile_info_list; |
| 419 FilePath current_profile_path = | 419 FilePath current_profile_path = |
| 420 web_ui_->tab_contents()->browser_context()->GetPath(); | 420 web_ui_->tab_contents()->browser_context()->GetPath(); |
| 421 for (size_t i = 0, e = cache.GetNumberOfProfiles(); i < e; ++i) { | 421 for (size_t i = 0, e = cache.GetNumberOfProfiles(); i < e; ++i) { |
| 422 DictionaryValue *profile_value = new DictionaryValue(); | 422 DictionaryValue *profile_value = new DictionaryValue(); |
| 423 size_t icon_index = cache.GetAvatarIconIndexOfProfileAtIndex(i); | 423 size_t icon_index = cache.GetAvatarIconIndexOfProfileAtIndex(i); |
| 424 FilePath profile_path = cache.GetPathOfProfileAtIndex(i); | 424 FilePath profile_path = cache.GetPathOfProfileAtIndex(i); |
| 425 profile_value->SetString("name", cache.GetNameOfProfileAtIndex(i)); | 425 profile_value->SetString("name", cache.GetNameOfProfileAtIndex(i)); |
| 426 profile_value->SetString("iconURL", | 426 profile_value->SetString("iconURL", |
| 427 cache.GetDefaultAvatarIconUrl(icon_index)); | 427 cache.GetDefaultAvatarIconUrl(icon_index)); |
| 428 profile_value->Set("filePath", | 428 profile_value->Set("filePath", |
| 429 base::CreateFilePathValue( | 429 base::CreateFilePathValue( |
| 430 profile_path)); | 430 profile_path)); |
| 431 profile_value->SetBoolean("isCurrentProfile", | 431 profile_value->SetBoolean("isCurrentProfile", |
| 432 profile_path == current_profile_path); | 432 profile_path == current_profile_path); |
| 433 profile_info_list.Append(profile_value); | 433 profile_info_list.Append(profile_value); |
| 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 |
| OLD | NEW |