| 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/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "content/public/browser/web_ui.h" | 27 #include "content/public/browser/web_ui.h" |
| 28 #include "grit/generated_resources.h" | 28 #include "grit/generated_resources.h" |
| 29 #include "ui/webui/web_ui_util.h" | 29 #include "ui/webui/web_ui_util.h" |
| 30 | 30 |
| 31 #if defined(ENABLE_MANAGED_USERS) | 31 #if defined(ENABLE_MANAGED_USERS) |
| 32 #include "chrome/browser/managed_mode/managed_user_service.h" | 32 #include "chrome/browser/managed_mode/managed_user_service.h" |
| 33 #include "chrome/browser/managed_mode/managed_user_service_factory.h" | 33 #include "chrome/browser/managed_mode/managed_user_service_factory.h" |
| 34 #endif | 34 #endif |
| 35 | 35 |
| 36 #if defined(ENABLE_SETTINGS_APP) | 36 #if defined(ENABLE_SETTINGS_APP) |
| 37 #include "chrome/browser/ui/app_list/app_list_util.h" | 37 #include "chrome/browser/ui/app_list/app_list_service.h" |
| 38 #include "content/public/browser/web_contents.h" | 38 #include "content/public/browser/web_contents.h" |
| 39 #endif | 39 #endif |
| 40 | 40 |
| 41 namespace options { | 41 namespace options { |
| 42 | 42 |
| 43 namespace { | 43 namespace { |
| 44 | 44 |
| 45 const char kCreateProfileIconGridName[] = "create-profile-icon-grid"; | 45 const char kCreateProfileIconGridName[] = "create-profile-icon-grid"; |
| 46 const char kManageProfileIconGridName[] = "manage-profile-icon-grid"; | 46 const char kManageProfileIconGridName[] = "manage-profile-icon-grid"; |
| 47 | 47 |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 void ManageProfileHandler::SwitchAppListProfile(const ListValue* args) { | 323 void ManageProfileHandler::SwitchAppListProfile(const ListValue* args) { |
| 324 DCHECK(args); | 324 DCHECK(args); |
| 325 DCHECK(ProfileManager::IsMultipleProfilesEnabled()); | 325 DCHECK(ProfileManager::IsMultipleProfilesEnabled()); |
| 326 | 326 |
| 327 const Value* file_path_value; | 327 const Value* file_path_value; |
| 328 base::FilePath profile_file_path; | 328 base::FilePath profile_file_path; |
| 329 if (!args->Get(0, &file_path_value) || | 329 if (!args->Get(0, &file_path_value) || |
| 330 !base::GetValueAsFilePath(*file_path_value, &profile_file_path)) | 330 !base::GetValueAsFilePath(*file_path_value, &profile_file_path)) |
| 331 return; | 331 return; |
| 332 | 332 |
| 333 chrome::SetAppListProfile(profile_file_path); | 333 AppListService::Get()->SetAppListProfile(profile_file_path); |
| 334 // Close the settings app, since it will now be for the wrong profile. | 334 // Close the settings app, since it will now be for the wrong profile. |
| 335 web_ui()->GetWebContents()->Close(); | 335 web_ui()->GetWebContents()->Close(); |
| 336 } | 336 } |
| 337 #endif // defined(ENABLE_SETTINGS_APP) | 337 #endif // defined(ENABLE_SETTINGS_APP) |
| 338 | 338 |
| 339 void ManageProfileHandler::ProfileIconSelectionChanged( | 339 void ManageProfileHandler::ProfileIconSelectionChanged( |
| 340 const base::ListValue* args) { | 340 const base::ListValue* args) { |
| 341 DCHECK(args); | 341 DCHECK(args); |
| 342 | 342 |
| 343 base::FilePath profile_file_path; | 343 base::FilePath profile_file_path; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 g_browser_process->profile_manager()->profile_shortcut_manager(); | 428 g_browser_process->profile_manager()->profile_shortcut_manager(); |
| 429 DCHECK(shortcut_manager); | 429 DCHECK(shortcut_manager); |
| 430 | 430 |
| 431 shortcut_manager->RemoveProfileShortcuts(profile_file_path); | 431 shortcut_manager->RemoveProfileShortcuts(profile_file_path); |
| 432 | 432 |
| 433 // Update the UI buttons. | 433 // Update the UI buttons. |
| 434 OnHasProfileShortcuts(false); | 434 OnHasProfileShortcuts(false); |
| 435 } | 435 } |
| 436 | 436 |
| 437 } // namespace options | 437 } // namespace options |
| OLD | NEW |