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

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

Issue 2578363002: Wire up download attribution enable finch experiment (Closed)
Patch Set: Remove unnecessary includes Created 4 years 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') | chrome/browser/ui/tab_helpers.cc » ('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 10 matching lines...) Expand all
21 #include "base/threading/thread.h" 21 #include "base/threading/thread.h"
22 #include "base/threading/thread_restrictions.h" 22 #include "base/threading/thread_restrictions.h"
23 #include "base/threading/worker_pool.h" 23 #include "base/threading/worker_pool.h"
24 #include "base/trace_event/trace_event.h" 24 #include "base/trace_event/trace_event.h"
25 #include "build/build_config.h" 25 #include "build/build_config.h"
26 #include "chrome/browser/browser_process.h" 26 #include "chrome/browser/browser_process.h"
27 #include "chrome/browser/chrome_notification_types.h" 27 #include "chrome/browser/chrome_notification_types.h"
28 #include "chrome/browser/profiles/profile.h" 28 #include "chrome/browser/profiles/profile.h"
29 #include "chrome/browser/profiles/profile_manager.h" 29 #include "chrome/browser/profiles/profile_manager.h"
30 #include "chrome/browser/safe_browsing/ping_manager.h" 30 #include "chrome/browser/safe_browsing/ping_manager.h"
31 #include "chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager .h"
31 #include "chrome/browser/safe_browsing/ui_manager.h" 32 #include "chrome/browser/safe_browsing/ui_manager.h"
32 #include "chrome/common/chrome_paths.h" 33 #include "chrome/common/chrome_paths.h"
33 #include "chrome/common/chrome_switches.h" 34 #include "chrome/common/chrome_switches.h"
34 #include "chrome/common/pref_names.h" 35 #include "chrome/common/pref_names.h"
35 #include "chrome/common/safe_browsing/file_type_policies.h" 36 #include "chrome/common/safe_browsing/file_type_policies.h"
36 #include "components/prefs/pref_change_registrar.h" 37 #include "components/prefs/pref_change_registrar.h"
37 #include "components/prefs/pref_service.h" 38 #include "components/prefs/pref_service.h"
38 #include "components/safe_browsing/common/safebrowsing_constants.h" 39 #include "components/safe_browsing/common/safebrowsing_constants.h"
39 #include "components/safe_browsing/common/safebrowsing_switches.h" 40 #include "components/safe_browsing/common/safebrowsing_switches.h"
40 #include "components/safe_browsing_db/database_manager.h" 41 #include "components/safe_browsing_db/database_manager.h"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 303
303 url_request_context_getter_ = new SafeBrowsingURLRequestContextGetter( 304 url_request_context_getter_ = new SafeBrowsingURLRequestContextGetter(
304 g_browser_process->system_request_context()); 305 g_browser_process->system_request_context());
305 306
306 ui_manager_ = CreateUIManager(); 307 ui_manager_ = CreateUIManager();
307 308
308 if (!enabled_v4_only_) { 309 if (!enabled_v4_only_) {
309 database_manager_ = CreateDatabaseManager(); 310 database_manager_ = CreateDatabaseManager();
310 } 311 }
311 312
313 if (base::FeatureList::IsEnabled(
314 SafeBrowsingNavigationObserverManager::kDownloadAttribution)) {
315 navigation_observer_manager_ = new SafeBrowsingNavigationObserverManager();
316 }
317
312 services_delegate_->Initialize(); 318 services_delegate_->Initialize();
313 services_delegate_->InitializeCsdService(url_request_context_getter_.get()); 319 services_delegate_->InitializeCsdService(url_request_context_getter_.get());
314 320
315 // Track the safe browsing preference of existing profiles. 321 // Track the safe browsing preference of existing profiles.
316 // The SafeBrowsingService will be started if any existing profile has the 322 // The SafeBrowsingService will be started if any existing profile has the
317 // preference enabled. It will also listen for updates to the preferences. 323 // preference enabled. It will also listen for updates to the preferences.
318 ProfileManager* profile_manager = g_browser_process->profile_manager(); 324 ProfileManager* profile_manager = g_browser_process->profile_manager();
319 if (profile_manager) { 325 if (profile_manager) {
320 std::vector<Profile*> profiles = profile_manager->GetLoadedProfiles(); 326 std::vector<Profile*> profiles = profile_manager->GetLoadedProfiles();
321 // TODO(felt): I believe this for-loop is dead code. Confirm this and 327 // TODO(felt): I believe this for-loop is dead code. Confirm this and
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 const scoped_refptr<SafeBrowsingUIManager>& 392 const scoped_refptr<SafeBrowsingUIManager>&
387 SafeBrowsingService::ui_manager() const { 393 SafeBrowsingService::ui_manager() const {
388 return ui_manager_; 394 return ui_manager_;
389 } 395 }
390 396
391 const scoped_refptr<SafeBrowsingDatabaseManager>& 397 const scoped_refptr<SafeBrowsingDatabaseManager>&
392 SafeBrowsingService::database_manager() const { 398 SafeBrowsingService::database_manager() const {
393 return enabled_v4_only_ ? v4_local_database_manager() : database_manager_; 399 return enabled_v4_only_ ? v4_local_database_manager() : database_manager_;
394 } 400 }
395 401
402 scoped_refptr<SafeBrowsingNavigationObserverManager>
403 SafeBrowsingService::navigation_observer_manager() {
404 return navigation_observer_manager_;
405 }
406
396 SafeBrowsingProtocolManager* SafeBrowsingService::protocol_manager() const { 407 SafeBrowsingProtocolManager* SafeBrowsingService::protocol_manager() const {
397 DCHECK_CURRENTLY_ON(BrowserThread::IO); 408 DCHECK_CURRENTLY_ON(BrowserThread::IO);
398 #if defined(SAFE_BROWSING_DB_LOCAL) 409 #if defined(SAFE_BROWSING_DB_LOCAL)
399 DCHECK(!enabled_v4_only_); 410 DCHECK(!enabled_v4_only_);
400 return protocol_manager_.get(); 411 return protocol_manager_.get();
401 #else 412 #else
402 return nullptr; 413 return nullptr;
403 #endif 414 #endif
404 } 415 }
405 416
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 ping_manager()->ReportThreatDetails(report); 729 ping_manager()->ReportThreatDetails(report);
719 } 730 }
720 731
721 void SafeBrowsingService::ProcessResourceRequest( 732 void SafeBrowsingService::ProcessResourceRequest(
722 const ResourceRequestInfo& request) { 733 const ResourceRequestInfo& request) {
723 DCHECK_CURRENTLY_ON(BrowserThread::UI); 734 DCHECK_CURRENTLY_ON(BrowserThread::UI);
724 services_delegate_->ProcessResourceRequest(&request); 735 services_delegate_->ProcessResourceRequest(&request);
725 } 736 }
726 737
727 } // namespace safe_browsing 738 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_service.h ('k') | chrome/browser/ui/tab_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698