Commit 1c990f4d authored by Yue Li's avatar Yue Li Committed by Commit Bot

Opt out Polymer 2 for Assistant optin host

Bug: b/124240611
Test: Manual Test
Change-Id: Idfd180d408a22f97330fb4f4deb60d0bc430cf80
Reviewed-on: https://chromium-review.googlesource.com/c/1471265Reviewed-by: default avatarTao Wu <wutao@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Yue Li <updowndota@chromium.org>
Cr-Commit-Position: refs/heads/master@{#632798}
parent 4779e4bd
...@@ -20,8 +20,10 @@ ...@@ -20,8 +20,10 @@
#include "components/arc/arc_prefs.h" #include "components/arc/arc_prefs.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "content/public/browser/host_zoom_map.h" #include "content/public/browser/host_zoom_map.h"
#include "content/public/browser/url_data_source.h"
#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 "content/public/common/content_features.h"
#include "net/base/url_util.h" #include "net/base/url_util.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
...@@ -43,6 +45,11 @@ GURL CreateAssistantOptInURL(ash::mojom::FlowType type) { ...@@ -43,6 +45,11 @@ GURL CreateAssistantOptInURL(ash::mojom::FlowType type) {
return gurl; return gurl;
} }
void DisablePolymer2(content::URLDataSource* shared_source) {
if (shared_source)
shared_source->DisablePolymer2ForHost(chrome::kChromeUIAssistantOptInHost);
}
} // namespace } // namespace
AssistantOptInUI::AssistantOptInUI(content::WebUI* web_ui) AssistantOptInUI::AssistantOptInUI(content::WebUI* web_ui)
...@@ -70,6 +77,17 @@ AssistantOptInUI::AssistantOptInUI(content::WebUI* web_ui) ...@@ -70,6 +77,17 @@ AssistantOptInUI::AssistantOptInUI(content::WebUI* web_ui)
content::HostZoomMap::GetForWebContents(web_ui->GetWebContents()); content::HostZoomMap::GetForWebContents(web_ui->GetWebContents());
DCHECK(zoom_map); DCHECK(zoom_map);
zoom_map->SetZoomLevelForHost(web_ui->GetWebContents()->GetURL().host(), 0); zoom_map->SetZoomLevelForHost(web_ui->GetWebContents()->GetURL().host(), 0);
// If allowed, request that the shared resources send this page Polymer 1
// resources instead of Polymer 2.
// TODO (https://crbug.com/739611): Remove this exception by migrating to
// Polymer 2.
if (base::FeatureList::IsEnabled(features::kWebUIPolymer2Exceptions)) {
content::URLDataSource::GetSourceForURL(
Profile::FromWebUI(web_ui),
GURL("chrome://resources/polymer/v1_0/polymer/polymer.html"),
base::BindOnce(DisablePolymer2));
}
} }
AssistantOptInUI::~AssistantOptInUI() = default; AssistantOptInUI::~AssistantOptInUI() = default;
......
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