| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/environment.h" | 8 #include "base/environment.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 #include "chrome/browser/instant/instant_controller.h" | 50 #include "chrome/browser/instant/instant_controller.h" |
| 51 #include "chrome/browser/net/chrome_url_request_context.h" | 51 #include "chrome/browser/net/chrome_url_request_context.h" |
| 52 #include "chrome/browser/net/gaia/token_service.h" | 52 #include "chrome/browser/net/gaia/token_service.h" |
| 53 #include "chrome/browser/net/net_pref_observer.h" | 53 #include "chrome/browser/net/net_pref_observer.h" |
| 54 #include "chrome/browser/net/pref_proxy_config_service.h" | 54 #include "chrome/browser/net/pref_proxy_config_service.h" |
| 55 #include "chrome/browser/net/ssl_config_service_manager.h" | 55 #include "chrome/browser/net/ssl_config_service_manager.h" |
| 56 #include "chrome/browser/notifications/desktop_notification_service.h" | 56 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 57 #include "chrome/browser/password_manager/password_store_default.h" | 57 #include "chrome/browser/password_manager/password_store_default.h" |
| 58 #include "chrome/browser/policy/configuration_policy_pref_store.h" | 58 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
| 59 #include "chrome/browser/policy/configuration_policy_provider.h" | 59 #include "chrome/browser/policy/configuration_policy_provider.h" |
| 60 #include "chrome/browser/policy/profile_policy_context.h" | 60 #include "chrome/browser/policy/profile_policy_connector.h" |
| 61 #include "chrome/browser/prefs/browser_prefs.h" | 61 #include "chrome/browser/prefs/browser_prefs.h" |
| 62 #include "chrome/browser/prefs/pref_value_store.h" | 62 #include "chrome/browser/prefs/pref_value_store.h" |
| 63 #include "chrome/browser/prerender/prerender_manager.h" | 63 #include "chrome/browser/prerender/prerender_manager.h" |
| 64 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 64 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
| 65 #include "chrome/browser/profiles/profile_manager.h" | 65 #include "chrome/browser/profiles/profile_manager.h" |
| 66 #include "chrome/browser/renderer_host/render_process_host.h" | 66 #include "chrome/browser/renderer_host/render_process_host.h" |
| 67 #include "chrome/browser/search_engines/template_url_fetcher.h" | 67 #include "chrome/browser/search_engines/template_url_fetcher.h" |
| 68 #include "chrome/browser/search_engines/template_url_model.h" | 68 #include "chrome/browser/search_engines/template_url_model.h" |
| 69 #include "chrome/browser/sessions/session_service.h" | 69 #include "chrome/browser/sessions/session_service.h" |
| 70 #include "chrome/browser/sessions/tab_restore_service.h" | 70 #include "chrome/browser/sessions/tab_restore_service.h" |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 background_mode_manager_.reset(new BackgroundModeManager(this, | 328 background_mode_manager_.reset(new BackgroundModeManager(this, |
| 329 CommandLine::ForCurrentProcess())); | 329 CommandLine::ForCurrentProcess())); |
| 330 #endif | 330 #endif |
| 331 | 331 |
| 332 background_contents_service_.reset( | 332 background_contents_service_.reset( |
| 333 new BackgroundContentsService(this, CommandLine::ForCurrentProcess())); | 333 new BackgroundContentsService(this, CommandLine::ForCurrentProcess())); |
| 334 | 334 |
| 335 extension_io_event_router_ = new ExtensionIOEventRouter(this); | 335 extension_io_event_router_ = new ExtensionIOEventRouter(this); |
| 336 extension_info_map_ = new ExtensionInfoMap(); | 336 extension_info_map_ = new ExtensionInfoMap(); |
| 337 | 337 |
| 338 GetPolicyContext()->Initialize(); | 338 GetPolicyConnector()->Initialize(); |
| 339 | 339 |
| 340 clear_local_state_on_exit_ = prefs->GetBoolean(prefs::kClearSiteDataOnExit); | 340 clear_local_state_on_exit_ = prefs->GetBoolean(prefs::kClearSiteDataOnExit); |
| 341 | 341 |
| 342 // Log the profile size after a reasonable startup delay. | 342 // Log the profile size after a reasonable startup delay. |
| 343 BrowserThread::PostDelayedTask(BrowserThread::FILE, FROM_HERE, | 343 BrowserThread::PostDelayedTask(BrowserThread::FILE, FROM_HERE, |
| 344 new ProfileSizeTask(path_), 112000); | 344 new ProfileSizeTask(path_), 112000); |
| 345 | 345 |
| 346 InstantController::RecordMetrics(this); | 346 InstantController::RecordMetrics(this); |
| 347 } | 347 } |
| 348 | 348 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 void ProfileImpl::set_last_selected_directory(const FilePath& path) { | 501 void ProfileImpl::set_last_selected_directory(const FilePath& path) { |
| 502 GetPrefs()->SetFilePath(prefs::kSelectFileLastDirectory, path); | 502 GetPrefs()->SetFilePath(prefs::kSelectFileLastDirectory, path); |
| 503 } | 503 } |
| 504 | 504 |
| 505 ProfileImpl::~ProfileImpl() { | 505 ProfileImpl::~ProfileImpl() { |
| 506 NotificationService::current()->Notify( | 506 NotificationService::current()->Notify( |
| 507 NotificationType::PROFILE_DESTROYED, | 507 NotificationType::PROFILE_DESTROYED, |
| 508 Source<Profile>(this), | 508 Source<Profile>(this), |
| 509 NotificationService::NoDetails()); | 509 NotificationService::NoDetails()); |
| 510 | 510 |
| 511 GetPolicyContext()->Shutdown(); | 511 GetPolicyConnector()->Shutdown(); |
| 512 | 512 |
| 513 tab_restore_service_ = NULL; | 513 tab_restore_service_ = NULL; |
| 514 | 514 |
| 515 StopCreateSessionServiceTimer(); | 515 StopCreateSessionServiceTimer(); |
| 516 // TemplateURLModel schedules a task on the WebDataService from its | 516 // TemplateURLModel schedules a task on the WebDataService from its |
| 517 // destructor. Delete it first to ensure the task gets scheduled before we | 517 // destructor. Delete it first to ensure the task gets scheduled before we |
| 518 // shut down the database. | 518 // shut down the database. |
| 519 template_url_model_.reset(); | 519 template_url_model_.reset(); |
| 520 | 520 |
| 521 // DownloadManager is lazily created, so check before accessing it. | 521 // DownloadManager is lazily created, so check before accessing it. |
| (...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1358 NewRunnableMethod(blob_storage_context_.get(), | 1358 NewRunnableMethod(blob_storage_context_.get(), |
| 1359 &ChromeBlobStorageContext::InitializeOnIOThread)); | 1359 &ChromeBlobStorageContext::InitializeOnIOThread)); |
| 1360 } | 1360 } |
| 1361 return blob_storage_context_; | 1361 return blob_storage_context_; |
| 1362 } | 1362 } |
| 1363 | 1363 |
| 1364 ExtensionInfoMap* ProfileImpl::GetExtensionInfoMap() { | 1364 ExtensionInfoMap* ProfileImpl::GetExtensionInfoMap() { |
| 1365 return extension_info_map_.get(); | 1365 return extension_info_map_.get(); |
| 1366 } | 1366 } |
| 1367 | 1367 |
| 1368 policy::ProfilePolicyContext* ProfileImpl::GetPolicyContext() { | 1368 policy::ProfilePolicyConnector* ProfileImpl::GetPolicyConnector() { |
| 1369 if (!profile_policy_context_.get()) | 1369 if (!profile_policy_connector_.get()) |
| 1370 profile_policy_context_.reset(new policy::ProfilePolicyContext(this)); | 1370 profile_policy_connector_.reset(new policy::ProfilePolicyConnector(this)); |
| 1371 | 1371 |
| 1372 return profile_policy_context_.get(); | 1372 return profile_policy_connector_.get(); |
| 1373 } | 1373 } |
| 1374 | 1374 |
| 1375 PromoCounter* ProfileImpl::GetInstantPromoCounter() { | 1375 PromoCounter* ProfileImpl::GetInstantPromoCounter() { |
| 1376 #if defined(OS_WIN) | 1376 #if defined(OS_WIN) |
| 1377 // TODO: enable this when we're ready to turn on the promo. | 1377 // TODO: enable this when we're ready to turn on the promo. |
| 1378 /* | 1378 /* |
| 1379 if (!checked_instant_promo_) { | 1379 if (!checked_instant_promo_) { |
| 1380 checked_instant_promo_ = true; | 1380 checked_instant_promo_ = true; |
| 1381 PrefService* prefs = GetPrefs(); | 1381 PrefService* prefs = GetPrefs(); |
| 1382 if (!prefs->GetBoolean(prefs::kInstantEnabledOnce) && | 1382 if (!prefs->GetBoolean(prefs::kInstantEnabledOnce) && |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1493 } | 1493 } |
| 1494 | 1494 |
| 1495 PrerenderManager* ProfileImpl::GetPrerenderManager() { | 1495 PrerenderManager* ProfileImpl::GetPrerenderManager() { |
| 1496 CommandLine* cl = CommandLine::ForCurrentProcess(); | 1496 CommandLine* cl = CommandLine::ForCurrentProcess(); |
| 1497 if (!cl->HasSwitch(switches::kEnablePagePrerender)) | 1497 if (!cl->HasSwitch(switches::kEnablePagePrerender)) |
| 1498 return NULL; | 1498 return NULL; |
| 1499 if (!prerender_manager_) | 1499 if (!prerender_manager_) |
| 1500 prerender_manager_ = new PrerenderManager(this); | 1500 prerender_manager_ = new PrerenderManager(this); |
| 1501 return prerender_manager_; | 1501 return prerender_manager_; |
| 1502 } | 1502 } |
| OLD | NEW |