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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_service.cc

Issue 2720643003: Call CSD whitelist checking on UI thread and record UMA (Closed)
Patch Set: change source_set name Created 3 years, 9 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
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_service.h ('k') | components/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/safe_browsing/safe_browsing_service.h" 5 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 20 matching lines...) Expand all
31 #include "chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager .h" 31 #include "chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager .h"
32 #include "chrome/browser/safe_browsing/ui_manager.h" 32 #include "chrome/browser/safe_browsing/ui_manager.h"
33 #include "chrome/common/chrome_paths.h" 33 #include "chrome/common/chrome_paths.h"
34 #include "chrome/common/chrome_switches.h" 34 #include "chrome/common/chrome_switches.h"
35 #include "chrome/common/pref_names.h" 35 #include "chrome/common/pref_names.h"
36 #include "chrome/common/safe_browsing/file_type_policies.h" 36 #include "chrome/common/safe_browsing/file_type_policies.h"
37 #include "components/prefs/pref_change_registrar.h" 37 #include "components/prefs/pref_change_registrar.h"
38 #include "components/prefs/pref_service.h" 38 #include "components/prefs/pref_service.h"
39 #include "components/safe_browsing/common/safebrowsing_constants.h" 39 #include "components/safe_browsing/common/safebrowsing_constants.h"
40 #include "components/safe_browsing/common/safebrowsing_switches.h" 40 #include "components/safe_browsing/common/safebrowsing_switches.h"
41 #include "components/safe_browsing/password_protection/password_protection_servi ce.h"
41 #include "components/safe_browsing_db/database_manager.h" 42 #include "components/safe_browsing_db/database_manager.h"
42 #include "components/safe_browsing_db/v4_feature_list.h" 43 #include "components/safe_browsing_db/v4_feature_list.h"
43 #include "components/safe_browsing_db/v4_get_hash_protocol_manager.h" 44 #include "components/safe_browsing_db/v4_get_hash_protocol_manager.h"
44 #include "components/safe_browsing_db/v4_local_database_manager.h" 45 #include "components/safe_browsing_db/v4_local_database_manager.h"
45 #include "components/user_prefs/tracked/tracked_preference_validation_delegate.h " 46 #include "components/user_prefs/tracked/tracked_preference_validation_delegate.h "
46 #include "content/public/browser/browser_thread.h" 47 #include "content/public/browser/browser_thread.h"
47 #include "content/public/browser/cookie_store_factory.h" 48 #include "content/public/browser/cookie_store_factory.h"
48 #include "content/public/browser/notification_service.h" 49 #include "content/public/browser/notification_service.h"
49 #include "content/public/browser/resource_request_info.h" 50 #include "content/public/browser/resource_request_info.h"
50 #include "google_apis/google_api_keys.h" 51 #include "google_apis/google_api_keys.h"
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 322
322 if (!use_v4_only_) { 323 if (!use_v4_only_) {
323 database_manager_ = CreateDatabaseManager(); 324 database_manager_ = CreateDatabaseManager();
324 } 325 }
325 326
326 if (base::FeatureList::IsEnabled( 327 if (base::FeatureList::IsEnabled(
327 SafeBrowsingNavigationObserverManager::kDownloadAttribution)) { 328 SafeBrowsingNavigationObserverManager::kDownloadAttribution)) {
328 navigation_observer_manager_ = new SafeBrowsingNavigationObserverManager(); 329 navigation_observer_manager_ = new SafeBrowsingNavigationObserverManager();
329 } 330 }
330 331
332 // TODO(jialiul): When PasswordProtectionService does more than reporting UMA,
333 // we need to add finch trial to gate its functionality.
334 password_protection_service_ =
335 base::MakeUnique<PasswordProtectionService>(database_manager());
336
331 services_delegate_->Initialize(v4_enabled_); 337 services_delegate_->Initialize(v4_enabled_);
332 services_delegate_->InitializeCsdService(url_request_context_getter_.get()); 338 services_delegate_->InitializeCsdService(url_request_context_getter_.get());
333 339
334 // Track the safe browsing preference of existing profiles. 340 // Track the safe browsing preference of existing profiles.
335 // The SafeBrowsingService will be started if any existing profile has the 341 // The SafeBrowsingService will be started if any existing profile has the
336 // preference enabled. It will also listen for updates to the preferences. 342 // preference enabled. It will also listen for updates to the preferences.
337 ProfileManager* profile_manager = g_browser_process->profile_manager(); 343 ProfileManager* profile_manager = g_browser_process->profile_manager();
338 if (profile_manager) { 344 if (profile_manager) {
339 std::vector<Profile*> profiles = profile_manager->GetLoadedProfiles(); 345 std::vector<Profile*> profiles = profile_manager->GetLoadedProfiles();
340 // TODO(felt): I believe this for-loop is dead code. Confirm this and 346 // TODO(felt): I believe this for-loop is dead code. Confirm this and
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 SafeBrowsingPingManager* SafeBrowsingService::ping_manager() const { 446 SafeBrowsingPingManager* SafeBrowsingService::ping_manager() const {
441 DCHECK_CURRENTLY_ON(BrowserThread::IO); 447 DCHECK_CURRENTLY_ON(BrowserThread::IO);
442 return ping_manager_.get(); 448 return ping_manager_.get();
443 } 449 }
444 450
445 const scoped_refptr<SafeBrowsingDatabaseManager>& 451 const scoped_refptr<SafeBrowsingDatabaseManager>&
446 SafeBrowsingService::v4_local_database_manager() const { 452 SafeBrowsingService::v4_local_database_manager() const {
447 return services_delegate_->v4_local_database_manager(); 453 return services_delegate_->v4_local_database_manager();
448 } 454 }
449 455
456 PasswordProtectionService* SafeBrowsingService::password_protection_service() {
457 return password_protection_service_.get();
458 }
459
450 std::unique_ptr<TrackedPreferenceValidationDelegate> 460 std::unique_ptr<TrackedPreferenceValidationDelegate>
451 SafeBrowsingService::CreatePreferenceValidationDelegate( 461 SafeBrowsingService::CreatePreferenceValidationDelegate(
452 Profile* profile) const { 462 Profile* profile) const {
453 return services_delegate_->CreatePreferenceValidationDelegate(profile); 463 return services_delegate_->CreatePreferenceValidationDelegate(profile);
454 } 464 }
455 465
456 void SafeBrowsingService::RegisterDelayedAnalysisCallback( 466 void SafeBrowsingService::RegisterDelayedAnalysisCallback(
457 const DelayedAnalysisCallback& callback) { 467 const DelayedAnalysisCallback& callback) {
458 services_delegate_->RegisterDelayedAnalysisCallback(callback); 468 services_delegate_->RegisterDelayedAnalysisCallback(callback);
459 } 469 }
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 ping_manager()->ReportThreatDetails(report); 767 ping_manager()->ReportThreatDetails(report);
758 } 768 }
759 769
760 void SafeBrowsingService::ProcessResourceRequest( 770 void SafeBrowsingService::ProcessResourceRequest(
761 const ResourceRequestInfo& request) { 771 const ResourceRequestInfo& request) {
762 DCHECK_CURRENTLY_ON(BrowserThread::UI); 772 DCHECK_CURRENTLY_ON(BrowserThread::UI);
763 services_delegate_->ProcessResourceRequest(&request); 773 services_delegate_->ProcessResourceRequest(&request);
764 } 774 }
765 775
766 } // namespace safe_browsing 776 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_service.h ('k') | components/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698