| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 | 320 |
| 321 /** | 321 /** |
| 322 * @param {string} name | 322 * @param {string} name |
| 323 * @return {?string} | 323 * @return {?string} |
| 324 */ | 324 */ |
| 325 static queryParam(name) { | 325 static queryParam(name) { |
| 326 return Runtime._queryParamsObject[name] || null; | 326 return Runtime._queryParamsObject[name] || null; |
| 327 } | 327 } |
| 328 | 328 |
| 329 /** | 329 /** |
| 330 * @return {string} |
| 331 */ |
| 332 static queryParamsString() { |
| 333 return location.search; |
| 334 } |
| 335 |
| 336 /** |
| 330 * @return {!Object} | 337 * @return {!Object} |
| 331 */ | 338 */ |
| 332 static _experimentsSetting() { | 339 static _experimentsSetting() { |
| 333 try { | 340 try { |
| 334 return /** @type {!Object} */ ( | 341 return /** @type {!Object} */ ( |
| 335 JSON.parse(self.localStorage && self.localStorage['experiments'] ? sel
f.localStorage['experiments'] : '{}')); | 342 JSON.parse(self.localStorage && self.localStorage['experiments'] ? sel
f.localStorage['experiments'] : '{}')); |
| 336 } catch (e) { | 343 } catch (e) { |
| 337 console.error('Failed to parse localStorage[\'experiments\']'); | 344 console.error('Failed to parse localStorage[\'experiments\']'); |
| 338 return {}; | 345 return {}; |
| 339 } | 346 } |
| (...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 /** | 1067 /** |
| 1061 * @param {boolean} enabled | 1068 * @param {boolean} enabled |
| 1062 */ | 1069 */ |
| 1063 setEnabled(enabled) { | 1070 setEnabled(enabled) { |
| 1064 this._experiments.setEnabled(this.name, enabled); | 1071 this._experiments.setEnabled(this.name, enabled); |
| 1065 } | 1072 } |
| 1066 }; | 1073 }; |
| 1067 | 1074 |
| 1068 { | 1075 { |
| 1069 (function parseQueryParameters() { | 1076 (function parseQueryParameters() { |
| 1070 var queryParams = location.search; | 1077 var queryParams = Runtime.queryParamsString(); |
| 1071 if (!queryParams) | 1078 if (!queryParams) |
| 1072 return; | 1079 return; |
| 1073 var params = queryParams.substring(1).split('&'); | 1080 var params = queryParams.substring(1).split('&'); |
| 1074 for (var i = 0; i < params.length; ++i) { | 1081 for (var i = 0; i < params.length; ++i) { |
| 1075 var pair = params[i].split('='); | 1082 var pair = params[i].split('='); |
| 1076 var name = pair.shift(); | 1083 var name = pair.shift(); |
| 1077 Runtime._queryParamsObject[name] = pair.join('='); | 1084 Runtime._queryParamsObject[name] = pair.join('='); |
| 1078 } | 1085 } |
| 1079 })(); | 1086 })(); |
| 1080 } | 1087 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1115 send: function(message) {}, | 1122 send: function(message) {}, |
| 1116 | 1123 |
| 1117 /** | 1124 /** |
| 1118 * @return {!Promise<boolean>} | 1125 * @return {!Promise<boolean>} |
| 1119 */ | 1126 */ |
| 1120 close: function() {} | 1127 close: function() {} |
| 1121 }; | 1128 }; |
| 1122 | 1129 |
| 1123 /** @type {!Runtime} */ | 1130 /** @type {!Runtime} */ |
| 1124 var runtime; | 1131 var runtime; |
| OLD | NEW |