Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/options2/manage_profile_handler2.h" | 5 #include "chrome/browser/ui/webui/options2/manage_profile_handler2.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "base/value_conversions.h" | 11 #include "base/value_conversions.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/prefs/pref_service.h" | |
| 14 #include "chrome/browser/profiles/gaia_info_update_service.h" | 15 #include "chrome/browser/profiles/gaia_info_update_service.h" |
| 15 #include "chrome/browser/profiles/profile_info_cache.h" | 16 #include "chrome/browser/profiles/profile_info_cache.h" |
| 16 #include "chrome/browser/profiles/profile_info_util.h" | 17 #include "chrome/browser/profiles/profile_info_util.h" |
| 17 #include "chrome/browser/profiles/profile_manager.h" | 18 #include "chrome/browser/profiles/profile_manager.h" |
| 18 #include "chrome/browser/profiles/profile_metrics.h" | 19 #include "chrome/browser/profiles/profile_metrics.h" |
| 19 #include "chrome/browser/ui/webui/web_ui_util.h" | 20 #include "chrome/browser/ui/webui/web_ui_util.h" |
| 20 #include "chrome/common/chrome_notification_types.h" | 21 #include "chrome/common/chrome_notification_types.h" |
| 22 #include "chrome/common/pref_names.h" | |
| 21 #include "content/public/browser/notification_service.h" | 23 #include "content/public/browser/notification_service.h" |
| 22 #include "content/public/browser/web_ui.h" | 24 #include "content/public/browser/web_ui.h" |
| 23 #include "grit/generated_resources.h" | 25 #include "grit/generated_resources.h" |
| 24 | 26 |
| 25 namespace options2 { | 27 namespace options2 { |
| 26 | 28 |
| 27 ManageProfileHandler::ManageProfileHandler() { | 29 ManageProfileHandler::ManageProfileHandler() { |
| 28 } | 30 } |
| 29 | 31 |
| 30 ManageProfileHandler::~ManageProfileHandler() { | 32 ManageProfileHandler::~ManageProfileHandler() { |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 ProfileMetrics::LogProfileAvatarSelection(new_icon_index); | 196 ProfileMetrics::LogProfileAvatarSelection(new_icon_index); |
| 195 cache.SetAvatarIconOfProfileAtIndex(profile_index, new_icon_index); | 197 cache.SetAvatarIconOfProfileAtIndex(profile_index, new_icon_index); |
| 196 cache.SetIsUsingGAIAPictureOfProfileAtIndex(profile_index, false); | 198 cache.SetIsUsingGAIAPictureOfProfileAtIndex(profile_index, false); |
| 197 } | 199 } |
| 198 | 200 |
| 199 ProfileMetrics::LogProfileUpdate(profile_file_path); | 201 ProfileMetrics::LogProfileUpdate(profile_file_path); |
| 200 } | 202 } |
| 201 | 203 |
| 202 void ManageProfileHandler::DeleteProfile(const ListValue* args) { | 204 void ManageProfileHandler::DeleteProfile(const ListValue* args) { |
| 203 DCHECK(args); | 205 DCHECK(args); |
| 206 if (!g_browser_process->local_state()->GetBoolean(prefs::kInManagedMode)) { | |
|
Joao da Silva
2012/02/23 12:05:14
Same?
Bernhard Bauer
2012/02/23 12:14:36
Yeah (you can tell I didn't test this patch set ye
| |
| 207 NOTREACHED(); | |
| 208 return; | |
| 209 } | |
| 204 | 210 |
| 205 ProfileMetrics::LogProfileDeleteUser(ProfileMetrics::PROFILE_DELETED); | 211 ProfileMetrics::LogProfileDeleteUser(ProfileMetrics::PROFILE_DELETED); |
| 206 | 212 |
| 207 Value* file_path_value; | 213 Value* file_path_value; |
| 208 FilePath profile_file_path; | 214 FilePath profile_file_path; |
| 209 if (!args->Get(0, &file_path_value) || | 215 if (!args->Get(0, &file_path_value) || |
| 210 !base::GetValueAsFilePath(*file_path_value, &profile_file_path)) | 216 !base::GetValueAsFilePath(*file_path_value, &profile_file_path)) |
| 211 return; | 217 return; |
| 212 | 218 |
| 213 g_browser_process->profile_manager()->ScheduleProfileForDeletion( | 219 g_browser_process->profile_manager()->ScheduleProfileForDeletion( |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 296 string16 gaia_name = cache.GetGAIANameOfProfileAtIndex(i); | 302 string16 gaia_name = cache.GetGAIANameOfProfileAtIndex(i); |
| 297 if (gaia_name.empty()) | 303 if (gaia_name.empty()) |
| 298 return; | 304 return; |
| 299 | 305 |
| 300 StringValue gaia_name_value(gaia_name); | 306 StringValue gaia_name_value(gaia_name); |
| 301 web_ui()->CallJavascriptFunction("ManageProfileOverlay.setProfileName", | 307 web_ui()->CallJavascriptFunction("ManageProfileOverlay.setProfileName", |
| 302 gaia_name_value); | 308 gaia_name_value); |
| 303 } | 309 } |
| 304 | 310 |
| 305 } // namespace options2 | 311 } // namespace options2 |
| OLD | NEW |