Skip to content

Commit

Permalink
Rename SettingsFrontend to StorageFrontend
Browse files Browse the repository at this point in the history
BUG=351872
TBR=zea@chromium.org (c/b/sync) (Just a name change)
TBR=erg@chromium.org (c/b/profiles) (Just a name change)

Review URL: https://codereview.chromium.org/197023010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257294 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
rdevlin.cronin@chromium.org committed Mar 15, 2014
1 parent e7d2bd7 commit b7e33ee
Show file tree
Hide file tree
Showing 18 changed files with 78 additions and 78 deletions.
6 changes: 3 additions & 3 deletions chrome/browser/extensions/api/storage/settings_apitest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/test/base/ui_test_utils.h"
#include "extensions/browser/api/storage/settings_frontend.h"
#include "extensions/browser/api/storage/settings_namespace.h"
#include "extensions/browser/api/storage/storage_frontend.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/value_builder.h"
#include "sync/api/fake_sync_change_processor.h"
Expand Down Expand Up @@ -402,7 +402,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionSettingsApiTest,
}

IN_PROC_BROWSER_TEST_F(ExtensionSettingsApiTest, IsStorageEnabled) {
SettingsFrontend* frontend = SettingsFrontend::Get(browser()->profile());
StorageFrontend* frontend = StorageFrontend::Get(browser()->profile());
EXPECT_TRUE(frontend->IsStorageEnabled(LOCAL));
EXPECT_TRUE(frontend->IsStorageEnabled(SYNC));

Expand Down Expand Up @@ -570,7 +570,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionSettingsApiTest,
IN_PROC_BROWSER_TEST_F(ExtensionSettingsApiTest, ManagedStorageDisabled) {
// Disable the 'managed' namespace. This is redundant when
// ENABLE_CONFIGURATION_POLICY is not defined.
SettingsFrontend* frontend = SettingsFrontend::Get(browser()->profile());
StorageFrontend* frontend = StorageFrontend::Get(browser()->profile());
frontend->DisableStorageForTesting(MANAGED);
EXPECT_FALSE(frontend->IsStorageEnabled(MANAGED));
// Now run the extension.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
#include "chrome/browser/extensions/api/storage/syncable_settings_storage.h"
#include "content/public/test/test_browser_thread.h"
#include "extensions/browser/api/storage/leveldb_settings_storage_factory.h"
#include "extensions/browser/api/storage/settings_frontend.h"
#include "extensions/browser/api/storage/settings_storage_factory.h"
#include "extensions/browser/api/storage/settings_test_util.h"
#include "extensions/browser/api/storage/storage_frontend.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/value_store/testing_value_store.h"
#include "extensions/common/manifest.h"
Expand Down Expand Up @@ -208,7 +208,7 @@ class ExtensionSettingsSyncTest : public testing::Test {
profile_.reset(new util::MockProfile(temp_dir_.path()));
storage_factory_->Reset(new LeveldbSettingsStorageFactory());
frontend_.reset(
SettingsFrontend::CreateForTesting(storage_factory_, profile_.get()));
StorageFrontend::CreateForTesting(storage_factory_, profile_.get()));
}

virtual void TearDown() OVERRIDE {
Expand Down Expand Up @@ -258,7 +258,7 @@ class ExtensionSettingsSyncTest : public testing::Test {

base::ScopedTempDir temp_dir_;
scoped_ptr<util::MockProfile> profile_;
scoped_ptr<SettingsFrontend> frontend_;
scoped_ptr<StorageFrontend> frontend_;
scoped_refptr<util::ScopedSettingsStorageFactory> storage_factory_;
scoped_ptr<MockSyncChangeProcessor> sync_processor_;
scoped_ptr<syncer::SyncChangeProcessorWrapperForTest> sync_processor_wrapper_;
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/extensions/api/storage/settings_sync_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "base/values.h"
#include "chrome/browser/extensions/api/storage/sync_value_store_cache.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/api/storage/settings_frontend.h"
#include "extensions/browser/api/storage/storage_frontend.h"
#include "sync/protocol/app_setting_specifics.pb.h"
#include "sync/protocol/extension_setting_specifics.pb.h"
#include "sync/protocol/sync.pb.h"
Expand Down Expand Up @@ -114,7 +114,7 @@ syncer::SyncableService* GetSyncableService(content::BrowserContext* context,
syncer::ModelType type) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
DCHECK(type == syncer::APP_SETTINGS || type == syncer::EXTENSION_SETTINGS);
SettingsFrontend* frontend = SettingsFrontend::Get(context);
StorageFrontend* frontend = StorageFrontend::Get(context);
SyncValueStoreCache* sync_cache = static_cast<SyncValueStoreCache*>(
frontend->GetValueStoreCache(settings_namespace::SYNC));
return sync_cache->GetSyncableService(type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#include "chrome/browser/extensions/api/storage/sync_storage_backend.h"
#include "chrome/browser/sync/glue/sync_start_util.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/api/storage/settings_frontend.h"
#include "extensions/browser/api/storage/settings_storage_quota_enforcer.h"
#include "extensions/browser/api/storage/storage_frontend.h"
#include "extensions/common/api/storage.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
Expand Down
6 changes: 3 additions & 3 deletions chrome/browser/extensions/data_deleter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/site_instance.h"
#include "content/public/browser/storage_partition.h"
#include "extensions/browser/api/storage/settings_frontend.h"
#include "extensions/browser/api/storage/storage_frontend.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
Expand Down Expand Up @@ -102,8 +102,8 @@ void DataDeleter::StartDeleting(Profile* profile, const Extension* extension) {
}

// Begin removal of the settings for the current extension.
// SettingsFrontend may not exist in unit tests.
SettingsFrontend* frontend = SettingsFrontend::Get(profile);
// StorageFrontend may not exist in unit tests.
StorageFrontend* frontend = StorageFrontend::Get(profile);
if (frontend)
frontend->DeleteStorageSoon(extension->id());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
#include "extensions/browser/api/sockets_tcp/tcp_socket_event_dispatcher.h"
#include "extensions/browser/api/sockets_tcp_server/tcp_server_socket_event_dispatcher.h"
#include "extensions/browser/api/sockets_udp/udp_socket_event_dispatcher.h"
#include "extensions/browser/api/storage/settings_frontend.h"
#include "extensions/browser/api/storage/storage_frontend.h"
#include "extensions/browser/extension_prefs_factory.h"
#include "extensions/browser/renderer_startup_helper.h"
#endif // defined(ENABLE_EXTENSIONS)
Expand Down Expand Up @@ -307,12 +307,12 @@ EnsureBrowserContextKeyedServiceFactoriesBuilt() {
extensions::PushMessagingAPI::GetFactoryInstance();
extensions::RendererStartupHelperFactory::GetInstance();
extensions::RuntimeAPI::GetFactoryInstance();
extensions::SettingsFrontend::GetFactoryInstance();
extensions::SettingsOverridesAPI::GetFactoryInstance();
extensions::SignedInDevicesManager::GetFactoryInstance();
#if defined(ENABLE_SPELLCHECK)
extensions::SpellcheckAPI::GetFactoryInstance();
#endif
extensions::StorageFrontend::GetFactoryInstance();
extensions::StreamsPrivateAPI::GetFactoryInstance();
extensions::SystemInfoAPI::GetFactoryInstance();
extensions::TabCaptureRegistry::GetFactoryInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class SyncableService;
}

namespace extensions {
class SettingsFrontend;
class StorageFrontend;
}

namespace browser_sync {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "chrome/browser/sync/test/integration/sync_datatype_helper.h"
#include "chrome/browser/sync/test/integration/sync_extension_helper.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/api/storage/settings_frontend.h"
#include "extensions/browser/api/storage/storage_frontend.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/value_store/value_store.h"
#include "extensions/common/extension.h"
Expand Down Expand Up @@ -49,7 +49,7 @@ scoped_ptr<base::DictionaryValue> GetAllSettings(
Profile* profile, const std::string& id) {
base::WaitableEvent signal(false, false);
scoped_ptr<base::DictionaryValue> settings(new base::DictionaryValue());
extensions::SettingsFrontend::Get(profile)->RunWithStorage(
extensions::StorageFrontend::Get(profile)->RunWithStorage(
ExtensionRegistry::Get(profile)->enabled_extensions().GetByID(id),
extensions::settings_namespace::SYNC,
base::Bind(&GetAllSettingsOnFileThread, settings.get(), &signal));
Expand Down Expand Up @@ -100,7 +100,7 @@ void SetExtensionSettings(
const std::string& id,
const base::DictionaryValue& settings) {
base::WaitableEvent signal(false, false);
extensions::SettingsFrontend::Get(profile)->RunWithStorage(
extensions::StorageFrontend::Get(profile)->RunWithStorage(
ExtensionRegistry::Get(profile)->enabled_extensions().GetByID(id),
extensions::settings_namespace::SYNC,
base::Bind(&SetSettingsOnFileThread, &settings, &signal));
Expand Down
2 changes: 1 addition & 1 deletion chrome/chrome_tests_unit.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -542,11 +542,11 @@
'../components/autofill/content/renderer/test_password_generation_agent.h',
# TODO: Create an extensions_unittests target. http://crbug.com/348066
'../extensions/browser/admin_policy_unittest.cc',
'../extensions/browser/api/storage/settings_frontend_unittest.cc',
'../extensions/browser/api/storage/settings_quota_unittest.cc',
'../extensions/browser/api/storage/settings_test_util.cc',
'../extensions/browser/api/storage/settings_test_util.h',
'../extensions/browser/api/storage/storage_api_unittest.cc',
'../extensions/browser/api/storage/storage_frontend_unittest.cc',
'../extensions/browser/error_map_unittest.cc',
'../extensions/browser/event_listener_map_unittest.cc',
'../extensions/browser/event_router_unittest.cc',
Expand Down
6 changes: 3 additions & 3 deletions extensions/browser/api/storage/settings_test_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "extensions/browser/api/storage/settings_test_util.h"

#include "base/files/file_path.h"
#include "extensions/browser/api/storage/settings_frontend.h"
#include "extensions/browser/api/storage/storage_frontend.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system_provider.h"
#include "extensions/browser/extensions_browser_client.h"
Expand All @@ -23,7 +23,7 @@ static void AssignStorage(ValueStore** dst, ValueStore* src) {

ValueStore* GetStorage(scoped_refptr<const Extension> extension,
settings_namespace::Namespace settings_namespace,
SettingsFrontend* frontend) {
StorageFrontend* frontend) {
ValueStore* storage = NULL;
frontend->RunWithStorage(
extension, settings_namespace, base::Bind(&AssignStorage, &storage));
Expand All @@ -32,7 +32,7 @@ ValueStore* GetStorage(scoped_refptr<const Extension> extension,
}

ValueStore* GetStorage(scoped_refptr<const Extension> extension,
SettingsFrontend* frontend) {
StorageFrontend* frontend) {
return GetStorage(extension, settings_namespace::SYNC, frontend);
}

Expand Down
6 changes: 3 additions & 3 deletions extensions/browser/api/storage/settings_test_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ class ValueStore;

namespace extensions {

class SettingsFrontend;
class StorageFrontend;
// Utilities for extension settings API tests.
namespace settings_test_util {

// Synchronously gets the storage area for an extension from |frontend|.
ValueStore* GetStorage(scoped_refptr<const Extension> extension,
settings_namespace::Namespace setting_namespace,
SettingsFrontend* frontend);
StorageFrontend* frontend);

// Synchronously gets the SYNC storage for an extension from |frontend|.
ValueStore* GetStorage(scoped_refptr<const Extension> extension,
SettingsFrontend* frontend);
StorageFrontend* frontend);

// Creates an extension with |id| and adds it to the registry for |profile|.
scoped_refptr<const Extension> AddExtensionWithId(Profile* profile,
Expand Down
4 changes: 2 additions & 2 deletions extensions/browser/api/storage/storage_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/api/storage/settings_frontend.h"
#include "extensions/browser/api/storage/storage_frontend.h"
#include "extensions/browser/quota_service.h"
#include "extensions/common/api/storage.h"

Expand Down Expand Up @@ -47,7 +47,7 @@ bool SettingsFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(
settings_namespace_ != settings_namespace::INVALID);

SettingsFrontend* frontend = SettingsFrontend::Get(browser_context());
StorageFrontend* frontend = StorageFrontend::Get(browser_context());
if (!frontend->IsStorageEnabled(settings_namespace_)) {
error_ = base::StringPrintf(
"\"%s\" is not available in this instance of Chrome",
Expand Down
2 changes: 1 addition & 1 deletion extensions/browser/api/storage/storage_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class SettingsFunction : public UIThreadExtensionFunction {
virtual bool RunImpl() OVERRIDE;

// Extension settings function implementations should do their work here.
// The SettingsFrontend makes sure this is posted to the appropriate thread.
// The StorageFrontend makes sure this is posted to the appropriate thread.
// Implementations should fill in args themselves, though (like RunImpl)
// may return false to imply failure.
virtual bool RunWithStorage(ValueStore* storage) = 0;
Expand Down
18 changes: 9 additions & 9 deletions extensions/browser/api/storage/storage_api_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
#include "chrome/browser/extensions/extension_api_unittest.h"
#include "chrome/browser/extensions/test_extension_system.h"
#include "extensions/browser/api/storage/leveldb_settings_storage_factory.h"
#include "extensions/browser/api/storage/settings_frontend.h"
#include "extensions/browser/api/storage/settings_storage_quota_enforcer.h"
#include "extensions/browser/api/storage/settings_test_util.h"
#include "extensions/browser/api/storage/storage_api.h"
#include "extensions/browser/api/storage/storage_frontend.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_system.h"
Expand All @@ -29,10 +29,10 @@ namespace extensions {
namespace {

// Caller owns the returned object.
KeyedService* CreateSettingsFrontendForTesting(
KeyedService* CreateStorageFrontendForTesting(
content::BrowserContext* context) {
return SettingsFrontend::CreateForTesting(new LeveldbSettingsStorageFactory(),
context);
return StorageFrontend::CreateForTesting(new LeveldbSettingsStorageFactory(),
context);
}

} // namespace
Expand All @@ -43,7 +43,7 @@ class StorageApiUnittest : public ExtensionApiUnittest {
ExtensionApiUnittest::SetUp();
TestExtensionSystem* extension_system =
static_cast<TestExtensionSystem*>(ExtensionSystem::Get(profile()));
// SettingsFrontend requires an EventRouter.
// StorageFrontend requires an EventRouter.
extension_system->SetEventRouter(scoped_ptr<EventRouter>(
new EventRouter(profile(), ExtensionPrefs::Get(profile()))));
}
Expand Down Expand Up @@ -76,10 +76,10 @@ class StorageApiUnittest : public ExtensionApiUnittest {
};

TEST_F(StorageApiUnittest, RestoreCorruptedStorage) {
// Ensure a SettingsFrontend can be created on demand. The SettingsFrontend
// Ensure a StorageFrontend can be created on demand. The StorageFrontend
// will be owned by the KeyedService system.
SettingsFrontend::GetFactoryInstance()->SetTestingFactory(
profile(), &CreateSettingsFrontendForTesting);
StorageFrontend::GetFactoryInstance()->SetTestingFactory(
profile(), &CreateStorageFrontendForTesting);

const char kKey[] = "key";
const char kValue[] = "value";
Expand All @@ -96,7 +96,7 @@ TEST_F(StorageApiUnittest, RestoreCorruptedStorage) {
ValueStore* store =
settings_test_util::GetStorage(extension_ref(),
settings_namespace::LOCAL,
SettingsFrontend::Get(profile()));
StorageFrontend::Get(profile()));
ASSERT_TRUE(store);
SettingsStorageQuotaEnforcer* quota_store =
static_cast<SettingsStorageQuotaEnforcer*>(store);
Expand Down
Loading

0 comments on commit b7e33ee

Please sign in to comment.