Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: chrome/ext/background.js

Issue 29332926: Issue 3446 - Remove code migrating prefs and files to chrome.storage (Closed)
Patch Set: Created Dec. 21, 2015, 2:48 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lib/io.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/ext/background.js
===================================================================
--- a/chrome/ext/background.js
+++ b/chrome/ext/background.js
@@ -531,89 +531,7 @@
{
chrome.storage.local.remove(key, callback);
},
- onChanged: chrome.storage.onChanged,
-
- // Migrate localStorage to chrome.storage.local,
- // ignoring unkown and invalid preferences.
- migratePrefs: function(hooks)
- {
- var items = {};
-
- for (let key in localStorage)
- {
- var item = hooks.map(key, localStorage[key]);
- if (item)
- items[item.key] = item.value;
- }
-
- chrome.storage.local.set(items, function() {
- localStorage.clear();
- hooks.done();
- });
- },
-
- // Migrate FileSystem API to chrome.storage.local. For simplicity
- // only patterns.ini is considered. Backups are left behind.
- migrateFiles: function(callback)
- {
- if ("webkitRequestFileSystem" in window)
- {
- webkitRequestFileSystem(PERSISTENT, 0, function(fs)
- {
- fs.root.getFile("patterns.ini", {}, function(entry)
- {
- entry.getMetadata(function(metadata)
- {
- entry.file(function(file)
- {
- var reader = new FileReader();
- reader.onloadend = function()
- {
- if (!reader.error)
- {
- chrome.storage.local.set(
- {
- "file:patterns.ini": {
- content: reader.result.split(/[\r\n]+/),
- lastModified: metadata.modificationTime.getTime()
- }
- },
- function()
- {
- fs.root.createReader().readEntries(function(entries)
- {
- var emptyFunc = function() {};
-
- for (var i = 0; i < entries.length; i++)
- {
- var entry = entries[i];
- if (entry.isDirectory)
- entry.removeRecursively(emptyFunc, emptyFunc);
- else
- entry.remove(emptyFunc, emptyFunc);
- }
- });
-
- callback();
- }
- );
- }
- else
- {
- callback();
- }
- };
- reader.readAsText(file);
- }, callback);
- }, callback);
- }, callback);
- }, callback);
- }
- else
- {
- callback();
- }
- }
+ onChanged: chrome.storage.onChanged
};
/* Options */
« no previous file with comments | « no previous file | lib/io.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld