Commit 7f8da333 authored by mark a. foltz's avatar mark a. foltz Committed by Commit Bot

[Media Router] Update Cast WebUI to redirect to the MR extension for offers.

This updates the chrome://cast WebUI to redirect to the same Media Router
extension URL that users are sent to when they visit
https://www.google.com/chromecast/offers.

It doesn't need the logic to redirect to other parts of the extension any more,
since support for managing Cast devices via the extension has been removed.

Also, this WebUI is only accessible to users who manually navigate to
"chrome://cast" via the omnibox, which is a very small number.

This removes the last usage of <extensionview> so we can close Bug 982858.

It also removes the OWNERS file since sheretov@ is no longer with the Chromium
project.

Bug: 982858
Change-Id: I46110f41040fb90a84572c37c5cdad9069bb31a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1713806
Commit-Queue: mark a. foltz <mfoltz@chromium.org>
Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Reviewed-by: default avatarTakumi Fujimoto <takumif@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681359}
parent 8c65eaeb
...@@ -623,9 +623,7 @@ ...@@ -623,9 +623,7 @@
</if> </if>
<if expr="chromeos or is_win or is_macosx"> <if expr="chromeos or is_win or is_macosx">
<include name="IDR_CAST_HTML" file="resources\cast\cast.html" type="BINDATA" /> <include name="IDR_CAST_HTML" file="resources\cast\cast.html" type="BINDATA" />
<include name="IDR_CAST_CSS" file="resources\cast\cast.css" type="BINDATA" />
<include name="IDR_CAST_JS" file="resources\cast\cast.js" type="BINDATA" /> <include name="IDR_CAST_JS" file="resources\cast\cast.js" type="BINDATA" />
<include name="IDR_CAST_FAVICON" file="resources\cast\cast_favicon.ico" type="BINDATA" />
</if> </if>
<if expr="not is_android"> <if expr="not is_android">
<include name="IDR_IME_WINDOW_CLOSE" file="resources\input_ime\ime_window_close.png" type="BINDATA" /> <include name="IDR_IME_WINDOW_CLOSE" file="resources\input_ime\ime_window_close.png" type="BINDATA" />
......
/* Copyright 2016 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. */
body,
extensionview,
html {
border: 0;
height: 100%;
margin: 0;
padding: 0;
width: 100%;
}
extensionview {
overflow: hidden;
position: absolute;
}
...@@ -3,13 +3,10 @@ ...@@ -3,13 +3,10 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Google Cast</title> <title>Google Cast</title>
<link rel="stylesheet" href="cast.css">
<link rel="shortcut icon" href="cast_favicon.ico">
<script src="chrome://resources/js/load_time_data.js"></script> <script src="chrome://resources/js/load_time_data.js"></script>
<script src="strings.js"></script> <script src="strings.js"></script>
<script src="cast.js"></script> <script src="cast.js"></script>
</head> </head>
<body> <body>
<extensionview></extensionview>
</body> </body>
</html> </html>
...@@ -2,37 +2,5 @@ ...@@ -2,37 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
window.addEventListener('load', function init() { window.location = 'chrome-extension://' +
const extensionView = document.querySelector('extensionview'); loadTimeData.getString('extensionId') + '/cast_setup/index.html#offers';
/**
* @param {string} str
* @return {!Array<string>}
*/
const splitUrlOnHash = function(str) {
str = str || '';
const pos = str.indexOf('#');
return (pos !== -1) ? [str.substr(0, pos), str.substr(pos + 1)] : [str, ''];
};
new MutationObserver(function() {
const newHash = splitUrlOnHash(extensionView.getAttribute('src'))[1];
const oldHash = window.location.hash.substr(1);
if (newHash !== oldHash) {
window.location.hash = newHash;
}
}).observe(extensionView, {attributes: true});
window.addEventListener('hashchange', function() {
const newHash = window.location.hash.substr(1);
const extensionViewSrcParts =
splitUrlOnHash(extensionView.getAttribute('src'));
if (newHash !== extensionViewSrcParts[1] && newHash.startsWith('offers')) {
extensionView.load(extensionViewSrcParts[0] + '#' + newHash);
}
});
extensionView.load(
'chrome-extension://' + loadTimeData.getString('extensionId') +
'/cast_setup/index.html#offers');
});
sheretov@chromium.org # Component: Chromecast
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
#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"
// TODO: Figure out a way to self-navigate the WebUI in C++ on instantiation,
// and replace the navigation in cast.js with that.
CastUI::CastUI(content::WebUI* web_ui) CastUI::CastUI(content::WebUI* web_ui)
: content::WebUIController(web_ui) { : content::WebUIController(web_ui) {
// Retrieve the ID of the component extension. // Retrieve the ID of the component extension.
...@@ -26,13 +28,10 @@ CastUI::CastUI(content::WebUI* web_ui) ...@@ -26,13 +28,10 @@ CastUI::CastUI(content::WebUI* web_ui)
content::WebUIDataSource* html_source = content::WebUIDataSource* html_source =
content::WebUIDataSource::Create(chrome::kChromeUICastHost); content::WebUIDataSource::Create(chrome::kChromeUICastHost);
html_source->AddResourcePath("cast.css", IDR_CAST_CSS);
html_source->AddResourcePath("cast.js", IDR_CAST_JS); html_source->AddResourcePath("cast.js", IDR_CAST_JS);
html_source->AddResourcePath("cast_favicon.ico", IDR_CAST_FAVICON);
html_source->AddString("extensionId", extension_id); html_source->AddString("extensionId", extension_id);
html_source->SetJsonPath("strings.js"); html_source->SetJsonPath("strings.js");
html_source->SetDefaultResource(IDR_CAST_HTML); html_source->SetDefaultResource(IDR_CAST_HTML);
html_source->OverrideContentSecurityPolicyObjectSrc("object-src * chrome:;");
content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), html_source); content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), html_source);
} }
......
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