OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/profiles/profile_impl.h" | 5 #include "chrome/browser/profiles/profile_impl.h" |
6 | 6 |
7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/environment.h" | 9 #include "base/environment.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1241 | 1241 |
1242 TokenService* ProfileImpl::GetTokenService() { | 1242 TokenService* ProfileImpl::GetTokenService() { |
1243 if (!token_service_.get()) { | 1243 if (!token_service_.get()) { |
1244 token_service_.reset(new TokenService()); | 1244 token_service_.reset(new TokenService()); |
1245 } | 1245 } |
1246 return token_service_.get(); | 1246 return token_service_.get(); |
1247 } | 1247 } |
1248 | 1248 |
1249 ProfileSyncService* ProfileImpl::GetProfileSyncService() { | 1249 ProfileSyncService* ProfileImpl::GetProfileSyncService() { |
1250 #if defined(OS_CHROMEOS) | 1250 #if defined(OS_CHROMEOS) |
1251 // If kLoginManager is specified, we shouldn't call this unless login has | 1251 if (!sync_service_.get()) { |
1252 // completed and specified cros_user. Guard with if (HasProfileSyncService()) | 1252 // In ChromeOS, we only want to initialize sync services explicitly from |
1253 // where this might legitimately get called before login has completed. | 1253 // the login code. Use HasProfileSyncService() to guard against this. |
akalin
2011/01/13 22:03:49
Mention that we may be called on chromeos without
stevenjb
2011/01/13 22:46:58
Done.
| |
1254 if (!sync_service_.get() && | 1254 return NULL; |
1255 CommandLine::ForCurrentProcess()->HasSwitch(switches::kLoginManager)) { | |
1256 LOG(FATAL) << "GetProfileSyncService() called before login complete."; | |
1257 } | 1255 } |
1258 #endif | 1256 #endif |
1259 return GetProfileSyncService(""); | 1257 return GetProfileSyncService(""); |
1260 } | 1258 } |
1261 | 1259 |
1262 ProfileSyncService* ProfileImpl::GetProfileSyncService( | 1260 ProfileSyncService* ProfileImpl::GetProfileSyncService( |
1263 const std::string& cros_user) { | 1261 const std::string& cros_user) { |
1264 | 1262 |
1265 if (!ProfileSyncService::IsSyncEnabled()) | 1263 if (!ProfileSyncService::IsSyncEnabled()) |
1266 return NULL; | 1264 return NULL; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1364 } | 1362 } |
1365 | 1363 |
1366 PrerenderManager* ProfileImpl::GetPrerenderManager() { | 1364 PrerenderManager* ProfileImpl::GetPrerenderManager() { |
1367 CommandLine* cl = CommandLine::ForCurrentProcess(); | 1365 CommandLine* cl = CommandLine::ForCurrentProcess(); |
1368 if (!cl->HasSwitch(switches::kEnablePagePrerender)) | 1366 if (!cl->HasSwitch(switches::kEnablePagePrerender)) |
1369 return NULL; | 1367 return NULL; |
1370 if (!prerender_manager_) | 1368 if (!prerender_manager_) |
1371 prerender_manager_ = new PrerenderManager(this); | 1369 prerender_manager_ = new PrerenderManager(this); |
1372 return prerender_manager_; | 1370 return prerender_manager_; |
1373 } | 1371 } |
OLD | NEW |