Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: chrome/browser/browser_process_impl.cc

Issue 7134017: Make safe browsing work in a multi-profile environment. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: respond to mattm's comment Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 created_safe_browsing_service_ = true; 965 created_safe_browsing_service_ = true;
966 safe_browsing_service_ = SafeBrowsingService::CreateSafeBrowsingService(); 966 safe_browsing_service_ = SafeBrowsingService::CreateSafeBrowsingService();
967 safe_browsing_service_->Initialize(); 967 safe_browsing_service_->Initialize();
968 } 968 }
969 969
970 void BrowserProcessImpl::CreateSafeBrowsingDetectionService() { 970 void BrowserProcessImpl::CreateSafeBrowsingDetectionService() {
971 DCHECK(safe_browsing_detection_service_.get() == NULL); 971 DCHECK(safe_browsing_detection_service_.get() == NULL);
972 // Set this flag to true so that we don't retry indefinitely to 972 // Set this flag to true so that we don't retry indefinitely to
973 // create the service class if there was an error. 973 // create the service class if there was an error.
974 created_safe_browsing_detection_service_ = true; 974 created_safe_browsing_detection_service_ = true;
975
976 FilePath model_file_dir; 975 FilePath model_file_dir;
977 Profile* profile = profile_manager() ? 976 PathService::Get(chrome::DIR_USER_DATA, &model_file_dir);
978 profile_manager()->GetDefaultProfile() : NULL; 977 if (IsSafeBrowsingDetectionServiceEnabled()) {
979 if (IsSafeBrowsingDetectionServiceEnabled() &&
980 PathService::Get(chrome::DIR_USER_DATA, &model_file_dir) &&
981 profile && profile->GetRequestContext()) {
982 safe_browsing_detection_service_.reset( 978 safe_browsing_detection_service_.reset(
983 safe_browsing::ClientSideDetectionService::Create( 979 safe_browsing::ClientSideDetectionService::Create(
984 model_file_dir, profile->GetRequestContext())); 980 model_file_dir, g_browser_process->system_request_context()));
985 } 981 }
986 } 982 }
987 983
988 bool BrowserProcessImpl::IsSafeBrowsingDetectionServiceEnabled() { 984 bool BrowserProcessImpl::IsSafeBrowsingDetectionServiceEnabled() {
989 // The safe browsing client-side detection is enabled only if the switch is 985 // The safe browsing client-side detection is enabled only if the switch is
990 // not disabled and when safe browsing related stats are allowed to be 986 // not disabled and when safe browsing related stats are allowed to be
991 // collected. 987 // collected.
992 #ifdef OS_CHROMEOS 988 #ifdef OS_CHROMEOS
993 return false; 989 return false;
994 #else 990 #else
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 } 1104 }
1109 1105
1110 void BrowserProcessImpl::OnAutoupdateTimer() { 1106 void BrowserProcessImpl::OnAutoupdateTimer() {
1111 if (CanAutorestartForUpdate()) { 1107 if (CanAutorestartForUpdate()) {
1112 DLOG(WARNING) << "Detected update. Restarting browser."; 1108 DLOG(WARNING) << "Detected update. Restarting browser.";
1113 RestartPersistentInstance(); 1109 RestartPersistentInstance();
1114 } 1110 }
1115 } 1111 }
1116 1112
1117 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 1113 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698