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/profiles/profile_impl.h" | 5 #include "chrome/browser/profiles/profile_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/environment.h" | 10 #include "base/environment.h" |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 Delegate* delegate, | 258 Delegate* delegate, |
259 CreateMode create_mode) | 259 CreateMode create_mode) |
260 : path_(path), | 260 : path_(path), |
261 ALLOW_THIS_IN_INITIALIZER_LIST(visited_link_event_listener_( | 261 ALLOW_THIS_IN_INITIALIZER_LIST(visited_link_event_listener_( |
262 new VisitedLinkEventListener(this))), | 262 new VisitedLinkEventListener(this))), |
263 ALLOW_THIS_IN_INITIALIZER_LIST(io_data_(this)), | 263 ALLOW_THIS_IN_INITIALIZER_LIST(io_data_(this)), |
264 host_content_settings_map_(NULL), | 264 host_content_settings_map_(NULL), |
265 favicon_service_created_(false), | 265 favicon_service_created_(false), |
266 start_time_(Time::Now()), | 266 start_time_(Time::Now()), |
267 delegate_(delegate), | 267 delegate_(delegate), |
268 predictor_(NULL), | 268 predictor_(NULL) { |
269 session_restore_enabled_(false) { | |
270 DCHECK(!path.empty()) << "Using an empty path will attempt to write " << | 269 DCHECK(!path.empty()) << "Using an empty path will attempt to write " << |
271 "profile files to the root directory!"; | 270 "profile files to the root directory!"; |
272 | 271 |
273 #if defined(ENABLE_SESSION_SERVICE) | 272 #if defined(ENABLE_SESSION_SERVICE) |
274 create_session_service_timer_.Start(FROM_HERE, | 273 create_session_service_timer_.Start(FROM_HERE, |
275 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this, | 274 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this, |
276 &ProfileImpl::EnsureSessionServiceCreated); | 275 &ProfileImpl::EnsureSessionServiceCreated); |
277 #endif | 276 #endif |
278 | 277 |
279 // Determine if prefetch is enabled for this profile. | 278 // Determine if prefetch is enabled for this profile. |
280 // If not profile_manager is present, it means we are in a unittest. | 279 // If not profile_manager is present, it means we are in a unittest. |
281 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 280 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
282 predictor_ = chrome_browser_net::Predictor::CreatePredictor( | 281 predictor_ = chrome_browser_net::Predictor::CreatePredictor( |
283 !command_line->HasSwitch(switches::kDisablePreconnect), | 282 !command_line->HasSwitch(switches::kDisablePreconnect), |
284 g_browser_process->profile_manager() == NULL); | 283 g_browser_process->profile_manager() == NULL); |
285 | 284 |
286 session_restore_enabled_ = | |
287 !command_line->HasSwitch(switches::kDisableRestoreSessionState); | |
288 #if defined(ENABLE_CONFIGURATION_POLICY) | 285 #if defined(ENABLE_CONFIGURATION_POLICY) |
289 policy_service_.reset( | 286 policy_service_.reset( |
290 g_browser_process->browser_policy_connector()->CreatePolicyService(this)); | 287 g_browser_process->browser_policy_connector()->CreatePolicyService(this)); |
291 #else | 288 #else |
292 policy_service_.reset(new policy::PolicyServiceStub()); | 289 policy_service_.reset(new policy::PolicyServiceStub()); |
293 #endif | 290 #endif |
294 if (create_mode == CREATE_MODE_ASYNCHRONOUS) { | 291 if (create_mode == CREATE_MODE_ASYNCHRONOUS) { |
295 prefs_.reset(PrefService::CreatePrefService( | 292 prefs_.reset(PrefService::CreatePrefService( |
296 GetPrefFilePath(), | 293 GetPrefFilePath(), |
297 policy_service_.get(), | 294 policy_service_.get(), |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 | 392 |
396 #if defined(OS_ANDROID) | 393 #if defined(OS_ANDROID) |
397 SessionStartupPref::Type startup_pref_type = | 394 SessionStartupPref::Type startup_pref_type = |
398 SessionStartupPref::GetDefaultStartupType(); | 395 SessionStartupPref::GetDefaultStartupType(); |
399 #else | 396 #else |
400 SessionStartupPref::Type startup_pref_type = | 397 SessionStartupPref::Type startup_pref_type = |
401 StartupBrowserCreator::GetSessionStartupPref( | 398 StartupBrowserCreator::GetSessionStartupPref( |
402 *CommandLine::ForCurrentProcess(), this).type; | 399 *CommandLine::ForCurrentProcess(), this).type; |
403 #endif | 400 #endif |
404 bool restore_old_session_cookies = | 401 bool restore_old_session_cookies = |
405 session_restore_enabled_ && | |
406 (!DidLastSessionExitCleanly() || | 402 (!DidLastSessionExitCleanly() || |
407 startup_pref_type == SessionStartupPref::LAST); | 403 startup_pref_type == SessionStartupPref::LAST); |
408 | 404 |
409 InitHostZoomMap(); | 405 InitHostZoomMap(); |
410 | 406 |
411 // Make sure we initialize the ProfileIOData after everything else has been | 407 // Make sure we initialize the ProfileIOData after everything else has been |
412 // initialized that we might be reading from the IO thread. | 408 // initialized that we might be reading from the IO thread. |
413 | 409 |
414 io_data_.Init(cookie_path, server_bound_cert_path, cache_path, | 410 io_data_.Init(cookie_path, server_bound_cert_path, cache_path, |
415 cache_max_size, media_cache_path, media_cache_max_size, | 411 cache_max_size, media_cache_path, media_cache_max_size, |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 if (!path.empty()) | 1087 if (!path.empty()) |
1092 *cache_path = path; | 1088 *cache_path = path; |
1093 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : | 1089 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : |
1094 prefs_->GetInteger(prefs::kDiskCacheSize); | 1090 prefs_->GetInteger(prefs::kDiskCacheSize); |
1095 } | 1091 } |
1096 | 1092 |
1097 base::Callback<ChromeURLDataManagerBackend*(void)> | 1093 base::Callback<ChromeURLDataManagerBackend*(void)> |
1098 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { | 1094 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { |
1099 return io_data_.GetChromeURLDataManagerBackendGetter(); | 1095 return io_data_.GetChromeURLDataManagerBackendGetter(); |
1100 } | 1096 } |
OLD | NEW |