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/browser_process_impl.h" | 5 #include "chrome/browser/browser_process_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
928 print_preview_tab_controller_ = new printing::PrintPreviewTabController(); | 928 print_preview_tab_controller_ = new printing::PrintPreviewTabController(); |
929 } | 929 } |
930 | 930 |
931 void BrowserProcessImpl::CreateBackgroundPrintingManager() { | 931 void BrowserProcessImpl::CreateBackgroundPrintingManager() { |
932 DCHECK(background_printing_manager_.get() == NULL); | 932 DCHECK(background_printing_manager_.get() == NULL); |
933 background_printing_manager_.reset(new printing::BackgroundPrintingManager()); | 933 background_printing_manager_.reset(new printing::BackgroundPrintingManager()); |
934 } | 934 } |
935 | 935 |
936 void BrowserProcessImpl::CreateSafeBrowsingService() { | 936 void BrowserProcessImpl::CreateSafeBrowsingService() { |
937 DCHECK(safe_browsing_service_.get() == NULL); | 937 DCHECK(safe_browsing_service_.get() == NULL); |
| 938 // Set this flag to true so that we don't retry indefinitely to |
| 939 // create the service class if there was an error. |
938 created_safe_browsing_service_ = true; | 940 created_safe_browsing_service_ = true; |
939 #if defined(ENABLE_SAFE_BROWSING) | 941 #if defined(ENABLE_SAFE_BROWSING) |
940 safe_browsing_service_ = SafeBrowsingService::CreateSafeBrowsingService(); | 942 safe_browsing_service_ = SafeBrowsingService::CreateSafeBrowsingService(); |
941 safe_browsing_service_->Initialize(); | 943 safe_browsing_service_->Initialize(); |
942 #endif | 944 #endif |
943 } | 945 } |
944 | 946 |
945 void BrowserProcessImpl::CreateSafeBrowsingDetectionService() { | 947 void BrowserProcessImpl::CreateSafeBrowsingDetectionService() { |
946 DCHECK(safe_browsing_detection_service_.get() == NULL); | 948 DCHECK(safe_browsing_detection_service_.get() == NULL); |
947 // Set this flag to true so that we don't retry indefinitely to | 949 // Set this flag to true so that we don't retry indefinitely to |
948 // create the service class if there was an error. | 950 // create the service class if there was an error. |
949 created_safe_browsing_detection_service_ = true; | 951 created_safe_browsing_detection_service_ = true; |
950 | 952 |
951 #if defined(ENABLE_SAFE_BROWSING) | 953 #if defined(ENABLE_SAFE_BROWSING) |
952 FilePath model_file_dir; | 954 FilePath model_file_dir; |
953 Profile* profile = profile_manager() ? | |
954 profile_manager()->GetDefaultProfile() : NULL; | |
955 if (IsSafeBrowsingDetectionServiceEnabled() && | 955 if (IsSafeBrowsingDetectionServiceEnabled() && |
956 PathService::Get(chrome::DIR_USER_DATA, &model_file_dir) && | 956 PathService::Get(chrome::DIR_USER_DATA, &model_file_dir)) { |
957 profile && profile->GetRequestContext()) { | |
958 safe_browsing_detection_service_.reset( | 957 safe_browsing_detection_service_.reset( |
959 safe_browsing::ClientSideDetectionService::Create( | 958 safe_browsing::ClientSideDetectionService::Create( |
960 model_file_dir, profile->GetRequestContext())); | 959 model_file_dir, g_browser_process->system_request_context())); |
961 } | 960 } |
962 #endif | 961 #endif |
963 } | 962 } |
964 | 963 |
965 bool BrowserProcessImpl::IsSafeBrowsingDetectionServiceEnabled() { | 964 bool BrowserProcessImpl::IsSafeBrowsingDetectionServiceEnabled() { |
966 // The safe browsing client-side detection is enabled only if the switch is | 965 // The safe browsing client-side detection is enabled only if the switch is |
967 // not disabled and when safe browsing related stats are allowed to be | 966 // not disabled and when safe browsing related stats are allowed to be |
968 // collected. | 967 // collected. |
969 #if defined(ENABLE_SAFE_BROWSING) && !defined(OS_CHROMEOS) | 968 #if defined(ENABLE_SAFE_BROWSING) && !defined(OS_CHROMEOS) |
970 return !CommandLine::ForCurrentProcess()->HasSwitch( | 969 return !CommandLine::ForCurrentProcess()->HasSwitch( |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1085 } | 1084 } |
1086 | 1085 |
1087 void BrowserProcessImpl::OnAutoupdateTimer() { | 1086 void BrowserProcessImpl::OnAutoupdateTimer() { |
1088 if (CanAutorestartForUpdate()) { | 1087 if (CanAutorestartForUpdate()) { |
1089 DLOG(WARNING) << "Detected update. Restarting browser."; | 1088 DLOG(WARNING) << "Detected update. Restarting browser."; |
1090 RestartPersistentInstance(); | 1089 RestartPersistentInstance(); |
1091 } | 1090 } |
1092 } | 1091 } |
1093 | 1092 |
1094 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1093 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |