Index: chrome/test/base/testing_profile.cc |
diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc |
index ad46abcb4cc3512f48d02cd7a9057e5045ba9d8c..0497fbd5fbdcac93f58e04c5433e75b1bd3f2a32 100644 |
--- a/chrome/test/base/testing_profile.cc |
+++ b/chrome/test/base/testing_profile.cc |
@@ -101,6 +101,7 @@ |
#include "chrome/browser/extensions/test_extension_system.h" |
#include "components/guest_view/browser/guest_view_manager.h" |
#include "extensions/browser/event_router_factory.h" |
+#include "extensions/browser/extension_prefs.h" |
#include "extensions/browser/extension_prefs_factory.h" |
#include "extensions/browser/extension_system.h" |
#endif |
@@ -179,65 +180,68 @@ class TestExtensionURLRequestContextGetter |
}; |
#if defined(ENABLE_NOTIFICATIONS) |
-KeyedService* CreateTestDesktopNotificationService( |
+scoped_ptr<KeyedService> CreateTestDesktopNotificationService( |
content::BrowserContext* profile) { |
- return new DesktopNotificationService(static_cast<Profile*>(profile)); |
+ return make_scoped_ptr( |
+ new DesktopNotificationService(static_cast<Profile*>(profile))); |
} |
#endif |
-KeyedService* BuildFaviconService(content::BrowserContext* context) { |
+scoped_ptr<KeyedService> BuildFaviconService(content::BrowserContext* context) { |
Profile* profile = Profile::FromBrowserContext(context); |
- return new favicon::FaviconService( |
+ return make_scoped_ptr(new favicon::FaviconService( |
ChromeFaviconClientFactory::GetForProfile(profile), |
- HistoryServiceFactory::GetForProfile(profile, |
- ServiceAccessType::EXPLICIT_ACCESS)); |
+ HistoryServiceFactory::GetForProfile( |
+ profile, ServiceAccessType::EXPLICIT_ACCESS))); |
} |
-KeyedService* BuildHistoryService(content::BrowserContext* context) { |
+scoped_ptr<KeyedService> BuildHistoryService(content::BrowserContext* context) { |
Profile* profile = Profile::FromBrowserContext(context); |
- history::HistoryService* history_service = new history::HistoryService( |
+ return make_scoped_ptr(new history::HistoryService( |
ChromeHistoryClientFactory::GetForProfile(profile), |
scoped_ptr<history::VisitDelegate>( |
- new history::ContentVisitDelegate(profile))); |
- return history_service; |
+ new history::ContentVisitDelegate(profile)))); |
} |
-KeyedService* BuildInMemoryURLIndex(content::BrowserContext* context) { |
+scoped_ptr<KeyedService> BuildInMemoryURLIndex( |
+ content::BrowserContext* context) { |
Profile* profile = Profile::FromBrowserContext(context); |
- InMemoryURLIndex* in_memory_url_index = new InMemoryURLIndex( |
+ scoped_ptr<InMemoryURLIndex> in_memory_url_index(new InMemoryURLIndex( |
BookmarkModelFactory::GetForProfile(profile), |
HistoryServiceFactory::GetForProfile(profile, |
ServiceAccessType::IMPLICIT_ACCESS), |
profile->GetPath(), |
- profile->GetPrefs()->GetString(prefs::kAcceptLanguages)); |
+ profile->GetPrefs()->GetString(prefs::kAcceptLanguages))); |
in_memory_url_index->Init(); |
- return in_memory_url_index; |
+ return in_memory_url_index.Pass(); |
} |
-KeyedService* BuildBookmarkModel(content::BrowserContext* context) { |
+scoped_ptr<KeyedService> BuildBookmarkModel(content::BrowserContext* context) { |
Profile* profile = static_cast<Profile*>(context); |
ChromeBookmarkClient* bookmark_client = |
ChromeBookmarkClientFactory::GetForProfile(profile); |
- BookmarkModel* bookmark_model = new BookmarkModel(bookmark_client); |
- bookmark_client->Init(bookmark_model); |
+ scoped_ptr<BookmarkModel> bookmark_model(new BookmarkModel(bookmark_client)); |
+ bookmark_client->Init(bookmark_model.get()); |
bookmark_model->Load(profile->GetPrefs(), |
profile->GetPrefs()->GetString(prefs::kAcceptLanguages), |
profile->GetPath(), |
profile->GetIOTaskRunner(), |
content::BrowserThread::GetMessageLoopProxyForThread( |
content::BrowserThread::UI)); |
- return bookmark_model; |
+ return bookmark_model.Pass(); |
} |
-KeyedService* BuildChromeBookmarkClient( |
+scoped_ptr<KeyedService> BuildChromeBookmarkClient( |
content::BrowserContext* context) { |
- return new ChromeBookmarkClient(static_cast<Profile*>(context)); |
+ return make_scoped_ptr( |
+ new ChromeBookmarkClient(static_cast<Profile*>(context))); |
} |
-KeyedService* BuildChromeHistoryClient( |
+scoped_ptr<KeyedService> BuildChromeHistoryClient( |
content::BrowserContext* context) { |
Profile* profile = static_cast<Profile*>(context); |
- return new ChromeHistoryClient(BookmarkModelFactory::GetForProfile(profile)); |
+ return make_scoped_ptr( |
+ new ChromeHistoryClient(BookmarkModelFactory::GetForProfile(profile))); |
} |
void TestProfileErrorCallback(WebDataServiceWrapper::ErrorType error_type, |
@@ -245,14 +249,14 @@ void TestProfileErrorCallback(WebDataServiceWrapper::ErrorType error_type, |
NOTREACHED(); |
} |
-KeyedService* BuildWebDataService(content::BrowserContext* context) { |
+scoped_ptr<KeyedService> BuildWebDataService(content::BrowserContext* context) { |
const base::FilePath& context_path = context->GetPath(); |
- return new WebDataServiceWrapper( |
+ return make_scoped_ptr(new WebDataServiceWrapper( |
context_path, g_browser_process->GetApplicationLocale(), |
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), |
sync_start_util::GetFlareForSyncableService(context_path), |
- &TestProfileErrorCallback); |
+ &TestProfileErrorCallback)); |
} |
} // namespace |
@@ -452,11 +456,11 @@ void TestingProfile::Init() { |
extensions::TestExtensionSystem* test_extension_system = |
static_cast<extensions::TestExtensionSystem*>( |
extensions::ExtensionSystem::Get(this)); |
- extensions::ExtensionPrefs* extension_prefs = |
+ scoped_ptr<extensions::ExtensionPrefs> extension_prefs = |
test_extension_system->CreateExtensionPrefs( |
base::CommandLine::ForCurrentProcess(), extensions_path_); |
extensions::ExtensionPrefsFactory::GetInstance()->SetInstanceForTesting( |
- this, extension_prefs); |
+ this, extension_prefs.Pass()); |
extensions::EventRouterFactory::GetInstance()->SetTestingFactory(this, |
nullptr); |