Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Side by Side Diff: chrome/browser/chromeos/login/wizard_controller.cc

Issue 2929963002: Add value proposition entrypoint from Voice Interaction shortcut (Closed)
Patch Set: Add value proposition entrypoint from Voice Interaction shortcut Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chromeos/login/wizard_controller.h" 5 #include "chrome/browser/chromeos/login/wizard_controller.h"
6 6
7 #include <signal.h> 7 #include <signal.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <sys/types.h> 10 #include <sys/types.h>
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 #include "chromeos/settings/timezone_settings.h" 88 #include "chromeos/settings/timezone_settings.h"
89 #include "chromeos/timezone/timezone_provider.h" 89 #include "chromeos/timezone/timezone_provider.h"
90 #include "components/arc/arc_bridge_service.h" 90 #include "components/arc/arc_bridge_service.h"
91 #include "components/arc/arc_service_manager.h" 91 #include "components/arc/arc_service_manager.h"
92 #include "components/crash/content/app/breakpad_linux.h" 92 #include "components/crash/content/app/breakpad_linux.h"
93 #include "components/pairing/bluetooth_controller_pairing_controller.h" 93 #include "components/pairing/bluetooth_controller_pairing_controller.h"
94 #include "components/pairing/bluetooth_host_pairing_controller.h" 94 #include "components/pairing/bluetooth_host_pairing_controller.h"
95 #include "components/pairing/shark_connection_listener.h" 95 #include "components/pairing/shark_connection_listener.h"
96 #include "components/prefs/pref_registry_simple.h" 96 #include "components/prefs/pref_registry_simple.h"
97 #include "components/prefs/pref_service.h" 97 #include "components/prefs/pref_service.h"
98 #include "components/session_manager/core/session_manager.h"
98 #include "components/user_manager/user_manager.h" 99 #include "components/user_manager/user_manager.h"
99 #include "content/public/browser/browser_thread.h" 100 #include "content/public/browser/browser_thread.h"
100 #include "content/public/browser/notification_types.h" 101 #include "content/public/browser/notification_types.h"
101 #include "ui/base/accelerators/accelerator.h" 102 #include "ui/base/accelerators/accelerator.h"
102 103
103 using content::BrowserThread; 104 using content::BrowserThread;
104 105
105 namespace { 106 namespace {
106 // Interval in ms which is used for smooth screen showing. 107 // Interval in ms which is used for smooth screen showing.
107 static int kShowDelayMs = 400; 108 static int kShowDelayMs = 400;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 /////////////////////////////////////////////////////////////////////////////// 249 ///////////////////////////////////////////////////////////////////////////////
249 // WizardController, public: 250 // WizardController, public:
250 251
251 PrefService* WizardController::local_state_for_testing_ = nullptr; 252 PrefService* WizardController::local_state_for_testing_ = nullptr;
252 253
253 WizardController::WizardController(LoginDisplayHost* host, OobeUI* oobe_ui) 254 WizardController::WizardController(LoginDisplayHost* host, OobeUI* oobe_ui)
254 : host_(host), oobe_ui_(oobe_ui), weak_factory_(this) { 255 : host_(host), oobe_ui_(oobe_ui), weak_factory_(this) {
255 DCHECK(default_controller_ == nullptr); 256 DCHECK(default_controller_ == nullptr);
256 default_controller_ = this; 257 default_controller_ = this;
257 screen_manager_ = base::MakeUnique<ScreenManager>(this); 258 screen_manager_ = base::MakeUnique<ScreenManager>(this);
259 // In session OOBE was initiated from voice interaction keyboard shortcuts.
260 is_in_session_oobe_ =
261 session_manager::SessionManager::Get()->IsSessionStarted();
258 if (!ash_util::IsRunningInMash()) { 262 if (!ash_util::IsRunningInMash()) {
259 AccessibilityManager* accessibility_manager = AccessibilityManager::Get(); 263 AccessibilityManager* accessibility_manager = AccessibilityManager::Get();
260 CHECK(accessibility_manager); 264 CHECK(accessibility_manager);
261 accessibility_subscription_ = accessibility_manager->RegisterCallback( 265 accessibility_subscription_ = accessibility_manager->RegisterCallback(
262 base::Bind(&WizardController::OnAccessibilityStatusChanged, 266 base::Bind(&WizardController::OnAccessibilityStatusChanged,
263 base::Unretained(this))); 267 base::Unretained(this)));
264 } else { 268 } else {
265 NOTIMPLEMENTED(); 269 NOTIMPLEMENTED();
266 } 270 }
267 } 271 }
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 DBusThreadManager::Get()->GetSessionManagerClient()->StopSession(); 825 DBusThreadManager::Get()->GetSessionManagerClient()->StopSession();
822 } 826 }
823 827
824 void WizardController::OnTermsOfServiceAccepted() { 828 void WizardController::OnTermsOfServiceAccepted() {
825 // If the user accepts the Terms of Service, advance to the PlayStore terms 829 // If the user accepts the Terms of Service, advance to the PlayStore terms
826 // of serice. 830 // of serice.
827 ShowArcTermsOfServiceScreen(); 831 ShowArcTermsOfServiceScreen();
828 } 832 }
829 833
830 void WizardController::OnArcTermsOfServiceFinished() { 834 void WizardController::OnArcTermsOfServiceFinished() {
835 const Profile* profile = ProfileManager::GetActiveUserProfile();
836 if (is_in_session_oobe_) {
837 if (profile->GetPrefs()->GetBoolean(prefs::kArcTermsAccepted))
838 StartVoiceInteractionSetupWizard();
839 OnOobeFlowFinished();
840 return;
841 }
831 // If the user finished with the PlayStore Terms of Service, advance to the 842 // If the user finished with the PlayStore Terms of Service, advance to the
832 // user image screen. 843 // user image screen.
833 ShowUserImageScreen(); 844 ShowUserImageScreen();
834 } 845 }
835 846
836 void WizardController::OnVoiceInteractionValuePropSkipped() { 847 void WizardController::OnVoiceInteractionValuePropSkipped() {
837 OnOobeFlowFinished(); 848 OnOobeFlowFinished();
838 } 849 }
839 850
840 void WizardController::OnVoiceInteractionValuePropAccepted() { 851 void WizardController::OnVoiceInteractionValuePropAccepted() {
841 // Start voice interaction setup wizard in container 852 const Profile* profile = ProfileManager::GetActiveUserProfile();
842 arc::ArcVoiceInteractionFrameworkService* service = 853 if (is_in_session_oobe_ && !arc::IsArcPlayStoreEnabledForProfile(profile)) {
843 arc::ArcServiceManager::Get() 854 ShowArcTermsOfServiceScreen();
844 ->GetService<arc::ArcVoiceInteractionFrameworkService>(); 855 return;
845 if (service) 856 }
846 service->StartVoiceInteractionSetupWizard(); 857 StartVoiceInteractionSetupWizard();
847 OnOobeFlowFinished(); 858 OnOobeFlowFinished();
848 } 859 }
849 860
850 void WizardController::OnControllerPairingFinished() { 861 void WizardController::OnControllerPairingFinished() {
851 ShowAutoEnrollmentCheckScreen(); 862 ShowAutoEnrollmentCheckScreen();
852 } 863 }
853 864
854 void WizardController::OnAutoEnrollmentCheckCompleted() { 865 void WizardController::OnAutoEnrollmentCheckCompleted() {
855 // Check whether the device is disabled. OnDeviceDisabledChecked() will be 866 // Check whether the device is disabled. OnDeviceDisabledChecked() will be
856 // invoked when the result of this check is known. Until then, the current 867 // invoked when the result of this check is known. Until then, the current
857 // screen will remain visible and will continue showing a spinner. 868 // screen will remain visible and will continue showing a spinner.
858 g_browser_process->platform_part()->device_disabling_manager()-> 869 g_browser_process->platform_part()->device_disabling_manager()->
859 CheckWhetherDeviceDisabledDuringOOBE(base::Bind( 870 CheckWhetherDeviceDisabledDuringOOBE(base::Bind(
860 &WizardController::OnDeviceDisabledChecked, 871 &WizardController::OnDeviceDisabledChecked,
861 weak_factory_.GetWeakPtr())); 872 weak_factory_.GetWeakPtr()));
862 } 873 }
863 874
864 void WizardController::OnOobeFlowFinished() { 875 void WizardController::OnOobeFlowFinished() {
876 if (is_in_session_oobe_) {
877 host_->SetStatusAreaVisible(true);
878 host_->Finalize(base::OnceClosure());
879 host_ = nullptr;
880 return;
881 }
882
865 if (!time_oobe_started_.is_null()) { 883 if (!time_oobe_started_.is_null()) {
866 base::TimeDelta delta = base::Time::Now() - time_oobe_started_; 884 base::TimeDelta delta = base::Time::Now() - time_oobe_started_;
867 UMA_HISTOGRAM_CUSTOM_TIMES("OOBE.BootToSignInCompleted", delta, 885 UMA_HISTOGRAM_CUSTOM_TIMES("OOBE.BootToSignInCompleted", delta,
868 base::TimeDelta::FromMilliseconds(10), 886 base::TimeDelta::FromMilliseconds(10),
869 base::TimeDelta::FromMinutes(30), 100); 887 base::TimeDelta::FromMinutes(30), 100);
870 time_oobe_started_ = base::Time(); 888 time_oobe_started_ = base::Time();
871 } 889 }
872 890
873 // Launch browser and delete login host controller. 891 // Launch browser and delete login host controller.
874 BrowserThread::PostTask( 892 BrowserThread::PostTask(
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 } 1555 }
1538 if (profile->GetPrefs()->IsManagedPreference(prefs::kArcEnabled) && 1556 if (profile->GetPrefs()->IsManagedPreference(prefs::kArcEnabled) &&
1539 !profile->GetPrefs()->GetBoolean(prefs::kArcEnabled)) { 1557 !profile->GetPrefs()->GetBoolean(prefs::kArcEnabled)) {
1540 VLOG(1) << "Skip ARC Terms of Service screen because ARC is disabled."; 1558 VLOG(1) << "Skip ARC Terms of Service screen because ARC is disabled.";
1541 return false; 1559 return false;
1542 } 1560 }
1543 return true; 1561 return true;
1544 } 1562 }
1545 1563
1546 bool WizardController::ShouldShowVoiceInteractionValueProp() const { 1564 bool WizardController::ShouldShowVoiceInteractionValueProp() const {
1547 if (!arc::IsArcPlayStoreEnabledForProfile( 1565 // If the OOBE flow was initiated from voice interaction shortcut, we will
1548 ProfileManager::GetActiveUserProfile())) { 1566 // show Arc terms later.
1567 if (!is_in_session_oobe_ && !arc::IsArcPlayStoreEnabledForProfile(
1568 ProfileManager::GetActiveUserProfile())) {
1549 VLOG(1) << "Skip Voice Interaction Value Prop screen because Arc Terms is " 1569 VLOG(1) << "Skip Voice Interaction Value Prop screen because Arc Terms is "
1550 << "skipped."; 1570 << "skipped.";
1551 return false; 1571 return false;
1552 } 1572 }
1553 if (!chromeos::switches::IsVoiceInteractionEnabled()) { 1573 if (!chromeos::switches::IsVoiceInteractionEnabled()) {
1554 VLOG(1) << "Skip Voice Interaction Value Prop screen because voice " 1574 VLOG(1) << "Skip Voice Interaction Value Prop screen because voice "
1555 << "interaction service is disabled."; 1575 << "interaction service is disabled.";
1556 return false; 1576 return false;
1557 } 1577 }
1558 return true; 1578 return true;
1559 } 1579 }
1560 1580
1581 void WizardController::StartVoiceInteractionSetupWizard() {
1582 arc::ArcVoiceInteractionFrameworkService* service =
1583 arc::ArcServiceManager::Get()
1584 ->GetService<arc::ArcVoiceInteractionFrameworkService>();
1585 if (service)
1586 service->StartVoiceInteractionSetupWizard();
1587 }
1588
1561 void WizardController::MaybeStartListeningForSharkConnection() { 1589 void WizardController::MaybeStartListeningForSharkConnection() {
1562 // We shouldn't be here if we are running pairing OOBE already. 1590 // We shouldn't be here if we are running pairing OOBE already.
1563 if (IsControllerDetected()) 1591 if (IsControllerDetected())
1564 return; 1592 return;
1565 1593
1566 if (!shark_connection_listener_) { 1594 if (!shark_connection_listener_) {
1567 shark_connection_listener_.reset( 1595 shark_connection_listener_.reset(
1568 new pairing_chromeos::SharkConnectionListener( 1596 new pairing_chromeos::SharkConnectionListener(
1569 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), 1597 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE),
1570 base::Bind(&WizardController::OnSharkConnected, 1598 base::Bind(&WizardController::OnSharkConnected,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 SetCurrentScreen(screen); 1644 SetCurrentScreen(screen);
1617 } 1645 }
1618 1646
1619 AutoEnrollmentController* WizardController::GetAutoEnrollmentController() { 1647 AutoEnrollmentController* WizardController::GetAutoEnrollmentController() {
1620 if (!auto_enrollment_controller_) 1648 if (!auto_enrollment_controller_)
1621 auto_enrollment_controller_ = base::MakeUnique<AutoEnrollmentController>(); 1649 auto_enrollment_controller_ = base::MakeUnique<AutoEnrollmentController>();
1622 return auto_enrollment_controller_.get(); 1650 return auto_enrollment_controller_.get();
1623 } 1651 }
1624 1652
1625 } // namespace chromeos 1653 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/wizard_controller.h ('k') | chrome/browser/ui/ash/app_list/app_list_presenter_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698