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 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 profiles::USER_MANAGER_TUTORIAL_OVERVIEW, | 455 profiles::USER_MANAGER_TUTORIAL_OVERVIEW, |
456 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); | 456 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); |
457 } | 457 } |
458 | 458 |
459 void EnableNewProfileManagementPreview(Profile* profile) { | 459 void EnableNewProfileManagementPreview(Profile* profile) { |
460 #if defined(OS_ANDROID) | 460 #if defined(OS_ANDROID) |
461 NOTREACHED(); | 461 NOTREACHED(); |
462 #else | 462 #else |
463 // TODO(rogerta): instead of setting experiment flags and command line | 463 // TODO(rogerta): instead of setting experiment flags and command line |
464 // args, we should set a profile preference. | 464 // args, we should set a profile preference. |
465 const about_flags::Experiment experiment = { | 465 const about_flags::FeatureEntry entry = { |
466 kNewProfileManagementExperimentInternalName, | 466 kNewProfileManagementExperimentInternalName, |
467 0, // string id for title of experiment | 467 0, // string id for title of experiment |
468 0, // string id for description of experiment | 468 0, // string id for description of experiment |
469 0, // supported platforms | 469 0, // supported platforms |
470 about_flags::Experiment::ENABLE_DISABLE_VALUE, | 470 about_flags::FeatureEntry::ENABLE_DISABLE_VALUE, |
471 switches::kEnableNewProfileManagement, | 471 switches::kEnableNewProfileManagement, |
472 "", // not used with ENABLE_DISABLE_VALUE type | 472 "", // not used with ENABLE_DISABLE_VALUE type |
473 switches::kDisableNewProfileManagement, | 473 switches::kDisableNewProfileManagement, |
474 "", // not used with ENABLE_DISABLE_VALUE type | 474 "", // not used with ENABLE_DISABLE_VALUE type |
475 NULL, // not used with ENABLE_DISABLE_VALUE type | 475 NULL, // not used with ENABLE_DISABLE_VALUE type |
476 3 | 476 3 |
477 }; | 477 }; |
478 flags_ui::PrefServiceFlagsStorage flags_storage( | 478 flags_ui::PrefServiceFlagsStorage flags_storage( |
479 g_browser_process->local_state()); | 479 g_browser_process->local_state()); |
480 about_flags::SetExperimentEnabled( | 480 about_flags::SetFeatureEntryEnabled(&flags_storage, entry.NameForChoice(1), |
481 &flags_storage, | 481 true); |
482 experiment.NameForChoice(1), | |
483 true); | |
484 | 482 |
485 switches::EnableNewProfileManagementForTesting( | 483 switches::EnableNewProfileManagementForTesting( |
486 base::CommandLine::ForCurrentProcess()); | 484 base::CommandLine::ForCurrentProcess()); |
487 UserManager::Show(base::FilePath(), | 485 UserManager::Show(base::FilePath(), |
488 profiles::USER_MANAGER_TUTORIAL_OVERVIEW, | 486 profiles::USER_MANAGER_TUTORIAL_OVERVIEW, |
489 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); | 487 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); |
490 UpdateServicesWithNewProfileManagementFlag(profile, true); | 488 UpdateServicesWithNewProfileManagementFlag(profile, true); |
491 #endif | 489 #endif |
492 } | 490 } |
493 | 491 |
494 void DisableNewProfileManagementPreview(Profile* profile) { | 492 void DisableNewProfileManagementPreview(Profile* profile) { |
495 flags_ui::PrefServiceFlagsStorage flags_storage( | 493 flags_ui::PrefServiceFlagsStorage flags_storage( |
496 g_browser_process->local_state()); | 494 g_browser_process->local_state()); |
497 about_flags::SetExperimentEnabled( | 495 about_flags::SetFeatureEntryEnabled( |
498 &flags_storage, | 496 &flags_storage, |
499 kNewProfileManagementExperimentInternalName, | 497 kNewProfileManagementExperimentInternalName, |
500 false); | 498 false); |
501 chrome::AttemptRestart(); | 499 chrome::AttemptRestart(); |
502 UpdateServicesWithNewProfileManagementFlag(profile, false); | 500 UpdateServicesWithNewProfileManagementFlag(profile, false); |
503 } | 501 } |
504 | 502 |
505 void BubbleViewModeFromAvatarBubbleMode( | 503 void BubbleViewModeFromAvatarBubbleMode( |
506 BrowserWindow::AvatarBubbleMode mode, | 504 BrowserWindow::AvatarBubbleMode mode, |
507 BubbleViewMode* bubble_view_mode, | 505 BubbleViewMode* bubble_view_mode, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 PrefService* local_state = g_browser_process->local_state(); | 550 PrefService* local_state = g_browser_process->local_state(); |
553 const bool dismissed = local_state->GetBoolean( | 551 const bool dismissed = local_state->GetBoolean( |
554 prefs::kProfileAvatarRightClickTutorialDismissed); | 552 prefs::kProfileAvatarRightClickTutorialDismissed); |
555 | 553 |
556 // Don't show the tutorial if it's already been dismissed or if right-clicking | 554 // Don't show the tutorial if it's already been dismissed or if right-clicking |
557 // wouldn't show any targets. | 555 // wouldn't show any targets. |
558 return !dismissed && HasProfileSwitchTargets(profile); | 556 return !dismissed && HasProfileSwitchTargets(profile); |
559 } | 557 } |
560 | 558 |
561 } // namespace profiles | 559 } // namespace profiles |
OLD | NEW |