Chromium Code Reviews| Index: chrome/common/extensions/docs/examples/apps/cycler/cycler_data.js |
| diff --git a/chrome/common/extensions/docs/examples/apps/cycler/cycler_data.js b/chrome/common/extensions/docs/examples/apps/cycler/cycler_data.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d45434cf160d8b8e6ecbe6ffd27bcb306c954c12 |
| --- /dev/null |
| +++ b/chrome/common/extensions/docs/examples/apps/cycler/cycler_data.js |
| @@ -0,0 +1,35 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +var CyclerData = function () { |
|
Jeffrey Yasskin
2012/08/15 01:03:59
I assume you plan to save this object to some sort
clintstaley
2012/08/15 23:54:20
Not the object, but the FileSystem it will use wil
Jeffrey Yasskin
2012/08/16 20:19:31
Ah, so it'll do the equivalent of an `ls` to popul
clintstaley
2012/08/17 04:12:25
Yeah, I found it took a little getting used to too
|
| + this.currentCaptures_ = ['alpha', 'beta', 'gamma']; |
| + |
| + /** |
| + * Mark a capture as saved successfully. Actual writing of the cache |
| + * directory and URL list into the FileSystem is done from the C++ side. |
| + * JS side just updates the capture choices. |
| + * @param {!string} name The name of the capture. |
| + */ |
| + this.saveCapture = function(name) { |
| + console.log('Saving capture ' + name); |
| + this.currentCaptures_.push(name); |
| + } |
| + |
| + /** |
| + * Return a list of currently stored captures in the local FileSystem. |
| + * @return {Array.<!string>} Names of all the current captures. |
| + */ |
| + this.getCaptures = function() { |
| + return this.currentCaptures_; |
| + } |
| + |
| + /** |
| + * Delete capture |name| from the local FileSystem, and update the |
|
Jeffrey Yasskin
2012/08/15 01:03:59
Please mark the actual deletion as a TODO.
clintstaley
2012/08/15 23:54:20
Done, here and on the other two TODO methods as we
|
| + * capture choices HTML select element. |
| + * @param {!string} name The name of the capture to delete. |
| + */ |
| + this.deleteCapture = function(name) { |
| + this.currentCaptures_.splice(this.currentCaptures_.indexOf(name), 1); |
| + } |
| +}; |