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

Unified Diff: lib/prefs.js

Issue 5251132066627584: Issue 1488 - Add pre-configurable preference to suppress first run page (Closed)
Patch Set: Rebased and addressed comments Created March 20, 2015, 1:25 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 | « chrome/managed-storage-schema.json ('k') | metadata.chrome » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/prefs.js
===================================================================
--- a/lib/prefs.js
+++ b/lib/prefs.js
@@ -40,6 +40,7 @@
defaults.show_statsinpopup = true;
defaults.shouldShowBlockElementMenu = true;
defaults.hidePlaceholders = true;
+defaults.suppress_first_run_page = false;
let Prefs = exports.Prefs = {
onChanged: new ext._EventTarget(),
@@ -93,6 +94,9 @@
let prefs = Object.keys(defaults);
prefs.forEach(addPreference);
+ let localLoaded = false;
+ let managedLoaded = false;
+
// Migrate preferences for users updating from old versions.
// TODO: Remove the migration code after a few releases.
ext.storage.migratePrefs({
@@ -143,10 +147,29 @@
}
});
- Prefs.onLoaded._dispatch();
+ localLoaded = true;
+ if (localLoaded && managedLoaded)
+ Prefs.onLoaded._dispatch();
});
}
});
+
+ if (require("info").platform == "chromium" && "managed" in chrome.storage)
+ {
+ chrome.storage.managed.get(null, function(items)
+ {
+ for (let key in items)
+ defaults[key] = items[key];
+
+ managedLoaded = true;
+ if (localLoaded && managedLoaded)
+ Prefs.onLoaded._dispatch();
+ });
+ }
+ else
+ {
+ managedLoaded = true;
+ }
}
init();
« no previous file with comments | « chrome/managed-storage-schema.json ('k') | metadata.chrome » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld