summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/glue/extension_util.cc
diff options
context:
space:
mode:
authorIain Merrick <husky@google.com>2010-11-01 12:19:54 +0000
committerIain Merrick <husky@google.com>2010-11-03 10:21:10 +0000
commit731df977c0511bca2206b5f333555b1205ff1f43 (patch)
tree0e750b949b3f00a1ac11fda25d3c2de512f2b465 /chrome/browser/sync/glue/extension_util.cc
parent5add15e10e7bb80512f2c597ca57221314abe577 (diff)
downloadexternal_chromium-731df977c0511bca2206b5f333555b1205ff1f43.zip
external_chromium-731df977c0511bca2206b5f333555b1205ff1f43.tar.gz
external_chromium-731df977c0511bca2206b5f333555b1205ff1f43.tar.bz2
Merge Chromium at r63472 : Initial merge by git.
Change-Id: Ifb9ee821af006a5f2211e81471be93ae440a1f5a
Diffstat (limited to 'chrome/browser/sync/glue/extension_util.cc')
-rw-r--r--chrome/browser/sync/glue/extension_util.cc38
1 files changed, 29 insertions, 9 deletions
diff --git a/chrome/browser/sync/glue/extension_util.cc b/chrome/browser/sync/glue/extension_util.cc
index dfd7b04..a5d74d0 100644
--- a/chrome/browser/sync/glue/extension_util.cc
+++ b/chrome/browser/sync/glue/extension_util.cc
@@ -10,6 +10,7 @@
#include "base/scoped_ptr.h"
#include "base/stl_util-inl.h"
#include "base/version.h"
+#include "chrome/browser/extensions/extension_prefs.h"
#include "chrome/browser/extensions/extensions_service.h"
#include "chrome/browser/sync/protocol/extension_specifics.pb.h"
#include "chrome/common/extensions/extension.h"
@@ -23,8 +24,7 @@ ExtensionType GetExtensionType(const Extension& extension) {
return THEME;
}
- // TODO(akalin): Add Extensions::is_app().
- if (!extension.GetFullLaunchURL().is_empty()) {
+ if (extension.is_app()) {
return APP;
}
@@ -39,6 +39,27 @@ ExtensionType GetExtensionType(const Extension& extension) {
return EXTENSION;
}
+// Keep this in sync with the above function.
+// TODO(akalin): Or just hurry up and remove this!
+ExtensionType GetExtensionTypeFromUninstalledExtensionInfo(
+ const UninstalledExtensionInfo& uninstalled_extension_info) {
+ if (uninstalled_extension_info.is_theme) {
+ return THEME;
+ }
+
+ if (uninstalled_extension_info.is_app) {
+ return APP;
+ }
+
+ if (uninstalled_extension_info.converted_from_user_script) {
+ if (uninstalled_extension_info.update_url.is_empty()) {
+ return LOCAL_USER_SCRIPT;
+ }
+ return UPDATEABLE_USER_SCRIPT;
+ }
+ return EXTENSION;
+}
+
bool IsExtensionValid(const Extension& extension) {
// TODO(akalin): Figure out if we need to allow some other types.
if (extension.location() != Extension::INTERNAL) {
@@ -172,13 +193,12 @@ bool AreExtensionSpecificsNonUserPropertiesEqual(
}
void GetExtensionSpecifics(const Extension& extension,
- ExtensionsService* extensions_service,
+ ExtensionPrefs* extension_prefs,
sync_pb::ExtensionSpecifics* specifics) {
const std::string& id = extension.id();
bool enabled =
- extensions_service->GetExtensionById(id, false) != NULL;
- bool incognito_enabled =
- extensions_service->IsIncognitoEnabled(&extension);
+ extension_prefs->GetExtensionState(id) == Extension::ENABLED;
+ bool incognito_enabled = extension_prefs->IsIncognitoEnabled(id);
GetExtensionSpecificsHelper(extension, enabled, incognito_enabled,
specifics);
}
@@ -224,14 +244,14 @@ void SetExtensionProperties(
<< "has a different update URL than the extension: "
<< update_url.spec() << " vs. " << extension->update_url();
}
- bool enabled = extensions_service->GetExtensionById(id, false) != NULL;
+ ExtensionPrefs* extension_prefs = extensions_service->extension_prefs();
+ bool enabled = extension_prefs->GetExtensionState(id) == Extension::ENABLED;
if (enabled && !specifics.enabled()) {
extensions_service->DisableExtension(id);
} else if (!enabled && specifics.enabled()) {
extensions_service->EnableExtension(id);
}
- bool incognito_enabled =
- extensions_service->IsIncognitoEnabled(extension);
+ bool incognito_enabled = extension_prefs->IsIncognitoEnabled(id);
if (incognito_enabled != specifics.incognito_enabled()) {
extensions_service->SetIsIncognitoEnabled(
extension, specifics.incognito_enabled());