OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/profile.h" | 5 #include "chrome/browser/profile.h" |
6 | 6 |
7 #include "app/theme_provider.h" | 7 #include "app/theme_provider.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.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 11 matching lines...) Expand all Loading... |
22 #include "chrome/browser/extensions/extensions_service.h" | 22 #include "chrome/browser/extensions/extensions_service.h" |
23 #include "chrome/browser/extensions/user_script_master.h" | 23 #include "chrome/browser/extensions/user_script_master.h" |
24 #include "chrome/browser/favicon_service.h" | 24 #include "chrome/browser/favicon_service.h" |
25 #include "chrome/browser/strict_transport_security_persister.h" | 25 #include "chrome/browser/strict_transport_security_persister.h" |
26 #include "chrome/browser/history/history.h" | 26 #include "chrome/browser/history/history.h" |
27 #include "chrome/browser/in_process_webkit/webkit_context.h" | 27 #include "chrome/browser/in_process_webkit/webkit_context.h" |
28 #include "chrome/browser/net/chrome_url_request_context.h" | 28 #include "chrome/browser/net/chrome_url_request_context.h" |
29 #include "chrome/browser/net/ssl_config_service_manager.h" | 29 #include "chrome/browser/net/ssl_config_service_manager.h" |
30 #include "chrome/browser/notifications/desktop_notification_service.h" | 30 #include "chrome/browser/notifications/desktop_notification_service.h" |
31 #include "chrome/browser/password_manager/password_store_default.h" | 31 #include "chrome/browser/password_manager/password_store_default.h" |
32 #include "chrome/browser/privacy_blacklist/blacklist.h" | 32 #include "chrome/browser/privacy_blacklist/blacklist_io.h" |
33 #include "chrome/browser/profile_manager.h" | 33 #include "chrome/browser/profile_manager.h" |
34 #include "chrome/browser/renderer_host/render_process_host.h" | 34 #include "chrome/browser/renderer_host/render_process_host.h" |
35 #include "chrome/browser/search_engines/template_url_fetcher.h" | 35 #include "chrome/browser/search_engines/template_url_fetcher.h" |
36 #include "chrome/browser/search_engines/template_url_model.h" | 36 #include "chrome/browser/search_engines/template_url_model.h" |
37 #include "chrome/browser/sessions/session_service.h" | 37 #include "chrome/browser/sessions/session_service.h" |
38 #include "chrome/browser/sessions/tab_restore_service.h" | 38 #include "chrome/browser/sessions/tab_restore_service.h" |
39 #include "chrome/browser/spellchecker.h" | 39 #include "chrome/browser/spellchecker.h" |
40 #include "chrome/browser/ssl/ssl_host_state.h" | 40 #include "chrome/browser/ssl/ssl_host_state.h" |
41 #include "chrome/browser/sync/profile_sync_service.h" | 41 #include "chrome/browser/sync/profile_sync_service.h" |
42 #include "chrome/browser/thumbnail_store.h" | 42 #include "chrome/browser/thumbnail_store.h" |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 | 587 |
588 if (CommandLine::ForCurrentProcess()-> | 588 if (CommandLine::ForCurrentProcess()-> |
589 HasSwitch(switches::kPrivacyBlacklist)) { | 589 HasSwitch(switches::kPrivacyBlacklist)) { |
590 std::wstring option = CommandLine::ForCurrentProcess()->GetSwitchValue( | 590 std::wstring option = CommandLine::ForCurrentProcess()->GetSwitchValue( |
591 switches::kPrivacyBlacklist); | 591 switches::kPrivacyBlacklist); |
592 #if defined(OS_POSIX) | 592 #if defined(OS_POSIX) |
593 FilePath path(WideToUTF8(option)); | 593 FilePath path(WideToUTF8(option)); |
594 #else | 594 #else |
595 FilePath path(option); | 595 FilePath path(option); |
596 #endif | 596 #endif |
597 blacklist_ = new Blacklist(path); | 597 blacklist_.reset(new Blacklist); |
| 598 // TODO(phajdan.jr): Handle errors when reading blacklist. |
| 599 BlacklistIO::ReadBinary(blacklist_.get(), path); |
598 } | 600 } |
599 | 601 |
600 #if defined(OS_MACOSX) | 602 #if defined(OS_MACOSX) |
601 // If the profile directory doesn't already have a cache directory and it | 603 // If the profile directory doesn't already have a cache directory and it |
602 // is under ~/Library/Application Support, use a suitable cache directory | 604 // is under ~/Library/Application Support, use a suitable cache directory |
603 // under ~/Library/Caches. For example, a profile directory of | 605 // under ~/Library/Caches. For example, a profile directory of |
604 // ~/Library/Application Support/Google/Chrome/MyProfileName that doesn't | 606 // ~/Library/Application Support/Google/Chrome/MyProfileName that doesn't |
605 // have a "Cache" or "MediaCache" subdirectory would use the cache directory | 607 // have a "Cache" or "MediaCache" subdirectory would use the cache directory |
606 // ~/Library/Caches/Google/Chrome/MyProfileName. | 608 // ~/Library/Caches/Google/Chrome/MyProfileName. |
607 // | 609 // |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 net::SetURLRequestContextForOCSP(NULL); | 752 net::SetURLRequestContextForOCSP(NULL); |
751 #endif | 753 #endif |
752 default_request_context_ = NULL; | 754 default_request_context_ = NULL; |
753 } | 755 } |
754 | 756 |
755 CleanupRequestContext(request_context_); | 757 CleanupRequestContext(request_context_); |
756 CleanupRequestContext(media_request_context_); | 758 CleanupRequestContext(media_request_context_); |
757 CleanupRequestContext(extensions_request_context_); | 759 CleanupRequestContext(extensions_request_context_); |
758 | 760 |
759 // When the request contexts are gone, the blacklist wont be needed anymore. | 761 // When the request contexts are gone, the blacklist wont be needed anymore. |
760 delete blacklist_; | 762 blacklist_.reset(); |
761 blacklist_ = 0; | |
762 | 763 |
763 // HistoryService may call into the BookmarkModel, as such we need to | 764 // HistoryService may call into the BookmarkModel, as such we need to |
764 // delete HistoryService before the BookmarkModel. The destructor for | 765 // delete HistoryService before the BookmarkModel. The destructor for |
765 // HistoryService will join with HistoryService's backend thread so that | 766 // HistoryService will join with HistoryService's backend thread so that |
766 // by the time the destructor has finished we're sure it will no longer call | 767 // by the time the destructor has finished we're sure it will no longer call |
767 // into the BookmarkModel. | 768 // into the BookmarkModel. |
768 history_service_ = NULL; | 769 history_service_ = NULL; |
769 bookmark_bar_model_.reset(); | 770 bookmark_bar_model_.reset(); |
770 | 771 |
771 // FaviconService depends on HistoryServce so make sure we delete | 772 // FaviconService depends on HistoryServce so make sure we delete |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 } | 964 } |
964 | 965 |
965 return extensions_request_context_; | 966 return extensions_request_context_; |
966 } | 967 } |
967 | 968 |
968 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { | 969 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { |
969 return ssl_config_service_manager_->Get(); | 970 return ssl_config_service_manager_->Get(); |
970 } | 971 } |
971 | 972 |
972 Blacklist* ProfileImpl::GetBlacklist() { | 973 Blacklist* ProfileImpl::GetBlacklist() { |
973 return blacklist_; | 974 return blacklist_.get(); |
974 } | 975 } |
975 | 976 |
976 HistoryService* ProfileImpl::GetHistoryService(ServiceAccessType sat) { | 977 HistoryService* ProfileImpl::GetHistoryService(ServiceAccessType sat) { |
977 if (!history_service_created_) { | 978 if (!history_service_created_) { |
978 history_service_created_ = true; | 979 history_service_created_ = true; |
979 scoped_refptr<HistoryService> history(new HistoryService(this)); | 980 scoped_refptr<HistoryService> history(new HistoryService(this)); |
980 if (!history->Init(GetPath(), GetBookmarkModel())) | 981 if (!history->Init(GetPath(), GetBookmarkModel())) |
981 return NULL; | 982 return NULL; |
982 history_service_.swap(history); | 983 history_service_.swap(history); |
983 | 984 |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1360 return sync_service_.get(); | 1361 return sync_service_.get(); |
1361 } | 1362 } |
1362 #endif | 1363 #endif |
1363 return NULL; | 1364 return NULL; |
1364 } | 1365 } |
1365 | 1366 |
1366 void ProfileImpl::InitSyncService() { | 1367 void ProfileImpl::InitSyncService() { |
1367 sync_service_.reset(new ProfileSyncService(this)); | 1368 sync_service_.reset(new ProfileSyncService(this)); |
1368 sync_service_->Initialize(); | 1369 sync_service_->Initialize(); |
1369 } | 1370 } |
OLD | NEW |