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