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

Side by Side Diff: chrome/browser/chromeos/login/screens/voice_interaction_value_prop_screen.cc

Issue 2912593002: Create OOBE screen for Voice Interaction value proposition (Closed)
Patch Set: Create OOBE screen for Voice Interaction value proposition 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chromeos/login/screens/voice_interaction_value_prop_scr een.h"
6
7 #include "chrome/browser/chromeos/login/screens/base_screen_delegate.h"
8 #include "chrome/browser/chromeos/login/screens/voice_interaction_value_prop_scr een_view.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/profiles/profile_manager.h"
11 #include "chrome/common/pref_names.h"
12 #include "components/prefs/pref_service.h"
13
14 namespace chromeos {
15 namespace {
16
17 constexpr const char kUserActionNoThanksPressed[] = "no-thanks-pressed";
18 constexpr const char kUserActionContinuePressed[] = "continue-pressed";
19
20 } // namespace
21
22 VoiceInteractionValuePropScreen::VoiceInteractionValuePropScreen(
23 BaseScreenDelegate* base_screen_delegate,
24 VoiceInteractionValuePropScreenView* view)
25 : BaseScreen(base_screen_delegate,
26 OobeScreen::SCREEN_VOICE_INTERACTION_VALUE_PROP),
27 view_(view) {
28 DCHECK(view_);
29 if (view_)
30 view_->Bind(this);
31 }
32
33 VoiceInteractionValuePropScreen::~VoiceInteractionValuePropScreen() {
34 if (view_)
35 view_->Unbind();
36 }
37
38 void VoiceInteractionValuePropScreen::Show() {
39 if (!view_)
40 return;
41
42 view_->Show();
43 }
44
45 void VoiceInteractionValuePropScreen::Hide() {
46 if (view_)
47 view_->Hide();
48 }
49
50 void VoiceInteractionValuePropScreen::OnViewDestroyed(
51 VoiceInteractionValuePropScreenView* view) {
52 if (view_ == view)
53 view_ = nullptr;
54 }
55
56 void VoiceInteractionValuePropScreen::OnUserAction(
57 const std::string& action_id) {
58 if (action_id == kUserActionNoThanksPressed)
59 OnNoThanksPressed();
60 else if (action_id == kUserActionContinuePressed)
61 OnContinuePressed();
62 else
63 BaseScreen::OnUserAction(action_id);
64 }
65
66 void VoiceInteractionValuePropScreen::OnNoThanksPressed() {
67 Finish(ScreenExitCode::VOICE_INTERACTION_VALUE_PROP_SKIPPED);
68 }
69
70 void VoiceInteractionValuePropScreen::OnContinuePressed() {
71 ProfileManager::GetActiveUserProfile()->GetPrefs()->SetBoolean(
72 prefs::kArcVoiceInteractionValuePropAccepted, true);
73 Finish(ScreenExitCode::VOICE_INTERACTION_VALUE_PROP_ACCEPTED);
74 }
75
76 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698