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" |
26 #include "content/public/browser/browser_thread.h" | 27 #include "content/public/browser/browser_thread.h" |
27 #include "content/public/browser/user_metrics.h" | 28 #include "content/public/browser/user_metrics.h" |
28 | 29 |
29 #if !defined(OS_IOS) | 30 #if !defined(OS_IOS) |
30 #include "chrome/browser/ui/browser_finder.h" | 31 #include "chrome/browser/ui/browser_finder.h" |
31 #include "chrome/browser/ui/browser_list.h" | 32 #include "chrome/browser/ui/browser_list.h" |
32 #include "chrome/browser/ui/browser_list_observer.h" | 33 #include "chrome/browser/ui/browser_list_observer.h" |
33 #include "chrome/browser/ui/browser_window.h" | 34 #include "chrome/browser/ui/browser_window.h" |
34 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 35 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
35 #endif // !defined (OS_IOS) | 36 #endif // !defined (OS_IOS) |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 | 311 |
311 if (tutorial_shown) { | 312 if (tutorial_shown) { |
312 chrome::ShowUserManager(profile->GetPath()); | 313 chrome::ShowUserManager(profile->GetPath()); |
313 } else { | 314 } else { |
314 chrome::ShowUserManagerWithTutorial( | 315 chrome::ShowUserManagerWithTutorial( |
315 profiles::USER_MANAGER_TUTORIAL_OVERVIEW); | 316 profiles::USER_MANAGER_TUTORIAL_OVERVIEW); |
316 } | 317 } |
317 } | 318 } |
318 | 319 |
319 void EnableNewProfileManagementPreview(Profile* profile) { | 320 void EnableNewProfileManagementPreview(Profile* profile) { |
| 321 #if defined(OS_ANDROID) |
| 322 NOTREACHED(); |
| 323 #else |
320 about_flags::PrefServiceFlagsStorage flags_storage( | 324 about_flags::PrefServiceFlagsStorage flags_storage( |
321 g_browser_process->local_state()); | 325 g_browser_process->local_state()); |
322 about_flags::SetExperimentEnabled( | 326 about_flags::SetExperimentEnabled( |
323 &flags_storage, | 327 &flags_storage, |
324 kNewProfileManagementExperimentInternalName, | 328 kNewProfileManagementExperimentInternalName, |
325 true); | 329 true); |
326 | 330 |
327 CommandLine::ForCurrentProcess()->AppendSwitch( | 331 switches::EnableNewProfileManagementForTesting( |
328 switches::kNewProfileManagement); | 332 CommandLine::ForCurrentProcess()); |
329 chrome::ShowUserManagerWithTutorial(profiles::USER_MANAGER_TUTORIAL_OVERVIEW); | 333 chrome::ShowUserManagerWithTutorial(profiles::USER_MANAGER_TUTORIAL_OVERVIEW); |
330 UpdateServicesWithNewProfileManagementFlag(profile, true); | 334 UpdateServicesWithNewProfileManagementFlag(profile, true); |
| 335 #endif |
331 } | 336 } |
332 | 337 |
333 void DisableNewProfileManagementPreview(Profile* profile) { | 338 void DisableNewProfileManagementPreview(Profile* profile) { |
334 about_flags::PrefServiceFlagsStorage flags_storage( | 339 about_flags::PrefServiceFlagsStorage flags_storage( |
335 g_browser_process->local_state()); | 340 g_browser_process->local_state()); |
336 about_flags::SetExperimentEnabled( | 341 about_flags::SetExperimentEnabled( |
337 &flags_storage, | 342 &flags_storage, |
338 kNewProfileManagementExperimentInternalName, | 343 kNewProfileManagementExperimentInternalName, |
339 false); | 344 false); |
340 chrome::AttemptRestart(); | 345 chrome::AttemptRestart(); |
341 UpdateServicesWithNewProfileManagementFlag(profile, false); | 346 UpdateServicesWithNewProfileManagementFlag(profile, false); |
342 } | 347 } |
343 | 348 |
344 } // namespace profiles | 349 } // namespace profiles |
OLD | NEW |