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

Side by Side Diff: chrome/browser/resources/cast/cast.js

Issue 2600683002: Run tools/clang-format-js on some of chrome/browser/resources/ (Closed)
Patch Set: hackhackhack Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 window.addEventListener('load', function init() { 5 window.addEventListener('load', function init() {
6 var extensionView = document.querySelector('extensionview'); 6 var extensionView = document.querySelector('extensionview');
7 7
8 /** 8 /**
9 * @param {string} str 9 * @param {string} str
10 * @return {!Array<string>} 10 * @return {!Array<string>}
11 */ 11 */
12 var splitUrlOnHash = function(str) { 12 var splitUrlOnHash = function(str) {
13 str = str || ''; 13 str = str || '';
14 var pos = str.indexOf('#'); 14 var pos = str.indexOf('#');
15 return (pos !== -1) ? [str.substr(0, pos), str.substr(pos + 1)] : [str, '']; 15 return (pos !== -1) ? [str.substr(0, pos), str.substr(pos + 1)] : [str, ''];
16 }; 16 };
17 17
18 new MutationObserver(function() { 18 new MutationObserver(function() {
19 var newHash = splitUrlOnHash(extensionView.getAttribute('src'))[1]; 19 var newHash = splitUrlOnHash(extensionView.getAttribute('src'))[1];
20 var oldHash = window.location.hash.substr(1); 20 var oldHash = window.location.hash.substr(1);
21 if (newHash !== oldHash) { 21 if (newHash !== oldHash) {
22 window.location.hash = newHash; 22 window.location.hash = newHash;
23 } 23 }
24 }).observe(extensionView, { 24 }).observe(extensionView, {attributes: true});
25 attributes: true
26 });
27 25
28 window.addEventListener('hashchange', function() { 26 window.addEventListener('hashchange', function() {
29 var newHash = window.location.hash.substr(1); 27 var newHash = window.location.hash.substr(1);
30 var extensionViewSrcParts = splitUrlOnHash( 28 var extensionViewSrcParts =
31 extensionView.getAttribute('src')); 29 splitUrlOnHash(extensionView.getAttribute('src'));
32 if (newHash !== extensionViewSrcParts[1]) { 30 if (newHash !== extensionViewSrcParts[1]) {
33 extensionView.load(extensionViewSrcParts[0] + '#' + newHash); 31 extensionView.load(extensionViewSrcParts[0] + '#' + newHash);
34 } 32 }
35 }); 33 });
36 34
37 extensionView.load( 35 extensionView.load(
38 'chrome-extension://' + loadTimeData.getString('extensionId') + 36 'chrome-extension://' + loadTimeData.getString('extensionId') +
39 '/cast_setup/index.html#' + window.location.hash.substr(1) || 'devices'); 37 '/cast_setup/index.html#' + window.location.hash.substr(1) ||
38 'devices');
40 }); 39 });
41
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698