Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Unified Diff: extensions/browser/extension_prefs.cc

Issue 323843003: Add a do_not_sync pref to ExtensionPrefs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for comments in #2 Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/browser/extension_prefs.h ('k') | extensions/browser/install_flag.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/extension_prefs.cc
diff --git a/extensions/browser/extension_prefs.cc b/extensions/browser/extension_prefs.cc
index 6741c62daaf978fcc7b28844eb881888ed73567d..2dc5c3737a3cd29b4455398a12c328ba6a8891a2 100644
--- a/extensions/browser/extension_prefs.cc
+++ b/extensions/browser/extension_prefs.cc
@@ -196,6 +196,10 @@ const char kPrefInstallParam[] = "install_parameter";
// A list of installed ids and a signature.
const char kInstallSignature[] = "extensions.install_signature";
+// A boolean preference that indicates whether the extension should not be
+// synced. Default value is false.
+const char kPrefDoNotSync[] = "do_not_sync";
+
// Provider of write access to a dictionary storing extension prefs.
class ScopedExtensionPrefUpdate : public DictionaryPrefUpdate {
public:
@@ -1745,6 +1749,14 @@ base::Time ExtensionPrefs::GetInstallTime(
return base::Time::FromInternalValue(install_time_i64);
}
+bool ExtensionPrefs::DoNotSync(const std::string& extension_id) const {
+ bool do_not_sync;
+ if (!ReadPrefAsBoolean(extension_id, kPrefDoNotSync, &do_not_sync))
+ return false;
+
+ return do_not_sync;
+}
+
base::Time ExtensionPrefs::GetLastLaunchTime(
const std::string& extension_id) const {
const base::DictionaryValue* extension = GetExtensionPref(extension_id);
@@ -2130,6 +2142,12 @@ void ExtensionPrefs::PopulateExtensionInfoPrefs(
extension_dict->Set(kPrefManifest,
extension->manifest()->value()->DeepCopy());
}
+
+ // Only writes kPrefDoNotSync when it is not the default.
+ if (install_flags & kInstallFlagDoNotSync)
+ extension_dict->Set(kPrefDoNotSync, new base::FundamentalValue(true));
+ else
+ extension_dict->Remove(kPrefDoNotSync, NULL);
}
void ExtensionPrefs::InitExtensionControlledPrefs(
« no previous file with comments | « extensions/browser/extension_prefs.h ('k') | extensions/browser/install_flag.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698