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/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/environment.h" | 9 #include "base/environment.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 #include "chrome/browser/instant/instant_controller.h" | 51 #include "chrome/browser/instant/instant_controller.h" |
52 #include "chrome/browser/net/chrome_url_request_context.h" | 52 #include "chrome/browser/net/chrome_url_request_context.h" |
53 #include "chrome/browser/net/gaia/token_service.h" | 53 #include "chrome/browser/net/gaia/token_service.h" |
54 #include "chrome/browser/net/net_pref_observer.h" | 54 #include "chrome/browser/net/net_pref_observer.h" |
55 #include "chrome/browser/net/pref_proxy_config_service.h" | 55 #include "chrome/browser/net/pref_proxy_config_service.h" |
56 #include "chrome/browser/net/ssl_config_service_manager.h" | 56 #include "chrome/browser/net/ssl_config_service_manager.h" |
57 #include "chrome/browser/notifications/desktop_notification_service.h" | 57 #include "chrome/browser/notifications/desktop_notification_service.h" |
58 #include "chrome/browser/password_manager/password_store_default.h" | 58 #include "chrome/browser/password_manager/password_store_default.h" |
59 #include "chrome/browser/policy/configuration_policy_pref_store.h" | 59 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
60 #include "chrome/browser/policy/configuration_policy_provider.h" | 60 #include "chrome/browser/policy/configuration_policy_provider.h" |
61 #include "chrome/browser/policy/profile_policy_context.h" | 61 #include "chrome/browser/policy/profile_policy_connector.h" |
62 #include "chrome/browser/prefs/browser_prefs.h" | 62 #include "chrome/browser/prefs/browser_prefs.h" |
63 #include "chrome/browser/prefs/pref_value_store.h" | 63 #include "chrome/browser/prefs/pref_value_store.h" |
64 #include "chrome/browser/prerender/prerender_manager.h" | 64 #include "chrome/browser/prerender/prerender_manager.h" |
65 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 65 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
66 #include "chrome/browser/profiles/profile_manager.h" | 66 #include "chrome/browser/profiles/profile_manager.h" |
67 #include "chrome/browser/renderer_host/render_process_host.h" | 67 #include "chrome/browser/renderer_host/render_process_host.h" |
68 #include "chrome/browser/search_engines/template_url_fetcher.h" | 68 #include "chrome/browser/search_engines/template_url_fetcher.h" |
69 #include "chrome/browser/search_engines/template_url_model.h" | 69 #include "chrome/browser/search_engines/template_url_model.h" |
70 #include "chrome/browser/sessions/session_service.h" | 70 #include "chrome/browser/sessions/session_service.h" |
71 #include "chrome/browser/sessions/tab_restore_service.h" | 71 #include "chrome/browser/sessions/tab_restore_service.h" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 | 335 |
336 FilePath extensions_cookie_path = GetPath(); | 336 FilePath extensions_cookie_path = GetPath(); |
337 extensions_cookie_path = | 337 extensions_cookie_path = |
338 extensions_cookie_path.Append(chrome::kExtensionsCookieFilename); | 338 extensions_cookie_path.Append(chrome::kExtensionsCookieFilename); |
339 | 339 |
340 // Make sure we initialize the ProfileIOData after everything else has been | 340 // Make sure we initialize the ProfileIOData after everything else has been |
341 // initialized that we might be reading from the IO thread. | 341 // initialized that we might be reading from the IO thread. |
342 io_data_.Init(cookie_path, cache_path, cache_max_size, | 342 io_data_.Init(cookie_path, cache_path, cache_max_size, |
343 media_cache_path, media_cache_max_size, extensions_cookie_path); | 343 media_cache_path, media_cache_max_size, extensions_cookie_path); |
344 | 344 |
345 // Initialize the ProfilePolicyContext after |io_data_| since it requires | 345 // Initialize the ProfilePolicyConnector after |io_data_| since it requires |
346 // the URLRequestContextGetter to be initialized. | 346 // the URLRequestContextGetter to be initialized. |
347 GetPolicyContext()->Initialize(); | 347 GetPolicyConnector()->Initialize(); |
348 } | 348 } |
349 | 349 |
350 void ProfileImpl::InitExtensions() { | 350 void ProfileImpl::InitExtensions() { |
351 if (user_script_master_ || extensions_service_) | 351 if (user_script_master_ || extensions_service_) |
352 return; // Already initialized. | 352 return; // Already initialized. |
353 | 353 |
354 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 354 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
355 if (command_line->HasSwitch( | 355 if (command_line->HasSwitch( |
356 switches::kEnableExtensionTimelineApi)) { | 356 switches::kEnableExtensionTimelineApi)) { |
357 extension_devtools_manager_ = new ExtensionDevToolsManager(this); | 357 extension_devtools_manager_ = new ExtensionDevToolsManager(this); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 void ProfileImpl::set_last_selected_directory(const FilePath& path) { | 502 void ProfileImpl::set_last_selected_directory(const FilePath& path) { |
503 GetPrefs()->SetFilePath(prefs::kSelectFileLastDirectory, path); | 503 GetPrefs()->SetFilePath(prefs::kSelectFileLastDirectory, path); |
504 } | 504 } |
505 | 505 |
506 ProfileImpl::~ProfileImpl() { | 506 ProfileImpl::~ProfileImpl() { |
507 NotificationService::current()->Notify( | 507 NotificationService::current()->Notify( |
508 NotificationType::PROFILE_DESTROYED, | 508 NotificationType::PROFILE_DESTROYED, |
509 Source<Profile>(this), | 509 Source<Profile>(this), |
510 NotificationService::NoDetails()); | 510 NotificationService::NoDetails()); |
511 | 511 |
512 GetPolicyContext()->Shutdown(); | 512 GetPolicyConnector()->Shutdown(); |
513 | 513 |
514 tab_restore_service_ = NULL; | 514 tab_restore_service_ = NULL; |
515 | 515 |
516 StopCreateSessionServiceTimer(); | 516 StopCreateSessionServiceTimer(); |
517 // TemplateURLModel schedules a task on the WebDataService from its | 517 // TemplateURLModel schedules a task on the WebDataService from its |
518 // destructor. Delete it first to ensure the task gets scheduled before we | 518 // destructor. Delete it first to ensure the task gets scheduled before we |
519 // shut down the database. | 519 // shut down the database. |
520 template_url_model_.reset(); | 520 template_url_model_.reset(); |
521 | 521 |
522 // DownloadManager is lazily created, so check before accessing it. | 522 // DownloadManager is lazily created, so check before accessing it. |
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1359 NewRunnableMethod(blob_storage_context_.get(), | 1359 NewRunnableMethod(blob_storage_context_.get(), |
1360 &ChromeBlobStorageContext::InitializeOnIOThread)); | 1360 &ChromeBlobStorageContext::InitializeOnIOThread)); |
1361 } | 1361 } |
1362 return blob_storage_context_; | 1362 return blob_storage_context_; |
1363 } | 1363 } |
1364 | 1364 |
1365 ExtensionInfoMap* ProfileImpl::GetExtensionInfoMap() { | 1365 ExtensionInfoMap* ProfileImpl::GetExtensionInfoMap() { |
1366 return extension_info_map_.get(); | 1366 return extension_info_map_.get(); |
1367 } | 1367 } |
1368 | 1368 |
1369 policy::ProfilePolicyContext* ProfileImpl::GetPolicyContext() { | 1369 policy::ProfilePolicyConnector* ProfileImpl::GetPolicyConnector() { |
1370 if (!profile_policy_context_.get()) | 1370 if (!profile_policy_connector_.get()) |
1371 profile_policy_context_.reset(new policy::ProfilePolicyContext(this)); | 1371 profile_policy_connector_.reset(new policy::ProfilePolicyConnector(this)); |
1372 | 1372 |
1373 return profile_policy_context_.get(); | 1373 return profile_policy_connector_.get(); |
1374 } | 1374 } |
1375 | 1375 |
1376 ChromeURLDataManager* ProfileImpl::GetChromeURLDataManager() { | 1376 ChromeURLDataManager* ProfileImpl::GetChromeURLDataManager() { |
1377 if (!chrome_url_data_manager_.get()) | 1377 if (!chrome_url_data_manager_.get()) |
1378 chrome_url_data_manager_.reset(new ChromeURLDataManager(this)); | 1378 chrome_url_data_manager_.reset(new ChromeURLDataManager(this)); |
1379 return chrome_url_data_manager_.get(); | 1379 return chrome_url_data_manager_.get(); |
1380 } | 1380 } |
1381 | 1381 |
1382 PromoCounter* ProfileImpl::GetInstantPromoCounter() { | 1382 PromoCounter* ProfileImpl::GetInstantPromoCounter() { |
1383 #if defined(OS_WIN) | 1383 #if defined(OS_WIN) |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1504 return pref_proxy_config_tracker_; | 1504 return pref_proxy_config_tracker_; |
1505 } | 1505 } |
1506 | 1506 |
1507 prerender::PrerenderManager* ProfileImpl::GetPrerenderManager() { | 1507 prerender::PrerenderManager* ProfileImpl::GetPrerenderManager() { |
1508 if (!prerender::PrerenderManager::IsPrerenderingEnabled()) | 1508 if (!prerender::PrerenderManager::IsPrerenderingEnabled()) |
1509 return NULL; | 1509 return NULL; |
1510 if (!prerender_manager_) | 1510 if (!prerender_manager_) |
1511 prerender_manager_ = new prerender::PrerenderManager(this); | 1511 prerender_manager_ = new prerender::PrerenderManager(this); |
1512 return prerender_manager_; | 1512 return prerender_manager_; |
1513 } | 1513 } |
OLD | NEW |