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

Unified Diff: chrome/browser/extensions/extension_prefs.cc

Issue 10977048: Fix bug in disabling sync for default apps (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fix browser and integration tests, which got broken Created 8 years, 2 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 | « chrome/browser/extensions/extension_prefs.h ('k') | chrome/browser/extensions/extension_prefs_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_prefs.cc
diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc
index db8181f73ca13ea113c52e35461c0f03d160711b..9f1762f0fecc057dacff9a43968b5918802f838a 100644
--- a/chrome/browser/extensions/extension_prefs.cc
+++ b/chrome/browser/extensions/extension_prefs.cc
@@ -162,6 +162,9 @@ const char kPrefOldGrantedAPIs[] = "granted_permissions.api";
// A preference that indicates when an extension was installed.
const char kPrefInstallTime[] = "install_time";
+// A preference which saves the creation flags for extensions.
+const char kPrefCreationFlags[] = "creation_flags";
+
// A preference that indicates whether the extension was installed from the
// Chrome Web Store.
const char kPrefFromWebStore[] = "from_webstore";
@@ -1442,7 +1445,6 @@ void ExtensionPrefs::SetActionBoxOrder(const ExtensionIdList& extension_ids) {
void ExtensionPrefs::OnExtensionInstalled(
const Extension* extension,
Extension::State initial_state,
- bool from_webstore,
const syncer::StringOrdinal& page_ordinal) {
const std::string& id = extension->id();
CHECK(Extension::IdIsValid(id));
@@ -1452,8 +1454,10 @@ void ExtensionPrefs::OnExtensionInstalled(
extension_dict->Set(kPrefState, Value::CreateIntegerValue(initial_state));
extension_dict->Set(kPrefLocation,
Value::CreateIntegerValue(extension->location()));
+ extension_dict->Set(kPrefCreationFlags,
+ Value::CreateIntegerValue(extension->creation_flags()));
extension_dict->Set(kPrefFromWebStore,
- Value::CreateBooleanValue(from_webstore));
+ Value::CreateBooleanValue(extension->from_webstore()));
extension_dict->Set(kPrefFromBookmark,
Value::CreateBooleanValue(extension->from_bookmark()));
extension_dict->Set(kPrefWasInstalledByDefault,
@@ -1865,6 +1869,22 @@ bool ExtensionPrefs::IsFromBookmark(
return false;
}
+int ExtensionPrefs::GetCreationFlags(const std::string& extension_id) const {
+ int creation_flags = Extension::NO_FLAGS;
+ if (!ReadExtensionPrefInteger(extension_id, kPrefCreationFlags,
+ &creation_flags)) {
+ // Since kPrefCreationFlags was added later, it will be missing for
+ // previously installed extensions.
+ if (IsFromBookmark(extension_id))
+ creation_flags |= Extension::FROM_BOOKMARK;
+ if (IsFromWebStore(extension_id))
+ creation_flags |= Extension::FROM_WEBSTORE;
+ if (WasInstalledByDefault(extension_id))
+ creation_flags |= Extension::WAS_INSTALLED_BY_DEFAULT;
+ }
+ return creation_flags;
+}
+
bool ExtensionPrefs::WasInstalledByDefault(
const std::string& extension_id) const {
const DictionaryValue* dictionary = GetExtensionPref(extension_id);
« no previous file with comments | « chrome/browser/extensions/extension_prefs.h ('k') | chrome/browser/extensions/extension_prefs_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698