| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/prerender/prerender_manager_factory.h" | 5 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 6 | 6 |
| 7 #include "base/sys_info.h" | |
| 8 #include "base/trace_event/trace_event.h" | 7 #include "base/trace_event/trace_event.h" |
| 9 #include "chrome/browser/history/history_service_factory.h" | 8 #include "chrome/browser/history/history_service_factory.h" |
| 10 #include "chrome/browser/predictors/predictor_database_factory.h" | 9 #include "chrome/browser/predictors/predictor_database_factory.h" |
| 11 #include "chrome/browser/prerender/prerender_manager.h" | 10 #include "chrome/browser/prerender/prerender_manager.h" |
| 12 #include "chrome/browser/profiles/incognito_helpers.h" | 11 #include "chrome/browser/profiles/incognito_helpers.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/sync/profile_sync_service_factory.h" | 13 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 15 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 14 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 16 | 15 |
| 17 #if defined(ENABLE_EXTENSIONS) | 16 #if defined(ENABLE_EXTENSIONS) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 48 DependsOn(HistoryServiceFactory::GetInstance()); | 47 DependsOn(HistoryServiceFactory::GetInstance()); |
| 49 DependsOn(predictors::PredictorDatabaseFactory::GetInstance()); | 48 DependsOn(predictors::PredictorDatabaseFactory::GetInstance()); |
| 50 DependsOn(ProfileSyncServiceFactory::GetInstance()); | 49 DependsOn(ProfileSyncServiceFactory::GetInstance()); |
| 51 } | 50 } |
| 52 | 51 |
| 53 PrerenderManagerFactory::~PrerenderManagerFactory() { | 52 PrerenderManagerFactory::~PrerenderManagerFactory() { |
| 54 } | 53 } |
| 55 | 54 |
| 56 KeyedService* PrerenderManagerFactory::BuildServiceInstanceFor( | 55 KeyedService* PrerenderManagerFactory::BuildServiceInstanceFor( |
| 57 content::BrowserContext* browser_context) const { | 56 content::BrowserContext* browser_context) const { |
| 58 Profile* profile = Profile::FromBrowserContext(browser_context); | 57 return new PrerenderManager(Profile::FromBrowserContext(browser_context)); |
| 59 if (base::SysInfo::IsLowEndDevice()) | |
| 60 return NULL; | |
| 61 | |
| 62 return new PrerenderManager(profile); | |
| 63 } | 58 } |
| 64 | 59 |
| 65 content::BrowserContext* PrerenderManagerFactory::GetBrowserContextToUse( | 60 content::BrowserContext* PrerenderManagerFactory::GetBrowserContextToUse( |
| 66 content::BrowserContext* context) const { | 61 content::BrowserContext* context) const { |
| 67 return chrome::GetBrowserContextOwnInstanceInIncognito(context); | 62 return chrome::GetBrowserContextOwnInstanceInIncognito(context); |
| 68 } | 63 } |
| 69 | 64 |
| 70 } // namespace prerender | 65 } // namespace prerender |
| OLD | NEW |