| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| 11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/value_conversions.h" | 13 #include "base/value_conversions.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 16 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
| 17 #include "chrome/browser/managed_mode/managed_user_service.h" | 17 #include "chrome/browser/managed_mode/managed_user_service.h" |
| 18 #include "chrome/browser/profiles/gaia_info_update_service.h" | 18 #include "chrome/browser/profiles/gaia_info_update_service.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/profiles/profile_info_cache.h" | 20 #include "chrome/browser/profiles/profile_info_cache.h" |
| 21 #include "chrome/browser/profiles/profile_info_util.h" | 21 #include "chrome/browser/profiles/profile_info_util.h" |
| 22 #include "chrome/browser/profiles/profile_manager.h" | 22 #include "chrome/browser/profiles/profile_manager.h" |
| 23 #include "chrome/browser/profiles/profile_manager_util.h" |
| 23 #include "chrome/browser/profiles/profile_metrics.h" | 24 #include "chrome/browser/profiles/profile_metrics.h" |
| 24 #include "chrome/browser/profiles/profile_shortcut_manager.h" | 25 #include "chrome/browser/profiles/profile_shortcut_manager.h" |
| 25 #include "chrome/browser/signin/signin_manager.h" | 26 #include "chrome/browser/signin/signin_manager.h" |
| 26 #include "chrome/browser/signin/signin_manager_factory.h" | 27 #include "chrome/browser/signin/signin_manager_factory.h" |
| 27 #include "chrome/browser/ui/browser_finder.h" | 28 #include "chrome/browser/ui/browser_finder.h" |
| 28 #include "chrome/common/chrome_switches.h" | 29 #include "chrome/common/chrome_switches.h" |
| 29 #include "chrome/common/pref_names.h" | 30 #include "chrome/common/pref_names.h" |
| 30 #include "content/public/browser/browser_thread.h" | 31 #include "content/public/browser/browser_thread.h" |
| 31 #include "content/public/browser/notification_service.h" | 32 #include "content/public/browser/notification_service.h" |
| 32 #include "content/public/browser/web_ui.h" | 33 #include "content/public/browser/web_ui.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 59 if (!args->Get(0, &file_path_value)) | 60 if (!args->Get(0, &file_path_value)) |
| 60 return false; | 61 return false; |
| 61 return base::GetValueAsFilePath(*file_path_value, profile_file_path); | 62 return base::GetValueAsFilePath(*file_path_value, profile_file_path); |
| 62 } | 63 } |
| 63 | 64 |
| 64 void OnNewDefaultProfileCreated( | 65 void OnNewDefaultProfileCreated( |
| 65 chrome::HostDesktopType desktop_type, | 66 chrome::HostDesktopType desktop_type, |
| 66 Profile* profile, | 67 Profile* profile, |
| 67 Profile::CreateStatus status) { | 68 Profile::CreateStatus status) { |
| 68 if (status == Profile::CREATE_STATUS_INITIALIZED) { | 69 if (status == Profile::CREATE_STATUS_INITIALIZED) { |
| 69 ProfileManager::FindOrCreateNewWindowForProfile( | 70 profiles::FindOrCreateNewWindowForProfile( |
| 70 profile, | 71 profile, |
| 71 chrome::startup::IS_PROCESS_STARTUP, | 72 chrome::startup::IS_PROCESS_STARTUP, |
| 72 chrome::startup::IS_FIRST_RUN, | 73 chrome::startup::IS_FIRST_RUN, |
| 73 desktop_type, | 74 desktop_type, |
| 74 false); | 75 false); |
| 75 } | 76 } |
| 76 } | 77 } |
| 77 | 78 |
| 78 } // namespace | 79 } // namespace |
| 79 | 80 |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 // this preference. | 322 // this preference. |
| 322 pref_service->SetInteger(prefs::kProfileAvatarIndex, new_icon_index); | 323 pref_service->SetInteger(prefs::kProfileAvatarIndex, new_icon_index); |
| 323 cache.SetIsUsingGAIAPictureOfProfileAtIndex(profile_index, false); | 324 cache.SetIsUsingGAIAPictureOfProfileAtIndex(profile_index, false); |
| 324 } | 325 } |
| 325 ProfileMetrics::LogProfileUpdate(profile_file_path); | 326 ProfileMetrics::LogProfileUpdate(profile_file_path); |
| 326 } | 327 } |
| 327 | 328 |
| 328 #if defined(ENABLE_SETTINGS_APP) | 329 #if defined(ENABLE_SETTINGS_APP) |
| 329 void ManageProfileHandler::SwitchAppListProfile(const ListValue* args) { | 330 void ManageProfileHandler::SwitchAppListProfile(const ListValue* args) { |
| 330 DCHECK(args); | 331 DCHECK(args); |
| 331 DCHECK(ProfileManager::IsMultipleProfilesEnabled()); | 332 DCHECK(profiles::IsMultipleProfilesEnabled()); |
| 332 | 333 |
| 333 const Value* file_path_value; | 334 const Value* file_path_value; |
| 334 base::FilePath profile_file_path; | 335 base::FilePath profile_file_path; |
| 335 if (!args->Get(0, &file_path_value) || | 336 if (!args->Get(0, &file_path_value) || |
| 336 !base::GetValueAsFilePath(*file_path_value, &profile_file_path)) | 337 !base::GetValueAsFilePath(*file_path_value, &profile_file_path)) |
| 337 return; | 338 return; |
| 338 | 339 |
| 339 AppListService::Get()->SetAppListProfile(profile_file_path); | 340 AppListService::Get()->SetAppListProfile(profile_file_path); |
| 340 // Close the settings app, since it will now be for the wrong profile. | 341 // Close the settings app, since it will now be for the wrong profile. |
| 341 web_ui()->GetWebContents()->Close(); | 342 web_ui()->GetWebContents()->Close(); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 g_browser_process->profile_manager()->profile_shortcut_manager(); | 455 g_browser_process->profile_manager()->profile_shortcut_manager(); |
| 455 DCHECK(shortcut_manager); | 456 DCHECK(shortcut_manager); |
| 456 | 457 |
| 457 shortcut_manager->RemoveProfileShortcuts(profile_file_path); | 458 shortcut_manager->RemoveProfileShortcuts(profile_file_path); |
| 458 | 459 |
| 459 // Update the UI buttons. | 460 // Update the UI buttons. |
| 460 OnHasProfileShortcuts(false); | 461 OnHasProfileShortcuts(false); |
| 461 } | 462 } |
| 462 | 463 |
| 463 } // namespace options | 464 } // namespace options |
| OLD | NEW |