| OLD | NEW |
| 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 representing the host-list portion of the home screen UI. | 7 * Class representing the host-list portion of the home screen UI. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 'use strict'; | 10 'use strict'; |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 }; | 475 }; |
| 476 | 476 |
| 477 /** | 477 /** |
| 478 * Called when the user clicks the button next to the error message. The action | 478 * Called when the user clicks the button next to the error message. The action |
| 479 * depends on the error. | 479 * depends on the error. |
| 480 * | 480 * |
| 481 * @private | 481 * @private |
| 482 */ | 482 */ |
| 483 remoting.HostList.prototype.onErrorClick_ = function() { | 483 remoting.HostList.prototype.onErrorClick_ = function() { |
| 484 if (this.lastError_ == remoting.Error.AUTHENTICATION_FAILED) { | 484 if (this.lastError_ == remoting.Error.AUTHENTICATION_FAILED) { |
| 485 remoting.oauth2.doAuthRedirect(function() { | 485 remoting.identity.handleAuthFailureAndRelaunch(); |
| 486 window.location.reload(); | |
| 487 }); | |
| 488 } else { | 486 } else { |
| 489 this.refresh(remoting.updateLocalHostState); | 487 this.refresh(remoting.updateLocalHostState); |
| 490 } | 488 } |
| 491 }; | 489 }; |
| 492 | 490 |
| 493 /** | 491 /** |
| 494 * Save the host list to local storage. | 492 * Save the host list to local storage. |
| 495 */ | 493 */ |
| 496 remoting.HostList.prototype.save_ = function() { | 494 remoting.HostList.prototype.save_ = function() { |
| 497 var items = {}; | 495 var items = {}; |
| 498 items[remoting.HostList.HOSTS_KEY] = JSON.stringify(this.hosts_); | 496 items[remoting.HostList.HOSTS_KEY] = JSON.stringify(this.hosts_); |
| 499 chrome.storage.local.set(items); | 497 chrome.storage.local.set(items); |
| 500 if (this.hosts_.length !== 0) { | 498 if (this.hosts_.length !== 0) { |
| 501 remoting.AppsV2Migration.saveUserInfo(); | 499 remoting.AppsV2Migration.saveUserInfo(); |
| 502 } | 500 } |
| 503 }; | 501 }; |
| 504 | 502 |
| 505 /** | 503 /** |
| 506 * Key name under which Me2Me hosts are cached. | 504 * Key name under which Me2Me hosts are cached. |
| 507 */ | 505 */ |
| 508 remoting.HostList.HOSTS_KEY = 'me2me-cached-hosts'; | 506 remoting.HostList.HOSTS_KEY = 'me2me-cached-hosts'; |
| 509 | 507 |
| 510 /** @type {remoting.HostList} */ | 508 /** @type {remoting.HostList} */ |
| 511 remoting.hostList = null; | 509 remoting.hostList = null; |
| OLD | NEW |