summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorjrw <jrw@chromium.org>2015-06-10 15:56:24 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-10 22:57:11 +0000
commit5ffa27c976b8b6d7253ec2971c9267cac3b4fa0c (patch)
tree0e2c3c2cee46118fd0fb9ad22c0a68138c0a9e0a /remoting
parent6d1614a34303764ef581dbef171c8204164bed5d (diff)
downloadchromium_src-5ffa27c976b8b6d7253ec2971c9267cac3b4fa0c.zip
chromium_src-5ffa27c976b8b6d7253ec2971c9267cac3b4fa0c.tar.gz
chromium_src-5ffa27c976b8b6d7253ec2971c9267cac3b4fa0c.tar.bz2
Renamed HostListApi implementations.
This CL does nothing but rename some classes and files so that implementations of HostListApi follow the pattern <Decription>HostListApi. This is in preparation for adding a fourth implementation of HostListApi. BUG=471928 Review URL: https://codereview.chromium.org/1168133006 Cr-Commit-Position: refs/heads/master@{#333827}
Diffstat (limited to 'remoting')
-rw-r--r--remoting/remoting_webapp_files.gypi11
-rw-r--r--remoting/webapp/crd/js/gcd_host_list_api.js (renamed from remoting/webapp/crd/js/host_list_api_gcd_impl.js)12
-rw-r--r--remoting/webapp/crd/js/host_list_api.js6
-rw-r--r--remoting/webapp/crd/js/legacy_host_list_api.js (renamed from remoting/webapp/crd/js/host_list_api_impl.js)21
-rw-r--r--remoting/webapp/crd/js/legacy_host_list_api_unittest.js (renamed from remoting/webapp/crd/js/host_list_api_impl_unittest.js)6
-rw-r--r--remoting/webapp/files.gni9
6 files changed, 38 insertions, 27 deletions
diff --git a/remoting/remoting_webapp_files.gypi b/remoting/remoting_webapp_files.gypi
index 11ae27c..3657d33 100644
--- a/remoting/remoting_webapp_files.gypi
+++ b/remoting/remoting_webapp_files.gypi
@@ -103,8 +103,8 @@
'webapp/crd/js/gcd_client_with_mock_xhr_unittest.js',
'webapp/crd/js/host_controller_unittest.js',
'webapp/crd/js/host_daemon_facade_unittest.js',
- 'webapp/crd/js/host_list_api_impl_unittest.js',
'webapp/crd/js/host_table_entry_unittest.js',
+ 'webapp/crd/js/legacy_host_list_api_unittest.js',
'webapp/crd/js/menu_button_unittest.js',
'webapp/crd/js/mock_xhr_unittest.js',
],
@@ -266,10 +266,15 @@
'remoting_webapp_js_host_display_files': [
'webapp/crd/js/host_list.js',
'webapp/crd/js/host_list_api.js',
- 'webapp/crd/js/host_list_api_gcd_impl.js',
- 'webapp/crd/js/host_list_api_impl.js',
'webapp/crd/js/host_table_entry.js',
'webapp/crd/js/local_host_section.js',
+
+ # Must come after host_list_api.js because of an issue with
+ # JSCompiler. If an implementation of an interface occurs in a
+ # file processed before the interface itself, the @override tag
+ # doesn't always work correctly.
+ 'webapp/crd/js/gcd_host_list_api.js',
+ 'webapp/crd/js/legacy_host_list_api.js',
],
# The CRD-specific JavaScript files required by main.html.
'remoting_webapp_crd_js_ui_files': [
diff --git a/remoting/webapp/crd/js/host_list_api_gcd_impl.js b/remoting/webapp/crd/js/gcd_host_list_api.js
index de7a60d..a904c9d 100644
--- a/remoting/webapp/crd/js/host_list_api_gcd_impl.js
+++ b/remoting/webapp/crd/js/gcd_host_list_api.js
@@ -18,14 +18,14 @@ var remoting = remoting || {};
* @constructor
* @implements {remoting.HostListApi}
*/
-remoting.HostListApiGcdImpl = function() {
+remoting.GcdHostListApi = function() {
this.gcd_ = new remoting.gcd.Client({
apiKey: remoting.settings.GOOGLE_API_KEY
});
};
/** @override */
-remoting.HostListApiGcdImpl.prototype.register = function(
+remoting.GcdHostListApi.prototype.register = function(
hostName, publicKey, hostClientId) {
var self = this;
var deviceDraft = {
@@ -72,7 +72,7 @@ remoting.HostListApiGcdImpl.prototype.register = function(
};
/** @override */
-remoting.HostListApiGcdImpl.prototype.get = function() {
+remoting.GcdHostListApi.prototype.get = function() {
return this.gcd_.listDevices().
then(function(devices) {
var hosts = [];
@@ -90,7 +90,7 @@ remoting.HostListApiGcdImpl.prototype.get = function() {
};
/** @override */
-remoting.HostListApiGcdImpl.prototype.put =
+remoting.GcdHostListApi.prototype.put =
function(hostId, hostName, hostPublicKey) {
return this.gcd_.patchDevice(hostId, {
'name': hostName
@@ -110,7 +110,7 @@ remoting.HostListApiGcdImpl.prototype.put =
};
/** @override */
-remoting.HostListApiGcdImpl.prototype.remove = function(hostId) {
+remoting.GcdHostListApi.prototype.remove = function(hostId) {
return this.gcd_.deleteDevice(hostId).then(function(deleted) {
if (!deleted) {
console.error('error deleting host from GCD');
@@ -121,7 +121,7 @@ remoting.HostListApiGcdImpl.prototype.remove = function(hostId) {
};
/** @override */
-remoting.HostListApiGcdImpl.prototype.getSupportHost = function(supportId) {
+remoting.GcdHostListApi.prototype.getSupportHost = function(supportId) {
console.error('getSupportHost not supported by HostListApiGclImpl');
return Promise.reject(remoting.Error.unexpected());
};
diff --git a/remoting/webapp/crd/js/host_list_api.js b/remoting/webapp/crd/js/host_list_api.js
index d263c3c..421314e 100644
--- a/remoting/webapp/crd/js/host_list_api.js
+++ b/remoting/webapp/crd/js/host_list_api.js
@@ -81,8 +81,8 @@ var instance = null;
remoting.HostListApi.getInstance = function() {
if (instance == null) {
instance = remoting.settings.USE_GCD ?
- new remoting.HostListApiGcdImpl() :
- new remoting.HostListApiImpl();
+ new remoting.GcdHostListApi() :
+ new remoting.LegacyHostListApi();
}
return instance;
};
@@ -122,4 +122,4 @@ remoting.HostListApi.setInstance = function(newInstance) {
* isLegacy: boolean
* }}
*/
-remoting.HostListApi.RegisterResult; \ No newline at end of file
+remoting.HostListApi.RegisterResult;
diff --git a/remoting/webapp/crd/js/host_list_api_impl.js b/remoting/webapp/crd/js/legacy_host_list_api.js
index 2a5a19f..c99c977 100644
--- a/remoting/webapp/crd/js/host_list_api_impl.js
+++ b/remoting/webapp/crd/js/legacy_host_list_api.js
@@ -18,11 +18,11 @@ var remoting = remoting || {};
* @constructor
* @implements {remoting.HostListApi}
*/
-remoting.HostListApiImpl = function() {
+remoting.LegacyHostListApi = function() {
};
/** @override */
-remoting.HostListApiImpl.prototype.register = function(
+remoting.LegacyHostListApi.prototype.register = function(
hostName, publicKey, hostClientId) {
var newHostId = base.generateUuid();
var newHostDetails = { data: {
@@ -61,7 +61,7 @@ remoting.HostListApiImpl.prototype.register = function(
};
/** @override */
-remoting.HostListApiImpl.prototype.get = function() {
+remoting.LegacyHostListApi.prototype.get = function() {
var that = this;
return new remoting.Xhr({
method: 'GET',
@@ -73,7 +73,7 @@ remoting.HostListApiImpl.prototype.get = function() {
};
/** @override */
-remoting.HostListApiImpl.prototype.put =
+remoting.LegacyHostListApi.prototype.put =
function(hostId, hostName, hostPublicKey) {
return new remoting.Xhr({
method: 'PUT',
@@ -86,16 +86,16 @@ remoting.HostListApiImpl.prototype.put =
}
},
useIdentity: true
- }).start().then(remoting.HostListApiImpl.defaultResponse_());
+ }).start().then(remoting.LegacyHostListApi.defaultResponse_());
};
/** @override */
-remoting.HostListApiImpl.prototype.remove = function(hostId) {
+remoting.LegacyHostListApi.prototype.remove = function(hostId) {
return new remoting.Xhr({
method: 'DELETE',
url: remoting.settings.DIRECTORY_API_BASE_URL + '/@me/hosts/' + hostId,
useIdentity: true
- }).start().then(remoting.HostListApiImpl.defaultResponse_(
+ }).start().then(remoting.LegacyHostListApi.defaultResponse_(
[remoting.Error.Tag.NOT_FOUND]));
};
@@ -108,7 +108,8 @@ remoting.HostListApiImpl.prototype.remove = function(hostId) {
* @return {!Array<!remoting.Host>}
* @private
*/
-remoting.HostListApiImpl.prototype.parseHostListResponse_ = function(response) {
+remoting.LegacyHostListApi.prototype.parseHostListResponse_ =
+ function(response) {
if (response.status == 200) {
var obj = /** @type {{data: {items: Array}}} */
(base.jsonParseSafe(response.getText()));
@@ -146,7 +147,7 @@ remoting.HostListApiImpl.prototype.parseHostListResponse_ = function(response) {
* @return {function(!remoting.Xhr.Response):void}
* @private
*/
-remoting.HostListApiImpl.defaultResponse_ = function(opt_ignoreErrors) {
+remoting.LegacyHostListApi.defaultResponse_ = function(opt_ignoreErrors) {
/** @param {!remoting.Xhr.Response} response */
var result = function(response) {
var error = remoting.Error.fromHttpStatus(response.status);
@@ -164,7 +165,7 @@ remoting.HostListApiImpl.defaultResponse_ = function(opt_ignoreErrors) {
};
/** @override */
-remoting.HostListApiImpl.prototype.getSupportHost = function(supportId) {
+remoting.LegacyHostListApi.prototype.getSupportHost = function(supportId) {
return new remoting.Xhr({
method: 'GET',
url: remoting.settings.DIRECTORY_API_BASE_URL + '/support-hosts/' +
diff --git a/remoting/webapp/crd/js/host_list_api_impl_unittest.js b/remoting/webapp/crd/js/legacy_host_list_api_unittest.js
index 80661d9..ef2b598 100644
--- a/remoting/webapp/crd/js/host_list_api_impl_unittest.js
+++ b/remoting/webapp/crd/js/legacy_host_list_api_unittest.js
@@ -60,7 +60,7 @@ function queueRegistryResponse(assert) {
}
QUnit.test('register', function(assert) {
- var impl = new remoting.HostListApiImpl();
+ var impl = new remoting.LegacyHostListApi();
queueRegistryResponse(assert);
return impl.register(
FAKE_HOST_NAME,
@@ -73,7 +73,7 @@ QUnit.test('register', function(assert) {
});
QUnit.test('register failure', function(assert) {
- var impl = new remoting.HostListApiImpl();
+ var impl = new remoting.LegacyHostListApi();
remoting.MockXhr.setEmptyResponseFor(
'POST', 'DIRECTORY_API_BASE_URL/@me/hosts', 500);
return impl.register(
@@ -87,4 +87,4 @@ QUnit.test('register failure', function(assert) {
});
});
-})(); \ No newline at end of file
+})();
diff --git a/remoting/webapp/files.gni b/remoting/webapp/files.gni
index 3ca99aa..7e77289 100644
--- a/remoting/webapp/files.gni
+++ b/remoting/webapp/files.gni
@@ -267,10 +267,15 @@ remoting_webapp_js_host_control_files = [
remoting_webapp_js_host_display_files = [
"crd/js/host_list.js",
"crd/js/host_list_api.js",
- "crd/js/host_list_api_gcd_impl.js",
- "crd/js/host_list_api_impl.js",
"crd/js/host_table_entry.js",
"crd/js/local_host_section.js",
+
+ # Must come after host_list_api.js because of an issue with
+ # JSCompiler. If an implementation of an interface occurs in a
+ # file processed before the interface itself, the @override tag
+ # doesn't always work correctly.
+ "crd/js/gcd_host_list_api.js",
+ "crd/js/legacy_host_list_api.js",
]
# The CRD-specific JavaScript files required by main.html.