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

Unified Diff: chrome/browser/extensions/api/storage/sync_storage_backend.h

Issue 165223003: Add a Restore() method to ValueStore and make StorageAPI use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master Created 6 years, 10 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
Index: chrome/browser/extensions/api/storage/sync_storage_backend.h
diff --git a/chrome/browser/extensions/api/storage/settings_backend.h b/chrome/browser/extensions/api/storage/sync_storage_backend.h
similarity index 72%
copy from chrome/browser/extensions/api/storage/settings_backend.h
copy to chrome/browser/extensions/api/storage/sync_storage_backend.h
index 0882b68ed3538996b8767075c802c5813026b9c3..ab84b71b27c9585f5e012c82677fad8bff348182 100644
--- a/chrome/browser/extensions/api/storage/settings_backend.h
+++ b/chrome/browser/extensions/api/storage/sync_storage_backend.h
@@ -1,9 +1,9 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_BACKEND_H_
-#define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_BACKEND_H_
+#ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNC_STORAGE_BACKEND_H_
+#define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNC_STORAGE_BACKEND_H_
#include <map>
#include <set>
@@ -14,6 +14,7 @@
#include "base/memory/linked_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/extensions/api/storage/settings_backend.h"
#include "chrome/browser/extensions/api/storage/settings_observer.h"
#include "chrome/browser/extensions/api/storage/settings_storage_factory.h"
#include "chrome/browser/extensions/api/storage/settings_storage_quota_enforcer.h"
@@ -31,32 +32,31 @@ class SyncableSettingsStorage;
// Manages ValueStore objects for extensions, including routing
// changes from sync to them.
// Lives entirely on the FILE thread.
-class SettingsBackend : public syncer::SyncableService {
+class SyncStorageBackend : public SettingsBackend,
+ public syncer::SyncableService {
public:
// |storage_factory| is use to create leveldb storage areas.
// |base_path| is the base of the extension settings directory, so the
// databases will be at base_path/extension_id.
// |observers| is the list of observers to settings changes.
- SettingsBackend(
+ SyncStorageBackend(
const scoped_refptr<SettingsStorageFactory>& storage_factory,
const base::FilePath& base_path,
- syncer::ModelType sync_type,
- const syncer::SyncableService::StartSyncFlare& flare,
const SettingsStorageQuotaEnforcer::Limits& quota,
- const scoped_refptr<SettingsObserverList>& observers);
-
- virtual ~SettingsBackend();
+ const scoped_refptr<SettingsObserverList>& observers,
+ syncer::ModelType sync_type,
+ const syncer::SyncableService::StartSyncFlare& flare);
- // Gets a weak reference to the storage area for |extension_id|.
- // Must be run on the FILE thread.
- ValueStore* GetStorage(const std::string& extension_id) const;
+ virtual ~SyncStorageBackend();
- // Deletes all setting data for an extension. Call on the FILE thread.
- void DeleteStorage(const std::string& extension_id);
+ // SettingsBackend implementation.
+ virtual ValueStore* GetStorage(const std::string& extension_id) OVERRIDE;
+ virtual void DeleteStorage(const std::string& extension_id) OVERRIDE;
+ virtual syncer::SyncableService* GetAsSyncableService() OVERRIDE;
// syncer::SyncableService implementation.
- virtual syncer::SyncDataList GetAllSyncData(
- syncer::ModelType type) const OVERRIDE;
+ virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type)
+ const OVERRIDE;
virtual syncer::SyncMergeResult MergeDataAndStartSyncing(
syncer::ModelType type,
const syncer::SyncDataList& initial_sync_data,
@@ -82,15 +82,6 @@ class SettingsBackend : public syncer::SyncableService {
scoped_ptr<SettingsSyncProcessor> CreateSettingsSyncProcessor(
const std::string& extension_id) const;
- // The Factory to use for creating leveldb storage areas.
- const scoped_refptr<SettingsStorageFactory> storage_factory_;
-
- // The base file path to create any leveldb databases at.
- const base::FilePath base_path_;
-
- // Quota limits (see SettingsStorageQuotaEnforcer).
- const SettingsStorageQuotaEnforcer::Limits quota_;
-
// The list of observers to settings changes.
const scoped_refptr<SettingsObserverList> observers_;
@@ -111,9 +102,9 @@ class SettingsBackend : public syncer::SyncableService {
syncer::SyncableService::StartSyncFlare flare_;
- DISALLOW_COPY_AND_ASSIGN(SettingsBackend);
+ DISALLOW_COPY_AND_ASSIGN(SyncStorageBackend);
};
} // namespace extensions
-#endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_BACKEND_H_
+#endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNC_STORAGE_BACKEND_H_

Powered by Google App Engine
This is Rietveld 408576698