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 * Mock class for Chrome's storage API to aid with the transition to Apps v2. | 7 * Mock class for Chrome's storage API to aid with the transition to Apps v2. |
8 * | 8 * |
9 * The local storage API is not supported in Apps v2, so we'll have to use | 9 * The local storage API is not supported in Apps v2, so we'll have to use |
10 * the new storage API instead. This doesn't require Apps v2, but it turns | 10 * the new storage API instead. This doesn't require Apps v2, but it turns |
11 * out that migrating our OAuth2 code to the new API is non-trivial; since | 11 * out that migrating our OAuth2 code to the new API is non-trivial; since |
12 * that code will need to be rewritten to be Apps-v2-compatible anyway, a | 12 * that code will need to be rewritten to be Apps-v2-compatible anyway, a |
13 * mock seems like a good temporary solution. | 13 * mock seems like a good temporary solution. |
| 14 * |
| 15 * TODO(jamiewalch): Delete this file when we migrate to apps v2 |
| 16 * (http://crbug.com/ 134213). |
14 */ | 17 */ |
15 | 18 |
16 'use strict'; | 19 'use strict'; |
17 | 20 |
18 /** @suppress {duplicate} */ | 21 /** @suppress {duplicate} */ |
19 var remoting = remoting || {}; | 22 var remoting = remoting || {}; |
20 | 23 |
21 remoting.initMockStorage = function() { | 24 remoting.initMockStorage = function() { |
22 if (typeof(chrome.storage) != 'undefined') { | 25 if (typeof(chrome.storage) != 'undefined') { |
23 console.warn('Congratulations! You already have access to chrome.storage.', | 26 console.warn('Congratulations! You already have access to chrome.storage.', |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 /** | 128 /** |
126 * @param {function():void=} opt_callback | 129 * @param {function():void=} opt_callback |
127 * @return {void} | 130 * @return {void} |
128 */ | 131 */ |
129 remoting.MockStorage.prototype.clear = function(opt_callback) { | 132 remoting.MockStorage.prototype.clear = function(opt_callback) { |
130 window.localStorage.clear(); | 133 window.localStorage.clear(); |
131 if (opt_callback) { | 134 if (opt_callback) { |
132 opt_callback(); | 135 opt_callback(); |
133 } | 136 } |
134 }; | 137 }; |
OLD | NEW |