Commit d46bc64b authored by Yue Li's avatar Yue Li Committed by Commit Bot

Add Reload handling for Assistant opt-in dialog

Bug: b/118454994
Test: Manual Test
Change-Id: I477a33cbb64a518d858584ac3f97d1550861ed7c
Reviewed-on: https://chromium-review.googlesource.com/c/1300016
Commit-Queue: Yue Li <updowndota@chromium.org>
Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#603349}
parent aaa7d9c7
...@@ -169,6 +169,14 @@ Polymer({ ...@@ -169,6 +169,14 @@ Polymer({
reloadPage: function() { reloadPage: function() {
this.fire('loading'); this.fire('loading');
if (this.initialized_) {
chrome.send(
'login.AssistantOptInFlowScreen.ValuePropScreen.userActed',
['reload-requested']);
this.settingZippyLoaded_ = false;
this.consentStringLoaded_ = false;
}
this.loadingError_ = false; this.loadingError_ = false;
this.headerReceived_ = false; this.headerReceived_ = false;
this.valuePropView_.src = this.valuePropView_.src =
...@@ -270,7 +278,7 @@ Polymer({ ...@@ -270,7 +278,7 @@ Polymer({
var description = document.createElement('div'); var description = document.createElement('div');
description.className = 'zippy-description'; description.className = 'zippy-description';
description.innerHTML = this.sanitizer_.sanitizeHtml(data['description']); description.innerHTML = this.sanitizer_.sanitizeHtml(data['description']);
zippy.appendChild(description); description.innerHTML += '&ensp;';
var learnMoreLink = document.createElement('a'); var learnMoreLink = document.createElement('a');
learnMoreLink.className = 'learn-more-link'; learnMoreLink.className = 'learn-more-link';
...@@ -279,7 +287,9 @@ Polymer({ ...@@ -279,7 +287,9 @@ Polymer({
learnMoreLink.onclick = function(title, additionalInfo) { learnMoreLink.onclick = function(title, additionalInfo) {
this.showLearnMoreOverlay(title, additionalInfo); this.showLearnMoreOverlay(title, additionalInfo);
}.bind(this, data['title'], data['additionalInfo']); }.bind(this, data['title'], data['additionalInfo']);
zippy.appendChild(learnMoreLink);
description.appendChild(learnMoreLink);
zippy.appendChild(description);
this.$['consents-container'].appendChild(zippy); this.$['consents-container'].appendChild(zippy);
} }
...@@ -322,8 +332,8 @@ Polymer({ ...@@ -322,8 +332,8 @@ Polymer({
this.onWebViewErrorOccurred.bind(this), requestFilter); this.onWebViewErrorOccurred.bind(this), requestFilter);
this.valuePropView_.request.onHeadersReceived.addListener( this.valuePropView_.request.onHeadersReceived.addListener(
this.onWebViewHeadersReceived.bind(this), requestFilter); this.onWebViewHeadersReceived.bind(this), requestFilter);
this.valuePropView_.request.onCompleted.addListener( this.valuePropView_.addEventListener(
this.onWebViewContentLoad.bind(this), requestFilter); 'contentload', this.onWebViewContentLoad.bind(this));
this.valuePropView_.addContentScripts([{ this.valuePropView_.addContentScripts([{
name: 'stripLinks', name: 'stripLinks',
...@@ -335,9 +345,8 @@ Polymer({ ...@@ -335,9 +345,8 @@ Polymer({
run_at: 'document_end' run_at: 'document_end'
}]); }]);
this.reloadPage();
this.initialized_ = true; this.initialized_ = true;
} }
this.reloadPage();
}, },
}); });
...@@ -27,6 +27,7 @@ constexpr char kJsScreenPath[] = "login.AssistantOptInFlowScreen"; ...@@ -27,6 +27,7 @@ constexpr char kJsScreenPath[] = "login.AssistantOptInFlowScreen";
constexpr char kSkipPressed[] = "skip-pressed"; constexpr char kSkipPressed[] = "skip-pressed";
constexpr char kNextPressed[] = "next-pressed"; constexpr char kNextPressed[] = "next-pressed";
constexpr char kFlowFinished[] = "flow-finished"; constexpr char kFlowFinished[] = "flow-finished";
constexpr char kReloadRequested[] = "reload-requested";
} // namespace } // namespace
...@@ -338,6 +339,12 @@ void AssistantOptInFlowScreenHandler::HandleValuePropScreenUserAction( ...@@ -338,6 +339,12 @@ void AssistantOptInFlowScreenHandler::HandleValuePropScreenUserAction(
OnActivityControlOptInResult(false); OnActivityControlOptInResult(false);
} else if (action == kNextPressed) { } else if (action == kNextPressed) {
OnActivityControlOptInResult(true); OnActivityControlOptInResult(true);
} else if (action == kReloadRequested) {
if (settings_manager_.is_bound()) {
SendGetSettingsRequest();
} else {
LOG(ERROR) << "Settings mojom failed to setup. Check Assistant service.";
}
} }
} }
......
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