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/manage_profile_handler.h" | 5 #include "chrome/browser/ui/webui/options/manage_profile_handler.h" |
6 | 6 |
7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "base/value_conversions.h" | 9 #include "base/value_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 image_url_list.Append(Value::CreateStringValue(url)); | 69 image_url_list.Append(Value::CreateStringValue(url)); |
70 } | 70 } |
71 | 71 |
72 web_ui_->CallJavascriptFunction( | 72 web_ui_->CallJavascriptFunction( |
73 "ManageProfileOverlay.receiveDefaultProfileIcons", | 73 "ManageProfileOverlay.receiveDefaultProfileIcons", |
74 image_url_list); | 74 image_url_list); |
75 } | 75 } |
76 | 76 |
77 void ManageProfileHandler::SendProfileNames() { | 77 void ManageProfileHandler::SendProfileNames() { |
78 ProfileInfoCache& cache = | 78 ProfileInfoCache& cache = |
79 g_browser_process->profile_manager()->GetMutableProfileInfo(); | 79 g_browser_process->profile_manager()->GetProfileInfoCache(); |
80 DictionaryValue profile_name_dict; | 80 DictionaryValue profile_name_dict; |
81 for (size_t i = 0, e = cache.GetNumberOfProfiles(); i < e; ++i) | 81 for (size_t i = 0, e = cache.GetNumberOfProfiles(); i < e; ++i) |
82 profile_name_dict.SetBoolean(UTF16ToUTF8(cache.GetNameOfProfileAtIndex(i)), | 82 profile_name_dict.SetBoolean(UTF16ToUTF8(cache.GetNameOfProfileAtIndex(i)), |
83 true); | 83 true); |
84 | 84 |
85 web_ui_->CallJavascriptFunction("ManageProfileOverlay.receiveProfileNames", | 85 web_ui_->CallJavascriptFunction("ManageProfileOverlay.receiveProfileNames", |
86 profile_name_dict); | 86 profile_name_dict); |
87 } | 87 } |
88 | 88 |
89 void ManageProfileHandler::SetProfileNameAndIcon(const ListValue* args) { | 89 void ManageProfileHandler::SetProfileNameAndIcon(const ListValue* args) { |
90 Value* file_path_value; | 90 Value* file_path_value; |
91 FilePath profile_file_path; | 91 FilePath profile_file_path; |
92 if (!args->Get(0, &file_path_value) || | 92 if (!args->Get(0, &file_path_value) || |
93 !base::GetValueAsFilePath(*file_path_value, &profile_file_path)) | 93 !base::GetValueAsFilePath(*file_path_value, &profile_file_path)) |
94 return; | 94 return; |
95 | 95 |
96 ProfileInfoCache& cache = | 96 ProfileInfoCache& cache = |
97 g_browser_process->profile_manager()->GetMutableProfileInfo(); | 97 g_browser_process->profile_manager()->GetProfileInfoCache(); |
98 size_t profile_index = cache.GetIndexOfProfileWithPath(profile_file_path); | 98 size_t profile_index = cache.GetIndexOfProfileWithPath(profile_file_path); |
99 if (profile_index == std::string::npos) | 99 if (profile_index == std::string::npos) |
100 return; | 100 return; |
101 | 101 |
102 string16 new_profile_name; | 102 string16 new_profile_name; |
103 if (!args->GetString(1, &new_profile_name)) | 103 if (!args->GetString(1, &new_profile_name)) |
104 return; | 104 return; |
105 | 105 |
106 cache.SetNameOfProfileAtIndex(profile_index, new_profile_name); | 106 cache.SetNameOfProfileAtIndex(profile_index, new_profile_name); |
107 | 107 |
(...skipping 10 matching lines...) Expand all Loading... |
118 Value* file_path_value; | 118 Value* file_path_value; |
119 FilePath profile_file_path; | 119 FilePath profile_file_path; |
120 if (!args->Get(0, &file_path_value) || | 120 if (!args->Get(0, &file_path_value) || |
121 !base::GetValueAsFilePath(*file_path_value, &profile_file_path)) | 121 !base::GetValueAsFilePath(*file_path_value, &profile_file_path)) |
122 return; | 122 return; |
123 | 123 |
124 g_browser_process->profile_manager()->ScheduleProfileForDeletion( | 124 g_browser_process->profile_manager()->ScheduleProfileForDeletion( |
125 profile_file_path); | 125 profile_file_path); |
126 } | 126 } |
127 | 127 |
OLD | NEW |