Commit e58b1a8b authored by Xiaohui Chen's avatar Xiaohui Chen Committed by Commit Bot

Show assistant optin with no server consent flags

Show the optin screen even when there is no server consent
flags needed to set. This will still give the the user a chance
to enable/disable the feature locally.

Bug: None
Test: locally build and test
Change-Id: If862adf4bd811e8c609233ec8c5da070ba29424a
Reviewed-on: https://chromium-review.googlesource.com/1079377Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Xiaohui Chen <xiaohuic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#563084}
parent 452d37a0
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
#include "chrome/grit/browser_resources.h" #include "chrome/grit/browser_resources.h"
#include "chrome/grit/generated_resources.h"
#include "chromeos/services/assistant/public/mojom/constants.mojom.h" #include "chromeos/services/assistant/public/mojom/constants.mojom.h"
#include "chromeos/services/assistant/public/proto/settings_ui.pb.h" #include "chromeos/services/assistant/public/proto/settings_ui.pb.h"
#include "components/arc/arc_prefs.h" #include "components/arc/arc_prefs.h"
...@@ -21,6 +22,7 @@ ...@@ -21,6 +22,7 @@
#include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h" #include "content/public/browser/web_ui_data_source.h"
#include "services/service_manager/public/cpp/connector.h" #include "services/service_manager/public/cpp/connector.h"
#include "ui/base/l10n/l10n_util.h"
namespace chromeos { namespace chromeos {
...@@ -157,11 +159,6 @@ void AssistantOptInUI::OnGetSettingsResponse(const std::string& settings) { ...@@ -157,11 +159,6 @@ void AssistantOptInUI::OnGetSettingsResponse(const std::string& settings) {
consent_token_ = activity_control_ui.consent_token(); consent_token_ = activity_control_ui.consent_token();
base::ListValue zippy_data; base::ListValue zippy_data;
if (activity_control_ui.setting_zippy().size() == 0) {
// No need to consent. Close the dialog for now.
CloseDialog(nullptr);
return;
}
for (auto& setting_zippy : activity_control_ui.setting_zippy()) { for (auto& setting_zippy : activity_control_ui.setting_zippy()) {
base::DictionaryValue data; base::DictionaryValue data;
data.SetString("title", setting_zippy.title()); data.SetString("title", setting_zippy.title());
...@@ -174,17 +171,24 @@ void AssistantOptInUI::OnGetSettingsResponse(const std::string& settings) { ...@@ -174,17 +171,24 @@ void AssistantOptInUI::OnGetSettingsResponse(const std::string& settings) {
assistant_handler_->AddSettingZippy(zippy_data); assistant_handler_->AddSettingZippy(zippy_data);
base::DictionaryValue dictionary; base::DictionaryValue dictionary;
dictionary.SetString("valuePropIdentity", activity_control_ui.identity());
if (activity_control_ui.intro_text_paragraph_size() > 0) {
dictionary.SetString("valuePropIntro", dictionary.SetString("valuePropIntro",
activity_control_ui.intro_text_paragraph(0)); activity_control_ui.intro_text_paragraph(0));
dictionary.SetString("valuePropIdentity", activity_control_ui.identity()); }
if (activity_control_ui.footer_paragraph_size() > 0) {
dictionary.SetString("valuePropFooter", dictionary.SetString("valuePropFooter",
activity_control_ui.footer_paragraph(0)); activity_control_ui.footer_paragraph(0));
}
dictionary.SetString( dictionary.SetString(
"valuePropNextButton", "valuePropNextButton",
settings_ui.consent_flow_ui().consent_ui().accept_button_text()); settings_ui.consent_flow_ui().consent_ui().accept_button_text());
dictionary.SetString( dictionary.SetString(
"valuePropSkipButton", "valuePropSkipButton",
settings_ui.consent_flow_ui().consent_ui().reject_button_text()); settings_ui.consent_flow_ui().consent_ui().has_reject_button_text()
? settings_ui.consent_flow_ui().consent_ui().reject_button_text()
: l10n_util::GetStringUTF8(
IDS_VOICE_INTERACTION_VALUE_PROP_SKIP_BUTTON));
assistant_handler_->ReloadContent(dictionary); assistant_handler_->ReloadContent(dictionary);
} }
...@@ -199,6 +203,10 @@ void AssistantOptInUI::OnUpdateSettingsResponse(const std::string& result) { ...@@ -199,6 +203,10 @@ void AssistantOptInUI::OnUpdateSettingsResponse(const std::string& result) {
LOG(ERROR) << "Consent udpate error."; LOG(ERROR) << "Consent udpate error.";
} }
Next();
}
void AssistantOptInUI::Next() {
// More screens to be added. Close the dialog for now. // More screens to be added. Close the dialog for now.
PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs();
prefs->SetBoolean(arc::prefs::kArcVoiceInteractionValuePropAccepted, true); prefs->SetBoolean(arc::prefs::kArcVoiceInteractionValuePropAccepted, true);
......
...@@ -45,6 +45,9 @@ class AssistantOptInUI ...@@ -45,6 +45,9 @@ class AssistantOptInUI
void OnGetSettingsResponse(const std::string& settings); void OnGetSettingsResponse(const std::string& settings);
void OnUpdateSettingsResponse(const std::string& settings); void OnUpdateSettingsResponse(const std::string& settings);
// Show next screen in the optin flow.
void Next();
// Consent token used to complete the opt-in. // Consent token used to complete the opt-in.
std::string consent_token_; std::string consent_token_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment