| Index: ui/file_manager/file_manager/foreground/js/app_state_controller.js
|
| diff --git a/ui/file_manager/file_manager/foreground/js/app_state_controller.js b/ui/file_manager/file_manager/foreground/js/app_state_controller.js
|
| index 7df9810eba2d0b0bfd8e69e610503aec4d73912d..e6fcb4119d8e9b225b8137828b161ab75964b182 100644
|
| --- a/ui/file_manager/file_manager/foreground/js/app_state_controller.js
|
| +++ b/ui/file_manager/file_manager/foreground/js/app_state_controller.js
|
| @@ -35,8 +35,15 @@ function AppStateController(dialogType) {
|
| */
|
| AppStateController.prototype.loadInitialViewOptions = function() {
|
| // Load initial view option.
|
| - return new Promise(function(fulfill) {
|
| - chrome.storage.local.get(this.viewOptionStorageKey_, fulfill);
|
| + return new Promise(function(fulfill, reject) {
|
| + chrome.storage.local.get(this.viewOptionStorageKey_, function(values) {
|
| + if (chrome.runtime.lastError) {
|
| + reject('Failed to load view options: ' +
|
| + chrome.runtime.lastError.message);
|
| + } else {
|
| + fulfill(values);
|
| + }
|
| + });
|
| }.bind(this)).then(function(values) {
|
| this.viewOptions_ = {};
|
| var value = values[this.viewOptionStorageKey_];
|
| @@ -55,6 +62,9 @@ AppStateController.prototype.loadInitialViewOptions = function() {
|
| this.viewOptions_[key] = window.appState.viewOptions[key];
|
| }
|
| }
|
| + }.bind(this)).catch(function(error) {
|
| + this.viewOptions_ = {};
|
| + console.error(error);
|
| }.bind(this));
|
| };
|
|
|
| @@ -110,7 +120,11 @@ AppStateController.prototype.saveViewOptions = function() {
|
| // Save the global default.
|
| var items = {};
|
| items[this.viewOptionStorageKey_] = JSON.stringify(prefs);
|
| - chrome.storage.local.set(items);
|
| + chrome.storage.local.set(items, function() {
|
| + if (chrome.runtime.lastError)
|
| + console.error('Failed to save view options: ' +
|
| + chrome.runtime.lastError.message);
|
| + });
|
|
|
| // Save the window-specific preference.
|
| if (window.appState) {
|
|
|