| OLD | NEW |
| 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 16 matching lines...) Expand all Loading... |
| 27 #include "chrome/browser/chrome_notification_types.h" | 27 #include "chrome/browser/chrome_notification_types.h" |
| 28 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" | 28 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" |
| 29 #include "chrome/browser/profiles/profile.h" | 29 #include "chrome/browser/profiles/profile.h" |
| 30 #include "chrome/browser/profiles/profile_manager.h" | 30 #include "chrome/browser/profiles/profile_manager.h" |
| 31 #include "chrome/browser/safe_browsing/ping_manager.h" | 31 #include "chrome/browser/safe_browsing/ping_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_constants.h" | 33 #include "chrome/common/chrome_constants.h" |
| 34 #include "chrome/common/chrome_paths.h" | 34 #include "chrome/common/chrome_paths.h" |
| 35 #include "chrome/common/chrome_switches.h" | 35 #include "chrome/common/chrome_switches.h" |
| 36 #include "chrome/common/pref_names.h" | 36 #include "chrome/common/pref_names.h" |
| 37 #include "chrome/common/safe_browsing/file_type_policies.h" |
| 37 #include "chrome/common/url_constants.h" | 38 #include "chrome/common/url_constants.h" |
| 38 #include "components/prefs/pref_change_registrar.h" | 39 #include "components/prefs/pref_change_registrar.h" |
| 39 #include "components/prefs/pref_service.h" | 40 #include "components/prefs/pref_service.h" |
| 40 #include "components/safe_browsing_db/database_manager.h" | 41 #include "components/safe_browsing_db/database_manager.h" |
| 41 #include "components/safe_browsing_db/v4_get_hash_protocol_manager.h" | 42 #include "components/safe_browsing_db/v4_get_hash_protocol_manager.h" |
| 42 #include "components/user_prefs/tracked/tracked_preference_validation_delegate.h
" | 43 #include "components/user_prefs/tracked/tracked_preference_validation_delegate.h
" |
| 43 #include "content/public/browser/browser_thread.h" | 44 #include "content/public/browser/browser_thread.h" |
| 44 #include "content/public/browser/cookie_store_factory.h" | 45 #include "content/public/browser/cookie_store_factory.h" |
| 45 #include "content/public/browser/notification_service.h" | 46 #include "content/public/browser/notification_service.h" |
| 46 #include "content/public/browser/resource_request_info.h" | 47 #include "content/public/browser/resource_request_info.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 enabled_(false), | 287 enabled_(false), |
| 287 enabled_by_prefs_(false) {} | 288 enabled_by_prefs_(false) {} |
| 288 | 289 |
| 289 SafeBrowsingService::~SafeBrowsingService() { | 290 SafeBrowsingService::~SafeBrowsingService() { |
| 290 // We should have already been shut down. If we're still enabled, then the | 291 // We should have already been shut down. If we're still enabled, then the |
| 291 // database isn't going to be closed properly, which could lead to corruption. | 292 // database isn't going to be closed properly, which could lead to corruption. |
| 292 DCHECK(!enabled_); | 293 DCHECK(!enabled_); |
| 293 } | 294 } |
| 294 | 295 |
| 295 void SafeBrowsingService::Initialize() { | 296 void SafeBrowsingService::Initialize() { |
| 297 // Ensure FileTypePolicies's Singleton is instantiated during startup. |
| 298 // This guarantees we'll log UMA metrics about its state. |
| 299 FileTypePolicies::GetInstance(); |
| 300 |
| 296 url_request_context_getter_ = new SafeBrowsingURLRequestContextGetter( | 301 url_request_context_getter_ = new SafeBrowsingURLRequestContextGetter( |
| 297 g_browser_process->system_request_context()); | 302 g_browser_process->system_request_context()); |
| 298 | 303 |
| 299 ui_manager_ = CreateUIManager(); | 304 ui_manager_ = CreateUIManager(); |
| 300 | 305 |
| 301 database_manager_ = CreateDatabaseManager(); | 306 database_manager_ = CreateDatabaseManager(); |
| 302 | 307 |
| 303 services_delegate_->Initialize(); | 308 services_delegate_->Initialize(); |
| 304 services_delegate_->InitializeCsdService(url_request_context_getter_.get()); | 309 services_delegate_->InitializeCsdService(url_request_context_getter_.get()); |
| 305 | 310 |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 ping_manager()->ReportThreatDetails(report); | 698 ping_manager()->ReportThreatDetails(report); |
| 694 } | 699 } |
| 695 | 700 |
| 696 void SafeBrowsingService::ProcessResourceRequest( | 701 void SafeBrowsingService::ProcessResourceRequest( |
| 697 const ResourceRequestInfo& request) { | 702 const ResourceRequestInfo& request) { |
| 698 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 703 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 699 services_delegate_->ProcessResourceRequest(&request); | 704 services_delegate_->ProcessResourceRequest(&request); |
| 700 } | 705 } |
| 701 | 706 |
| 702 } // namespace safe_browsing | 707 } // namespace safe_browsing |
| OLD | NEW |