| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/screens/voice_interaction_value_prop_scr
een.h" | 5 #include "chrome/browser/chromeos/login/screens/voice_interaction_value_prop_scr
een.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chromeos/arc/arc_session_manager.h" | 7 #include "chrome/browser/chromeos/arc/arc_session_manager.h" |
| 8 #include "chrome/browser/chromeos/login/screens/base_screen_delegate.h" | 8 #include "chrome/browser/chromeos/login/screens/base_screen_delegate.h" |
| 9 #include "chrome/browser/chromeos/login/screens/voice_interaction_value_prop_scr
een_view.h" | 9 #include "chrome/browser/chromeos/login/screens/voice_interaction_value_prop_scr
een_view.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/profiles/profile_manager.h" | 11 #include "chrome/browser/profiles/profile_manager.h" |
| 12 #include "chrome/browser/ui/app_list/arc/arc_pai_starter.h" | 12 #include "chrome/browser/ui/app_list/arc/arc_pai_starter.h" |
| 13 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
| 14 #include "components/prefs/pref_service.h" | 14 #include "components/prefs/pref_service.h" |
| 15 | 15 |
| 16 namespace chromeos { | 16 namespace chromeos { |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 constexpr const char kUserActionNoThanksPressed[] = "no-thanks-pressed"; | 19 constexpr const char kUserActionSkipPressed[] = "skip-pressed"; |
| 20 constexpr const char kUserActionContinuePressed[] = "continue-pressed"; | 20 constexpr const char kUserActionNextPressed[] = "next-pressed"; |
| 21 | 21 |
| 22 } // namespace | 22 } // namespace |
| 23 | 23 |
| 24 VoiceInteractionValuePropScreen::VoiceInteractionValuePropScreen( | 24 VoiceInteractionValuePropScreen::VoiceInteractionValuePropScreen( |
| 25 BaseScreenDelegate* base_screen_delegate, | 25 BaseScreenDelegate* base_screen_delegate, |
| 26 VoiceInteractionValuePropScreenView* view) | 26 VoiceInteractionValuePropScreenView* view) |
| 27 : BaseScreen(base_screen_delegate, | 27 : BaseScreen(base_screen_delegate, |
| 28 OobeScreen::SCREEN_VOICE_INTERACTION_VALUE_PROP), | 28 OobeScreen::SCREEN_VOICE_INTERACTION_VALUE_PROP), |
| 29 view_(view) { | 29 view_(view) { |
| 30 DCHECK(view_); | 30 DCHECK(view_); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 57 } | 57 } |
| 58 | 58 |
| 59 void VoiceInteractionValuePropScreen::OnViewDestroyed( | 59 void VoiceInteractionValuePropScreen::OnViewDestroyed( |
| 60 VoiceInteractionValuePropScreenView* view) { | 60 VoiceInteractionValuePropScreenView* view) { |
| 61 if (view_ == view) | 61 if (view_ == view) |
| 62 view_ = nullptr; | 62 view_ = nullptr; |
| 63 } | 63 } |
| 64 | 64 |
| 65 void VoiceInteractionValuePropScreen::OnUserAction( | 65 void VoiceInteractionValuePropScreen::OnUserAction( |
| 66 const std::string& action_id) { | 66 const std::string& action_id) { |
| 67 if (action_id == kUserActionNoThanksPressed) | 67 if (action_id == kUserActionSkipPressed) |
| 68 OnNoThanksPressed(); | 68 OnSkipPressed(); |
| 69 else if (action_id == kUserActionContinuePressed) | 69 else if (action_id == kUserActionNextPressed) |
| 70 OnContinuePressed(); | 70 OnNextPressed(); |
| 71 else | 71 else |
| 72 BaseScreen::OnUserAction(action_id); | 72 BaseScreen::OnUserAction(action_id); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void VoiceInteractionValuePropScreen::OnNoThanksPressed() { | 75 void VoiceInteractionValuePropScreen::OnSkipPressed() { |
| 76 arc::ArcPaiStarter* pai_starter = | 76 arc::ArcPaiStarter* pai_starter = |
| 77 arc::ArcSessionManager::Get()->pai_starter(); | 77 arc::ArcSessionManager::Get()->pai_starter(); |
| 78 if (pai_starter) | 78 if (pai_starter) |
| 79 pai_starter->ReleaseLock(); | 79 pai_starter->ReleaseLock(); |
| 80 Finish(ScreenExitCode::VOICE_INTERACTION_VALUE_PROP_SKIPPED); | 80 Finish(ScreenExitCode::VOICE_INTERACTION_VALUE_PROP_SKIPPED); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void VoiceInteractionValuePropScreen::OnContinuePressed() { | 83 void VoiceInteractionValuePropScreen::OnNextPressed() { |
| 84 // Note! Release lock for PAI will be called at | 84 // Note! Release lock for PAI will be called at |
| 85 // ArcVoiceInteractionArcHomeService::OnVoiceInteractionOobeSetupComplete. | 85 // ArcVoiceInteractionArcHomeService::OnVoiceInteractionOobeSetupComplete. |
| 86 ProfileManager::GetActiveUserProfile()->GetPrefs()->SetBoolean( | 86 ProfileManager::GetActiveUserProfile()->GetPrefs()->SetBoolean( |
| 87 prefs::kArcVoiceInteractionValuePropAccepted, true); | 87 prefs::kArcVoiceInteractionValuePropAccepted, true); |
| 88 Finish(ScreenExitCode::VOICE_INTERACTION_VALUE_PROP_ACCEPTED); | 88 Finish(ScreenExitCode::VOICE_INTERACTION_VALUE_PROP_ACCEPTED); |
| 89 } | 89 } |
| 90 | 90 |
| 91 } // namespace chromeos | 91 } // namespace chromeos |
| OLD | NEW |