| Index: chrome/browser/extensions/api/storage/settings_sync_util.cc
|
| diff --git a/chrome/browser/extensions/api/storage/settings_sync_util.cc b/chrome/browser/extensions/api/storage/settings_sync_util.cc
|
| index 36169c896473c0497d1a8e0db9c9df027b42573f..e29718c43f4a593c99230337ba1b709fa4e24205 100644
|
| --- a/chrome/browser/extensions/api/storage/settings_sync_util.cc
|
| +++ b/chrome/browser/extensions/api/storage/settings_sync_util.cc
|
| @@ -4,7 +4,6 @@
|
|
|
| #include "chrome/browser/extensions/api/storage/settings_sync_util.h"
|
|
|
| -#include "base/bind.h"
|
| #include "base/json/json_writer.h"
|
| #include "base/values.h"
|
| #include "chrome/browser/extensions/api/storage/sync_value_store_cache.h"
|
| @@ -14,10 +13,7 @@
|
| #include "content/public/browser/browser_thread.h"
|
| #include "extensions/browser/api/storage/storage_frontend.h"
|
|
|
| -using base::WeakPtr;
|
| using content::BrowserThread;
|
| -using syncer::ModelType;
|
| -using syncer::SyncableService;
|
|
|
| namespace extensions {
|
|
|
| @@ -48,19 +44,13 @@
|
| extension_id, key, value, specifics->mutable_extension_setting());
|
| }
|
|
|
| -WeakPtr<SyncableService> GetSyncableService(WeakPtr<SyncValueStoreCache> cache,
|
| - ModelType type) {
|
| - DCHECK_CURRENTLY_ON(BrowserThread::FILE);
|
| - return cache.get() ? cache->GetSyncableService(type)->AsWeakPtr()
|
| - : WeakPtr<SyncableService>();
|
| -}
|
| -
|
| } // namespace
|
|
|
| -syncer::SyncData CreateData(const std::string& extension_id,
|
| - const std::string& key,
|
| - const base::Value& value,
|
| - ModelType type) {
|
| +syncer::SyncData CreateData(
|
| + const std::string& extension_id,
|
| + const std::string& key,
|
| + const base::Value& value,
|
| + syncer::ModelType type) {
|
| sync_pb::EntitySpecifics specifics;
|
| switch (type) {
|
| case syncer::EXTENSION_SETTINGS:
|
| @@ -87,29 +77,32 @@
|
| extension_id + "/" + key, key, specifics);
|
| }
|
|
|
| -syncer::SyncChange CreateAdd(const std::string& extension_id,
|
| - const std::string& key,
|
| - const base::Value& value,
|
| - ModelType type) {
|
| +syncer::SyncChange CreateAdd(
|
| + const std::string& extension_id,
|
| + const std::string& key,
|
| + const base::Value& value,
|
| + syncer::ModelType type) {
|
| return syncer::SyncChange(
|
| FROM_HERE,
|
| syncer::SyncChange::ACTION_ADD,
|
| CreateData(extension_id, key, value, type));
|
| }
|
|
|
| -syncer::SyncChange CreateUpdate(const std::string& extension_id,
|
| - const std::string& key,
|
| - const base::Value& value,
|
| - ModelType type) {
|
| +syncer::SyncChange CreateUpdate(
|
| + const std::string& extension_id,
|
| + const std::string& key,
|
| + const base::Value& value,
|
| + syncer::ModelType type) {
|
| return syncer::SyncChange(
|
| FROM_HERE,
|
| syncer::SyncChange::ACTION_UPDATE,
|
| CreateData(extension_id, key, value, type));
|
| }
|
|
|
| -syncer::SyncChange CreateDelete(const std::string& extension_id,
|
| - const std::string& key,
|
| - ModelType type) {
|
| +syncer::SyncChange CreateDelete(
|
| + const std::string& extension_id,
|
| + const std::string& key,
|
| + syncer::ModelType type) {
|
| base::DictionaryValue no_value;
|
| return syncer::SyncChange(
|
| FROM_HERE,
|
| @@ -117,17 +110,14 @@
|
| CreateData(extension_id, key, no_value, type));
|
| }
|
|
|
| -syncer::SyncClient::ServiceProvider GetSyncableServiceProvider(
|
| - content::BrowserContext* context,
|
| - ModelType type) {
|
| - DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
| +syncer::SyncableService* GetSyncableService(content::BrowserContext* context,
|
| + syncer::ModelType type) {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::FILE);
|
| DCHECK(type == syncer::APP_SETTINGS || type == syncer::EXTENSION_SETTINGS);
|
| StorageFrontend* frontend = StorageFrontend::Get(context);
|
| SyncValueStoreCache* sync_cache = static_cast<SyncValueStoreCache*>(
|
| frontend->GetValueStoreCache(settings_namespace::SYNC));
|
| - // We must rely on our caller to guarantee that sync_cache->AsWeakPtr() is a
|
| - // valid call right now, and that shutdown has not begun.
|
| - return base::Bind(&GetSyncableService, sync_cache->AsWeakPtr(), type);
|
| + return sync_cache->GetSyncableService(type);
|
| }
|
|
|
| } // namespace settings_sync_util
|
|
|