| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/profiles/profile_window.h" | 5 #include "chrome/browser/profiles/profile_window.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.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" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "chrome/browser/about_flags.h" | 12 #include "chrome/browser/about_flags.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/lifetime/application_lifetime.h" | 14 #include "chrome/browser/lifetime/application_lifetime.h" |
| 15 #include "chrome/browser/pref_service_flags_storage.h" | 15 #include "chrome/browser/pref_service_flags_storage.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 17 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
| 18 #include "chrome/browser/profiles/profile_manager.h" | 18 #include "chrome/browser/profiles/profile_manager.h" |
| 19 #include "chrome/browser/signin/account_reconcilor_factory.h" | 19 #include "chrome/browser/signin/account_reconcilor_factory.h" |
| 20 #include "chrome/browser/ui/browser.h" | 20 #include "chrome/browser/ui/browser.h" |
| 21 #include "chrome/browser/ui/browser_dialogs.h" | 21 #include "chrome/browser/ui/browser_dialogs.h" |
| 22 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
| 23 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
| 24 #include "chrome/common/url_constants.h" | 24 #include "chrome/common/url_constants.h" |
| 25 #include "components/signin/core/browser/account_reconcilor.h" | 25 #include "components/signin/core/browser/account_reconcilor.h" |
| 26 #include "components/signin/core/common/profile_management_switches.h" | |
| 27 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
| 28 #include "content/public/browser/user_metrics.h" | 27 #include "content/public/browser/user_metrics.h" |
| 29 | 28 |
| 30 #if !defined(OS_IOS) | 29 #if !defined(OS_IOS) |
| 31 #include "chrome/browser/ui/browser_finder.h" | 30 #include "chrome/browser/ui/browser_finder.h" |
| 32 #include "chrome/browser/ui/browser_list.h" | 31 #include "chrome/browser/ui/browser_list.h" |
| 33 #include "chrome/browser/ui/browser_list_observer.h" | 32 #include "chrome/browser/ui/browser_list_observer.h" |
| 34 #include "chrome/browser/ui/browser_window.h" | 33 #include "chrome/browser/ui/browser_window.h" |
| 35 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 34 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
| 36 #endif // !defined (OS_IOS) | 35 #endif // !defined (OS_IOS) |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 | 310 |
| 312 if (tutorial_shown) { | 311 if (tutorial_shown) { |
| 313 chrome::ShowUserManager(profile->GetPath()); | 312 chrome::ShowUserManager(profile->GetPath()); |
| 314 } else { | 313 } else { |
| 315 chrome::ShowUserManagerWithTutorial( | 314 chrome::ShowUserManagerWithTutorial( |
| 316 profiles::USER_MANAGER_TUTORIAL_OVERVIEW); | 315 profiles::USER_MANAGER_TUTORIAL_OVERVIEW); |
| 317 } | 316 } |
| 318 } | 317 } |
| 319 | 318 |
| 320 void EnableNewProfileManagementPreview(Profile* profile) { | 319 void EnableNewProfileManagementPreview(Profile* profile) { |
| 321 #if defined(OS_ANDROID) | |
| 322 NOTREACHED(); | |
| 323 #else | |
| 324 about_flags::PrefServiceFlagsStorage flags_storage( | 320 about_flags::PrefServiceFlagsStorage flags_storage( |
| 325 g_browser_process->local_state()); | 321 g_browser_process->local_state()); |
| 326 about_flags::SetExperimentEnabled( | 322 about_flags::SetExperimentEnabled( |
| 327 &flags_storage, | 323 &flags_storage, |
| 328 kNewProfileManagementExperimentInternalName, | 324 kNewProfileManagementExperimentInternalName, |
| 329 true); | 325 true); |
| 330 | 326 |
| 331 switches::EnableNewProfileManagementForTesting( | 327 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 332 CommandLine::ForCurrentProcess()); | 328 switches::kNewProfileManagement); |
| 333 chrome::ShowUserManagerWithTutorial(profiles::USER_MANAGER_TUTORIAL_OVERVIEW); | 329 chrome::ShowUserManagerWithTutorial(profiles::USER_MANAGER_TUTORIAL_OVERVIEW); |
| 334 UpdateServicesWithNewProfileManagementFlag(profile, true); | 330 UpdateServicesWithNewProfileManagementFlag(profile, true); |
| 335 #endif | |
| 336 } | 331 } |
| 337 | 332 |
| 338 void DisableNewProfileManagementPreview(Profile* profile) { | 333 void DisableNewProfileManagementPreview(Profile* profile) { |
| 339 about_flags::PrefServiceFlagsStorage flags_storage( | 334 about_flags::PrefServiceFlagsStorage flags_storage( |
| 340 g_browser_process->local_state()); | 335 g_browser_process->local_state()); |
| 341 about_flags::SetExperimentEnabled( | 336 about_flags::SetExperimentEnabled( |
| 342 &flags_storage, | 337 &flags_storage, |
| 343 kNewProfileManagementExperimentInternalName, | 338 kNewProfileManagementExperimentInternalName, |
| 344 false); | 339 false); |
| 345 chrome::AttemptRestart(); | 340 chrome::AttemptRestart(); |
| 346 UpdateServicesWithNewProfileManagementFlag(profile, false); | 341 UpdateServicesWithNewProfileManagementFlag(profile, false); |
| 347 } | 342 } |
| 348 | 343 |
| 349 } // namespace profiles | 344 } // namespace profiles |
| OLD | NEW |