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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/screens/voice_interaction_value_prop_screen.cc
diff --git a/chrome/browser/chromeos/login/screens/voice_interaction_value_prop_screen.cc b/chrome/browser/chromeos/login/screens/voice_interaction_value_prop_screen.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c9a7fc397d2bd568bd74a63f86ef6d01932d082d
--- /dev/null
+++ b/chrome/browser/chromeos/login/screens/voice_interaction_value_prop_screen.cc
@@ -0,0 +1,76 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/chromeos/login/screens/voice_interaction_value_prop_screen.h"
+
+#include "chrome/browser/chromeos/login/screens/base_screen_delegate.h"
+#include "chrome/browser/chromeos/login/screens/voice_interaction_value_prop_screen_view.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/common/pref_names.h"
+#include "components/prefs/pref_service.h"
+
+namespace chromeos {
+namespace {
+
+constexpr const char kUserActionNoThanksPressed[] = "no-thanks-pressed";
+constexpr const char kUserActionContinuePressed[] = "continue-pressed";
+
+} // namespace
+
+VoiceInteractionValuePropScreen::VoiceInteractionValuePropScreen(
+ BaseScreenDelegate* base_screen_delegate,
+ VoiceInteractionValuePropScreenView* view)
+ : BaseScreen(base_screen_delegate,
+ OobeScreen::SCREEN_VOICE_INTERACTION_VALUE_PROP),
+ view_(view) {
+ DCHECK(view_);
+ if (view_)
+ view_->Bind(this);
+}
+
+VoiceInteractionValuePropScreen::~VoiceInteractionValuePropScreen() {
+ if (view_)
+ view_->Unbind();
+}
+
+void VoiceInteractionValuePropScreen::Show() {
+ if (!view_)
+ return;
+
+ view_->Show();
+}
+
+void VoiceInteractionValuePropScreen::Hide() {
+ if (view_)
+ view_->Hide();
+}
+
+void VoiceInteractionValuePropScreen::OnViewDestroyed(
+ VoiceInteractionValuePropScreenView* view) {
+ if (view_ == view)
+ view_ = nullptr;
+}
+
+void VoiceInteractionValuePropScreen::OnUserAction(
+ const std::string& action_id) {
+ if (action_id == kUserActionNoThanksPressed)
+ OnNoThanksPressed();
+ else if (action_id == kUserActionContinuePressed)
+ OnContinuePressed();
+ else
+ BaseScreen::OnUserAction(action_id);
+}
+
+void VoiceInteractionValuePropScreen::OnNoThanksPressed() {
+ Finish(ScreenExitCode::VOICE_INTERACTION_VALUE_PROP_SKIPPED);
+}
+
+void VoiceInteractionValuePropScreen::OnContinuePressed() {
+ ProfileManager::GetActiveUserProfile()->GetPrefs()->SetBoolean(
+ prefs::kArcVoiceInteractionValuePropAccepted, true);
+ Finish(ScreenExitCode::VOICE_INTERACTION_VALUE_PROP_ACCEPTED);
+}
+
+} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698