summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync
diff options
context:
space:
mode:
authormpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-29 23:14:02 +0000
committermpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-29 23:14:02 +0000
commit9adb9693e8a90bb63be325dbb5d3391f47f839ba (patch)
tree555765afd7bc851de6f3a2bf4a35151435d58d77 /chrome/browser/sync
parent5b5a5c976aead85a87ced0847c068012d3979cae (diff)
downloadchromium_src-9adb9693e8a90bb63be325dbb5d3391f47f839ba.zip
chromium_src-9adb9693e8a90bb63be325dbb5d3391f47f839ba.tar.gz
chromium_src-9adb9693e8a90bb63be325dbb5d3391f47f839ba.tar.bz2
Part 3 of immutable Extension refactor.
Make ExtensionsService hold const Extension pointers only. This ensures that extensions can't be modified after they're created, and lets us share them between threads. BUG=56558 TEST=no functional change Review URL: http://codereview.chromium.org/4138006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64517 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync')
-rw-r--r--chrome/browser/sync/glue/extension_change_processor.cc2
-rw-r--r--chrome/browser/sync/glue/extension_sync.cc6
-rw-r--r--chrome/browser/sync/glue/extension_util.cc2
-rw-r--r--chrome/browser/sync/glue/extension_util.h2
-rw-r--r--chrome/browser/sync/glue/theme_change_processor.cc6
-rw-r--r--chrome/browser/sync/glue/theme_util.cc2
6 files changed, 10 insertions, 10 deletions
diff --git a/chrome/browser/sync/glue/extension_change_processor.cc b/chrome/browser/sync/glue/extension_change_processor.cc
index 0cc64a9..fcbbd01 100644
--- a/chrome/browser/sync/glue/extension_change_processor.cc
+++ b/chrome/browser/sync/glue/extension_change_processor.cc
@@ -71,7 +71,7 @@ void ExtensionChangeProcessor::Observe(NotificationType type,
RemoveServerData(traits_, id, profile_->GetProfileSyncService());
}
} else {
- const Extension* extension = Details<Extension>(details).ptr();
+ const Extension* extension = Details<const Extension>(details).ptr();
CHECK(extension);
VLOG(1) << "Updating server data for extension " << extension->id()
<< " (notification type = " << type.value << ")";
diff --git a/chrome/browser/sync/glue/extension_sync.cc b/chrome/browser/sync/glue/extension_sync.cc
index 51ccfd4..facf5f1 100644
--- a/chrome/browser/sync/glue/extension_sync.cc
+++ b/chrome/browser/sync/glue/extension_sync.cc
@@ -268,7 +268,7 @@ void TryUpdateClient(
extension_data->merged_data();
DcheckIsExtensionSpecificsValid(specifics);
const std::string& id = specifics.id();
- Extension* extension = extensions_service->GetExtensionById(id, true);
+ const Extension* extension = extensions_service->GetExtensionById(id, true);
if (extension) {
if (!IsExtensionValidAndSyncable(*extension, allowed_extension_types)) {
LOG(DFATAL) << "TryUpdateClient() called for non-syncable extension "
@@ -446,7 +446,7 @@ void UpdateClient(const ExtensionSyncTraits& traits,
DcheckIsExtensionSpecificsValid(server_data);
ExtensionData extension_data =
ExtensionData::FromData(ExtensionData::SERVER, server_data);
- Extension* extension =
+ const Extension* extension =
extensions_service->GetExtensionById(server_data.id(), true);
if (extension) {
if (!IsExtensionValidAndSyncable(
@@ -478,7 +478,7 @@ void UpdateClient(const ExtensionSyncTraits& traits,
void RemoveFromClient(const ExtensionSyncTraits& traits,
const std::string& id,
ExtensionsService* extensions_service) {
- Extension* extension = extensions_service->GetExtensionById(id, true);
+ const Extension* extension = extensions_service->GetExtensionById(id, true);
if (extension) {
if (IsExtensionValidAndSyncable(*extension,
traits.allowed_extension_types)) {
diff --git a/chrome/browser/sync/glue/extension_util.cc b/chrome/browser/sync/glue/extension_util.cc
index a5d74d0..a0aa08e 100644
--- a/chrome/browser/sync/glue/extension_util.cc
+++ b/chrome/browser/sync/glue/extension_util.cc
@@ -232,7 +232,7 @@ bool IsExtensionOutdated(const Extension& extension,
void SetExtensionProperties(
const sync_pb::ExtensionSpecifics& specifics,
- ExtensionsService* extensions_service, Extension* extension) {
+ ExtensionsService* extensions_service, const Extension* extension) {
DcheckIsExtensionSpecificsValid(specifics);
CHECK(extensions_service);
CHECK(extension);
diff --git a/chrome/browser/sync/glue/extension_util.h b/chrome/browser/sync/glue/extension_util.h
index ca85e31..a46d1fb 100644
--- a/chrome/browser/sync/glue/extension_util.h
+++ b/chrome/browser/sync/glue/extension_util.h
@@ -132,7 +132,7 @@ bool IsExtensionOutdated(const Extension& extension,
// valid.
void SetExtensionProperties(
const sync_pb::ExtensionSpecifics& specifics,
- ExtensionsService* extensions_service, Extension* extension);
+ ExtensionsService* extensions_service, const Extension* extension);
// Merge |specifics| into |merged_specifics|. Both must be valid and
// have the same ID. The merge policy is currently to copy the
diff --git a/chrome/browser/sync/glue/theme_change_processor.cc b/chrome/browser/sync/glue/theme_change_processor.cc
index e22484c..55f9879 100644
--- a/chrome/browser/sync/glue/theme_change_processor.cc
+++ b/chrome/browser/sync/glue/theme_change_processor.cc
@@ -17,7 +17,7 @@
namespace browser_sync {
namespace {
-std::string GetThemeId(Extension* current_theme) {
+std::string GetThemeId(const Extension* current_theme) {
if (current_theme) {
DCHECK(current_theme->is_theme());
}
@@ -39,10 +39,10 @@ void ThemeChangeProcessor::Observe(NotificationType type,
const NotificationDetails& details) {
DCHECK(running());
DCHECK(profile_);
- Extension* extension = Details<Extension>(details).ptr();
+ const Extension* extension = Details<const Extension>(details).ptr();
std::string current_or_future_theme_id =
profile_->GetThemeProvider()->GetThemeID();
- Extension* current_theme = profile_->GetTheme();
+ const Extension* current_theme = profile_->GetTheme();
switch (type.value) {
case NotificationType::BROWSER_THEME_CHANGED:
// We pay attention to this notification only when it signifies
diff --git a/chrome/browser/sync/glue/theme_util.cc b/chrome/browser/sync/glue/theme_util.cc
index f8b72d1..0f2a16b 100644
--- a/chrome/browser/sync/glue/theme_util.cc
+++ b/chrome/browser/sync/glue/theme_util.cc
@@ -87,7 +87,7 @@ void SetCurrentThemeFromThemeSpecifics(
VLOG(1) << "Applying theme " << id << " with update_url " << update_url;
ExtensionsService* extensions_service = profile->GetExtensionsService();
CHECK(extensions_service);
- Extension* extension = extensions_service->GetExtensionById(id, true);
+ const Extension* extension = extensions_service->GetExtensionById(id, true);
if (extension) {
if (!extension->is_theme()) {
VLOG(1) << "Extension " << id << " is not a theme; aborting";