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

Unified Diff: remoting/webapp/base/js/base.js

Issue 888323002: Improve HRD first run experience (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reviewer's feedback Created 5 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 side-by-side diff with in-line comments
Download patch
Index: remoting/webapp/base/js/base.js
diff --git a/remoting/webapp/base/js/base.js b/remoting/webapp/base/js/base.js
index 11bd091acf0ca9d5397e91db878a399403450da9..5c88dfd8fbabfe99c2b6bab848bea222e2f8d8f1 100644
--- a/remoting/webapp/base/js/base.js
+++ b/remoting/webapp/base/js/base.js
@@ -160,6 +160,20 @@ base.urlJoin = function(url, opt_params) {
return url + '?' + queryParameters.join('&');
};
+
+/**
+ * @return {Object.<string, string>} The URL parameters.
+ */
+base.getUrlParameters = function() {
kelvinp 2015/02/03 01:15:33 Grouping it closer to the other url utilities
+ var result = {};
+ var parts = window.location.search.substring(1).split('&');
+ for (var i = 0; i < parts.length; i++) {
+ var pair = parts[i].split('=');
+ result[pair[0]] = decodeURIComponent(pair[1]);
+ }
+ return result;
+};
+
/**
* Convert special characters (e.g. &, < and >) to HTML entities.
*
@@ -444,7 +458,7 @@ base.encodeUtf8 = function(string) {
for (var i = 0; i < utf8String.length; i++)
result[i] = utf8String.charCodeAt(i);
return result.buffer;
-}
+};
/**
* Decodes UTF-8 string from ArrayBuffer.
@@ -455,7 +469,7 @@ base.encodeUtf8 = function(string) {
base.decodeUtf8 = function(buffer) {
return decodeURIComponent(
escape(String.fromCharCode.apply(null, new Uint8Array(buffer))));
-}
+};
/**
* Generate a nonce, to be used as an xsrf protection token.
@@ -479,4 +493,4 @@ base.jsonParseSafe = function(jsonString) {
} catch (err) {
return undefined;
}
-}
+};

Powered by Google App Engine
This is Rietveld 408576698