| 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/bind.h" | 10 #include "base/bind.h" |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 } | 381 } |
| 382 #endif | 382 #endif |
| 383 | 383 |
| 384 void PersonalOptionsHandler::SendProfilesInfo() { | 384 void PersonalOptionsHandler::SendProfilesInfo() { |
| 385 ProfileInfoCache& cache = | 385 ProfileInfoCache& cache = |
| 386 g_browser_process->profile_manager()->GetProfileInfoCache(); | 386 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 387 ListValue profile_info_list; | 387 ListValue profile_info_list; |
| 388 FilePath current_profile_path = | 388 FilePath current_profile_path = |
| 389 web_ui_->tab_contents()->browser_context()->GetPath(); | 389 web_ui_->tab_contents()->browser_context()->GetPath(); |
| 390 for (size_t i = 0, e = cache.GetNumberOfProfiles(); i < e; ++i) { | 390 for (size_t i = 0, e = cache.GetNumberOfProfiles(); i < e; ++i) { |
| 391 DictionaryValue *profile_value = new DictionaryValue(); | 391 DictionaryValue* profile_value = new DictionaryValue(); |
| 392 size_t icon_index = cache.GetAvatarIconIndexOfProfileAtIndex(i); | 392 size_t icon_index = cache.GetAvatarIconIndexOfProfileAtIndex(i); |
| 393 FilePath profile_path = cache.GetPathOfProfileAtIndex(i); | 393 FilePath profile_path = cache.GetPathOfProfileAtIndex(i); |
| 394 profile_value->SetString("name", cache.GetNameOfProfileAtIndex(i)); | 394 profile_value->SetString("name", cache.GetNameOfProfileAtIndex(i)); |
| 395 profile_value->SetString("iconURL", | 395 profile_value->SetString("iconURL", |
| 396 cache.GetDefaultAvatarIconUrl(icon_index)); | 396 cache.GetDefaultAvatarIconUrl(icon_index)); |
| 397 profile_value->Set("filePath", | 397 profile_value->Set("filePath", base::CreateFilePathValue(profile_path)); |
| 398 base::CreateFilePathValue( | |
| 399 profile_path)); | |
| 400 profile_value->SetBoolean("isCurrentProfile", | 398 profile_value->SetBoolean("isCurrentProfile", |
| 401 profile_path == current_profile_path); | 399 profile_path == current_profile_path); |
| 402 profile_info_list.Append(profile_value); | 400 profile_info_list.Append(profile_value); |
| 403 } | 401 } |
| 404 | 402 |
| 405 web_ui_->CallJavascriptFunction("PersonalOptions.setProfilesInfo", | 403 web_ui_->CallJavascriptFunction("PersonalOptions.setProfilesInfo", |
| 406 profile_info_list); | 404 profile_info_list); |
| 407 } | 405 } |
| 408 | 406 |
| 409 void PersonalOptionsHandler::CreateProfile(const ListValue* args) { | 407 void PersonalOptionsHandler::CreateProfile(const ListValue* args) { |
| 410 ProfileManager::CreateMultiProfileAsync(); | 408 ProfileManager::CreateMultiProfileAsync(); |
| 411 } | 409 } |
| OLD | NEW |