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 #if defined(OS_ANDROID) | |
8 #include "base/android/sys_utils.h" | |
9 #endif | |
10 | 7 |
11 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/sys_utils.h" |
12 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/extensions/extension_system_factory.h" | 11 #include "chrome/browser/extensions/extension_system_factory.h" |
14 #include "chrome/browser/history/history_service_factory.h" | 12 #include "chrome/browser/history/history_service_factory.h" |
15 #include "chrome/browser/predictors/predictor_database_factory.h" | 13 #include "chrome/browser/predictors/predictor_database_factory.h" |
16 #include "chrome/browser/prerender/prerender_manager.h" | 14 #include "chrome/browser/prerender/prerender_manager.h" |
17 #include "chrome/browser/profiles/incognito_helpers.h" | 15 #include "chrome/browser/profiles/incognito_helpers.h" |
18 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/sync/profile_sync_service_factory.h" | 17 #include "chrome/browser/sync/profile_sync_service_factory.h" |
20 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 18 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
21 | 19 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 DependsOn(ProfileSyncServiceFactory::GetInstance()); | 54 DependsOn(ProfileSyncServiceFactory::GetInstance()); |
57 } | 55 } |
58 | 56 |
59 PrerenderManagerFactory::~PrerenderManagerFactory() { | 57 PrerenderManagerFactory::~PrerenderManagerFactory() { |
60 } | 58 } |
61 | 59 |
62 BrowserContextKeyedService* PrerenderManagerFactory::BuildServiceInstanceFor( | 60 BrowserContextKeyedService* PrerenderManagerFactory::BuildServiceInstanceFor( |
63 content::BrowserContext* browser_context) const { | 61 content::BrowserContext* browser_context) const { |
64 Profile* profile = Profile::FromBrowserContext(browser_context); | 62 Profile* profile = Profile::FromBrowserContext(browser_context); |
65 CHECK(g_browser_process->prerender_tracker()); | 63 CHECK(g_browser_process->prerender_tracker()); |
66 #if defined(OS_ANDROID) | 64 if (base::SysUtils::IsLowEndDevice()) |
67 if (base::android::SysUtils::IsLowEndDevice()) | |
68 return NULL; | 65 return NULL; |
69 #endif | |
70 | 66 |
71 PrerenderManager* prerender_manager = new PrerenderManager( | 67 PrerenderManager* prerender_manager = new PrerenderManager( |
72 profile, g_browser_process->prerender_tracker()); | 68 profile, g_browser_process->prerender_tracker()); |
73 #if defined(OS_CHROMEOS) | 69 #if defined(OS_CHROMEOS) |
74 if (chromeos::NetworkHandler::IsInitialized()) | 70 if (chromeos::NetworkHandler::IsInitialized()) |
75 prerender_manager->AddCondition(new chromeos::PrerenderConditionNetwork); | 71 prerender_manager->AddCondition(new chromeos::PrerenderConditionNetwork); |
76 #endif | 72 #endif |
77 #if defined(OS_ANDROID) | 73 #if defined(OS_ANDROID) |
78 prerender_manager->AddCondition(new android::PrerenderConditionPlatform( | 74 prerender_manager->AddCondition(new android::PrerenderConditionPlatform( |
79 browser_context)); | 75 browser_context)); |
80 #endif | 76 #endif |
81 return prerender_manager; | 77 return prerender_manager; |
82 } | 78 } |
83 | 79 |
84 content::BrowserContext* PrerenderManagerFactory::GetBrowserContextToUse( | 80 content::BrowserContext* PrerenderManagerFactory::GetBrowserContextToUse( |
85 content::BrowserContext* context) const { | 81 content::BrowserContext* context) const { |
86 return chrome::GetBrowserContextOwnInstanceInIncognito(context); | 82 return chrome::GetBrowserContextOwnInstanceInIncognito(context); |
87 } | 83 } |
88 | 84 |
89 } // namespace prerender | 85 } // namespace prerender |
OLD | NEW |