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

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: Ready for Checkin 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
« no previous file with comments | « remoting/remoting_webapp_files.gypi ('k') | remoting/webapp/base/js/ipc.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/base/js/base.js
diff --git a/remoting/webapp/base/js/base.js b/remoting/webapp/base/js/base.js
index 30f13a0aae2432a70f49dbdcea4398c28ce71390..e9454553ad6c7b57fd29083348e5acac695bb3cc 100644
--- a/remoting/webapp/base/js/base.js
+++ b/remoting/webapp/base/js/base.js
@@ -179,6 +179,20 @@ base.urlJoin = function(url, opt_params) {
return url + '?' + queryParameters.join('&');
};
+
+/**
+ * @return {Object.<string, string>} The URL parameters.
+ */
+base.getUrlParameters = function() {
+ 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.
*
@@ -582,3 +596,16 @@ base.jsonParseSafe = function(jsonString) {
return undefined;
}
};
+
+/**
+ * Size the current window to fit its content vertically.
+ */
+base.resizeWindowToContent = function() {
+ var appWindow = chrome.app.window.current();
+ var outerBounds = appWindow.outerBounds;
+ var borderY = outerBounds.height - appWindow.innerBounds.height;
+ appWindow.resizeTo(outerBounds.width, document.body.clientHeight + borderY);
+ // Sometimes, resizing the window causes its position to be reset to (0, 0),
+ // so restore it explicitly.
+ appWindow.moveTo(outerBounds.left, outerBounds.top);
+};
« no previous file with comments | « remoting/remoting_webapp_files.gypi ('k') | remoting/webapp/base/js/ipc.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698