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

Side by Side Diff: remoting/webapp/host_settings.js

Issue 305393003: Fix Chromoting client startup warnings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add {} around return for consistency. Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « remoting/webapp/client_session.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * Class handling saving and restoring of per-host options. 7 * Class handling saving and restoring of per-host options.
8 */ 8 */
9 9
10 'use strict'; 10 'use strict';
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 * @return {void} Nothing. 74 * @return {void} Nothing.
75 */ 75 */
76 remoting.HostSettings.loadInternal_ = function(hostId, callback) { 76 remoting.HostSettings.loadInternal_ = function(hostId, callback) {
77 /** 77 /**
78 * @param {Object.<string>} allHosts The current options for all hosts. 78 * @param {Object.<string>} allHosts The current options for all hosts.
79 * @return {void} Nothing. 79 * @return {void} Nothing.
80 */ 80 */
81 var onDone = function(allHosts) { 81 var onDone = function(allHosts) {
82 var result = {}; 82 var result = {};
83 try { 83 try {
84 result = jsonParseSafe(allHosts[remoting.HostSettings.KEY_]); 84 var hosts = allHosts[remoting.HostSettings.KEY_];
85 if (typeof(result) != 'object') { 85 if (hosts) {
86 console.error("Error loading host settings: Not an object"); 86 result = jsonParseSafe(hosts);
87 result = {}; 87 if (typeof(result) != 'object') {
88 } else if (/** @type {Object} */ (result).hasOwnProperty(hostId) && 88 console.error("Error loading host settings: Not an object");
89 typeof(result[hostId]) == 'object') { 89 result = {};
90 callback(result[hostId], result); 90 } else if (/** @type {Object} */ (result).hasOwnProperty(hostId) &&
91 return; 91 typeof(result[hostId]) == 'object') {
92 callback(result[hostId], result);
93 return;
94 }
92 } 95 }
93 } catch (err) { 96 } catch (err) {
94 var typedErr = /** @type {*} */ (err); 97 var typedErr = /** @type {*} */ (err);
95 console.error('Error loading host settings:', typedErr); 98 console.error('Error loading host settings:', typedErr);
96 } 99 }
97 callback({}, /** @type {Object} */ (result)); 100 callback({}, /** @type {Object} */ (result));
98 }; 101 };
99 chrome.storage.local.get(remoting.HostSettings.KEY_, onDone); 102 chrome.storage.local.get(remoting.HostSettings.KEY_, onDone);
100 }; 103 };
101 104
102 /** @type {string} @private */ 105 /** @type {string} @private */
103 remoting.HostSettings.KEY_ = 'remoting-host-options'; 106 remoting.HostSettings.KEY_ = 'remoting-host-options';
OLDNEW
« no previous file with comments | « remoting/webapp/client_session.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698