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

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: Add TODO 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
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 new PasswordProtectionService(database_manager());
Nathan Parker 2017/03/01 22:59:22 nit: I think these and others around here should b
vakh (use Gerrit instead) 2017/03/01 23:25:19 +1
Jialiu Lin 2017/03/02 00:53:06 Done.
Jialiu Lin 2017/03/02 00:53:06 Done. Change it from scoped_refptr to unique_ptr i
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 scoped_refptr<PasswordProtectionService>
457 SafeBrowsingService::password_protection_service() {
458 return password_protection_service_;
vakh (use Gerrit instead) 2017/03/01 23:25:19 This can go in the header file. https://google.git
Jialiu Lin 2017/03/02 00:53:06 Acknowledged. Since all the other getters are defi
459 }
460
450 std::unique_ptr<TrackedPreferenceValidationDelegate> 461 std::unique_ptr<TrackedPreferenceValidationDelegate>
451 SafeBrowsingService::CreatePreferenceValidationDelegate( 462 SafeBrowsingService::CreatePreferenceValidationDelegate(
452 Profile* profile) const { 463 Profile* profile) const {
453 return services_delegate_->CreatePreferenceValidationDelegate(profile); 464 return services_delegate_->CreatePreferenceValidationDelegate(profile);
454 } 465 }
455 466
456 void SafeBrowsingService::RegisterDelayedAnalysisCallback( 467 void SafeBrowsingService::RegisterDelayedAnalysisCallback(
457 const DelayedAnalysisCallback& callback) { 468 const DelayedAnalysisCallback& callback) {
458 services_delegate_->RegisterDelayedAnalysisCallback(callback); 469 services_delegate_->RegisterDelayedAnalysisCallback(callback);
459 } 470 }
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 ping_manager()->ReportThreatDetails(report); 768 ping_manager()->ReportThreatDetails(report);
758 } 769 }
759 770
760 void SafeBrowsingService::ProcessResourceRequest( 771 void SafeBrowsingService::ProcessResourceRequest(
761 const ResourceRequestInfo& request) { 772 const ResourceRequestInfo& request) {
762 DCHECK_CURRENTLY_ON(BrowserThread::UI); 773 DCHECK_CURRENTLY_ON(BrowserThread::UI);
763 services_delegate_->ProcessResourceRequest(&request); 774 services_delegate_->ProcessResourceRequest(&request);
764 } 775 }
765 776
766 } // namespace safe_browsing 777 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698