| 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 5bcb4f3217f305f60de7839fe0026887a1057602..a38d14373d31ea2fd0502b54278f81b76b1f3029 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));
|
| };
|
|
|
| @@ -104,7 +114,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) {
|
|
|