| 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, sync only gets initialized properly from login, when |
| 1253 // where this might legitimately get called before login has completed. | 1253 // kLoginManager is specified. If this gets called before login, or |
| 1254 if (!sync_service_.get() && | 1254 // during a debugging session without kLoginManager, this will return |
| 1255 CommandLine::ForCurrentProcess()->HasSwitch(switches::kLoginManager)) { | 1255 // NULL, so ensure that calls either handle a NULL result, or use |
| 1256 LOG(FATAL) << "GetProfileSyncService() called before login complete."; | 1256 // HasProfileSyncService() to guard against the call. |
| 1257 return NULL; |
| 1257 } | 1258 } |
| 1258 #endif | 1259 #endif |
| 1259 return GetProfileSyncService(""); | 1260 return GetProfileSyncService(""); |
| 1260 } | 1261 } |
| 1261 | 1262 |
| 1262 ProfileSyncService* ProfileImpl::GetProfileSyncService( | 1263 ProfileSyncService* ProfileImpl::GetProfileSyncService( |
| 1263 const std::string& cros_user) { | 1264 const std::string& cros_user) { |
| 1264 | 1265 |
| 1265 if (!ProfileSyncService::IsSyncEnabled()) | 1266 if (!ProfileSyncService::IsSyncEnabled()) |
| 1266 return NULL; | 1267 return NULL; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1364 } | 1365 } |
| 1365 | 1366 |
| 1366 PrerenderManager* ProfileImpl::GetPrerenderManager() { | 1367 PrerenderManager* ProfileImpl::GetPrerenderManager() { |
| 1367 CommandLine* cl = CommandLine::ForCurrentProcess(); | 1368 CommandLine* cl = CommandLine::ForCurrentProcess(); |
| 1368 if (!cl->HasSwitch(switches::kEnablePagePrerender)) | 1369 if (!cl->HasSwitch(switches::kEnablePagePrerender)) |
| 1369 return NULL; | 1370 return NULL; |
| 1370 if (!prerender_manager_) | 1371 if (!prerender_manager_) |
| 1371 prerender_manager_ = new PrerenderManager(this); | 1372 prerender_manager_ = new PrerenderManager(this); |
| 1372 return prerender_manager_; | 1373 return prerender_manager_; |
| 1373 } | 1374 } |
| OLD | NEW |