| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "extensions/browser/api/storage/settings_test_util.h" | 5 #include "extensions/browser/api/storage/settings_test_util.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "extensions/browser/api/storage/storage_frontend.h" | 8 #include "extensions/browser/api/storage/storage_frontend.h" |
| 9 #include "extensions/browser/extension_registry.h" | 9 #include "extensions/browser/extension_registry.h" |
| 10 #include "extensions/browser/extension_system_provider.h" | 10 #include "extensions/browser/extension_system_provider.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 } | 35 } |
| 36 | 36 |
| 37 // Intended as a StorageCallback from GetStorage. | 37 // Intended as a StorageCallback from GetStorage. |
| 38 static void AssignStorage(ValueStore** dst, ValueStore* src) { | 38 static void AssignStorage(ValueStore** dst, ValueStore* src) { |
| 39 *dst = src; | 39 *dst = src; |
| 40 } | 40 } |
| 41 | 41 |
| 42 ValueStore* GetStorage(scoped_refptr<const Extension> extension, | 42 ValueStore* GetStorage(scoped_refptr<const Extension> extension, |
| 43 settings_namespace::Namespace settings_namespace, | 43 settings_namespace::Namespace settings_namespace, |
| 44 StorageFrontend* frontend) { | 44 StorageFrontend* frontend) { |
| 45 ValueStore* storage = NULL; | 45 ValueStore* storage = nullptr; |
| 46 frontend->RunWithStorage( | 46 frontend->RunWithStorage( |
| 47 extension, settings_namespace, base::Bind(&AssignStorage, &storage)); | 47 extension, settings_namespace, base::Bind(&AssignStorage, &storage)); |
| 48 base::MessageLoop::current()->RunUntilIdle(); | 48 base::MessageLoop::current()->RunUntilIdle(); |
| 49 return storage; | 49 return storage; |
| 50 } | 50 } |
| 51 | 51 |
| 52 ValueStore* GetStorage(scoped_refptr<const Extension> extension, | 52 ValueStore* GetStorage(scoped_refptr<const Extension> extension, |
| 53 StorageFrontend* frontend) { | 53 StorageFrontend* frontend) { |
| 54 return GetStorage(extension, settings_namespace::SYNC, frontend); | 54 return GetStorage(extension, settings_namespace::SYNC, frontend); |
| 55 } | 55 } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 MockExtensionSystemWithEventRouter::~MockExtensionSystemWithEventRouter() { | 128 MockExtensionSystemWithEventRouter::~MockExtensionSystemWithEventRouter() { |
| 129 } | 129 } |
| 130 | 130 |
| 131 KeyedService* MockExtensionSystemWithEventRouter::Build( | 131 KeyedService* MockExtensionSystemWithEventRouter::Build( |
| 132 content::BrowserContext* context) { | 132 content::BrowserContext* context) { |
| 133 return new MockExtensionSystemWithEventRouter(context); | 133 return new MockExtensionSystemWithEventRouter(context); |
| 134 } | 134 } |
| 135 | 135 |
| 136 EventRouter* MockExtensionSystemWithEventRouter::event_router() { | 136 EventRouter* MockExtensionSystemWithEventRouter::event_router() { |
| 137 if (!event_router_.get()) | 137 if (!event_router_.get()) |
| 138 event_router_.reset(new EventRouter(browser_context(), NULL)); | 138 event_router_.reset(new EventRouter(browser_context(), nullptr)); |
| 139 return event_router_.get(); | 139 return event_router_.get(); |
| 140 } | 140 } |
| 141 | 141 |
| 142 // ScopedSettingsFactory | 142 // ScopedSettingsFactory |
| 143 | 143 |
| 144 ScopedSettingsStorageFactory::ScopedSettingsStorageFactory() {} | 144 ScopedSettingsStorageFactory::ScopedSettingsStorageFactory() {} |
| 145 | 145 |
| 146 ScopedSettingsStorageFactory::ScopedSettingsStorageFactory( | 146 ScopedSettingsStorageFactory::ScopedSettingsStorageFactory( |
| 147 const scoped_refptr<SettingsStorageFactory>& delegate) | 147 const scoped_refptr<SettingsStorageFactory>& delegate) |
| 148 : delegate_(delegate) {} | 148 : delegate_(delegate) {} |
| (...skipping 14 matching lines...) Expand all Loading... |
| 163 | 163 |
| 164 void ScopedSettingsStorageFactory::DeleteDatabaseIfExists( | 164 void ScopedSettingsStorageFactory::DeleteDatabaseIfExists( |
| 165 const base::FilePath& base_path, | 165 const base::FilePath& base_path, |
| 166 const std::string& extension_id) { | 166 const std::string& extension_id) { |
| 167 delegate_->DeleteDatabaseIfExists(base_path, extension_id); | 167 delegate_->DeleteDatabaseIfExists(base_path, extension_id); |
| 168 } | 168 } |
| 169 | 169 |
| 170 } // namespace settings_test_util | 170 } // namespace settings_test_util |
| 171 | 171 |
| 172 } // namespace extensions | 172 } // namespace extensions |
| OLD | NEW |