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" |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 profiles::USER_MANAGER_TUTORIAL_OVERVIEW, | 445 profiles::USER_MANAGER_TUTORIAL_OVERVIEW, |
446 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); | 446 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); |
447 } | 447 } |
448 | 448 |
449 void EnableNewProfileManagementPreview(Profile* profile) { | 449 void EnableNewProfileManagementPreview(Profile* profile) { |
450 #if defined(OS_ANDROID) | 450 #if defined(OS_ANDROID) |
451 NOTREACHED(); | 451 NOTREACHED(); |
452 #else | 452 #else |
453 // TODO(rogerta): instead of setting experiment flags and command line | 453 // TODO(rogerta): instead of setting experiment flags and command line |
454 // args, we should set a profile preference. | 454 // args, we should set a profile preference. |
455 const about_flags::Experiment experiment = { | 455 const about_flags::Entry entry = { |
456 kNewProfileManagementExperimentInternalName, | 456 kNewProfileManagementExperimentInternalName, |
457 0, // string id for title of experiment | 457 0, // string id for title of experiment |
458 0, // string id for description of experiment | 458 0, // string id for description of experiment |
459 0, // supported platforms | 459 0, // supported platforms |
460 about_flags::Experiment::ENABLE_DISABLE_VALUE, | 460 about_flags::Entry::ENABLE_DISABLE_VALUE, |
461 switches::kEnableNewProfileManagement, | 461 switches::kEnableNewProfileManagement, |
462 "", // not used with ENABLE_DISABLE_VALUE type | 462 "", // not used with ENABLE_DISABLE_VALUE type |
463 switches::kDisableNewProfileManagement, | 463 switches::kDisableNewProfileManagement, |
464 "", // not used with ENABLE_DISABLE_VALUE type | 464 "", // not used with ENABLE_DISABLE_VALUE type |
465 NULL, // not used with ENABLE_DISABLE_VALUE type | 465 NULL, // not used with ENABLE_DISABLE_VALUE type |
466 3 | 466 3 |
467 }; | 467 }; |
468 about_flags::PrefServiceFlagsStorage flags_storage( | 468 about_flags::PrefServiceFlagsStorage flags_storage( |
469 g_browser_process->local_state()); | 469 g_browser_process->local_state()); |
470 about_flags::SetExperimentEnabled( | 470 about_flags::SetEntryEnabled(&flags_storage, entry.NameForChoice(1), true); |
471 &flags_storage, | |
472 experiment.NameForChoice(1), | |
473 true); | |
474 | 471 |
475 switches::EnableNewProfileManagementForTesting( | 472 switches::EnableNewProfileManagementForTesting( |
476 base::CommandLine::ForCurrentProcess()); | 473 base::CommandLine::ForCurrentProcess()); |
477 UserManager::Show(base::FilePath(), | 474 UserManager::Show(base::FilePath(), |
478 profiles::USER_MANAGER_TUTORIAL_OVERVIEW, | 475 profiles::USER_MANAGER_TUTORIAL_OVERVIEW, |
479 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); | 476 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); |
480 UpdateServicesWithNewProfileManagementFlag(profile, true); | 477 UpdateServicesWithNewProfileManagementFlag(profile, true); |
481 #endif | 478 #endif |
482 } | 479 } |
483 | 480 |
484 void DisableNewProfileManagementPreview(Profile* profile) { | 481 void DisableNewProfileManagementPreview(Profile* profile) { |
485 about_flags::PrefServiceFlagsStorage flags_storage( | 482 about_flags::PrefServiceFlagsStorage flags_storage( |
486 g_browser_process->local_state()); | 483 g_browser_process->local_state()); |
487 about_flags::SetExperimentEnabled( | 484 about_flags::SetEntryEnabled( |
488 &flags_storage, | 485 &flags_storage, |
489 kNewProfileManagementExperimentInternalName, | 486 kNewProfileManagementExperimentInternalName, |
490 false); | 487 false); |
491 chrome::AttemptRestart(); | 488 chrome::AttemptRestart(); |
492 UpdateServicesWithNewProfileManagementFlag(profile, false); | 489 UpdateServicesWithNewProfileManagementFlag(profile, false); |
493 } | 490 } |
494 | 491 |
495 void BubbleViewModeFromAvatarBubbleMode( | 492 void BubbleViewModeFromAvatarBubbleMode( |
496 BrowserWindow::AvatarBubbleMode mode, | 493 BrowserWindow::AvatarBubbleMode mode, |
497 BubbleViewMode* bubble_view_mode, | 494 BubbleViewMode* bubble_view_mode, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 PrefService* local_state = g_browser_process->local_state(); | 539 PrefService* local_state = g_browser_process->local_state(); |
543 const bool dismissed = local_state->GetBoolean( | 540 const bool dismissed = local_state->GetBoolean( |
544 prefs::kProfileAvatarRightClickTutorialDismissed); | 541 prefs::kProfileAvatarRightClickTutorialDismissed); |
545 | 542 |
546 // Don't show the tutorial if it's already been dismissed or if right-clicking | 543 // Don't show the tutorial if it's already been dismissed or if right-clicking |
547 // wouldn't show any targets. | 544 // wouldn't show any targets. |
548 return !dismissed && HasProfileSwitchTargets(profile); | 545 return !dismissed && HasProfileSwitchTargets(profile); |
549 } | 546 } |
550 | 547 |
551 } // namespace profiles | 548 } // namespace profiles |
OLD | NEW |