OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/singleton.h" | 10 #include "base/singleton.h" |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 cmdline->HasSwitch(switches::kDisableBackgroundNetworking); | 421 cmdline->HasSwitch(switches::kDisableBackgroundNetworking); |
422 std::string info_url_prefix = | 422 std::string info_url_prefix = |
423 cmdline->HasSwitch(switches::kSbInfoURLPrefix) ? | 423 cmdline->HasSwitch(switches::kSbInfoURLPrefix) ? |
424 cmdline->GetSwitchValueASCII(switches::kSbInfoURLPrefix) : | 424 cmdline->GetSwitchValueASCII(switches::kSbInfoURLPrefix) : |
425 kSbDefaultInfoURLPrefix; | 425 kSbDefaultInfoURLPrefix; |
426 std::string mackey_url_prefix = | 426 std::string mackey_url_prefix = |
427 cmdline->HasSwitch(switches::kSbMacKeyURLPrefix) ? | 427 cmdline->HasSwitch(switches::kSbMacKeyURLPrefix) ? |
428 cmdline->GetSwitchValueASCII(switches::kSbMacKeyURLPrefix) : | 428 cmdline->GetSwitchValueASCII(switches::kSbMacKeyURLPrefix) : |
429 kSbDefaultMacKeyURLPrefix; | 429 kSbDefaultMacKeyURLPrefix; |
430 | 430 |
431 protocol_manager_ = new SafeBrowsingProtocolManager(this, | 431 DCHECK(!protocol_manager_); |
432 client_name, | 432 protocol_manager_ = |
433 client_key, | 433 SafeBrowsingProtocolManager::Create(this, |
434 wrapped_key, | 434 client_name, |
435 request_context_getter, | 435 client_key, |
436 info_url_prefix, | 436 wrapped_key, |
437 mackey_url_prefix, | 437 request_context_getter, |
438 disable_auto_update); | 438 info_url_prefix, |
| 439 mackey_url_prefix, |
| 440 disable_auto_update); |
439 | 441 |
440 protocol_manager_->Initialize(); | 442 protocol_manager_->Initialize(); |
441 } | 443 } |
442 | 444 |
443 void SafeBrowsingService::OnIOShutdown() { | 445 void SafeBrowsingService::OnIOShutdown() { |
444 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 446 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
445 if (!enabled_) | 447 if (!enabled_) |
446 return; | 448 return; |
447 | 449 |
448 enabled_ = false; | 450 enabled_ = false; |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 if (!enabled_) | 854 if (!enabled_) |
853 return; | 855 return; |
854 | 856 |
855 DVLOG(1) << "ReportSafeBrowsingHit: " << malicious_url << " " << page_url | 857 DVLOG(1) << "ReportSafeBrowsingHit: " << malicious_url << " " << page_url |
856 << " " << referrer_url << " " << is_subresource << " " | 858 << " " << referrer_url << " " << is_subresource << " " |
857 << threat_type; | 859 << threat_type; |
858 protocol_manager_->ReportSafeBrowsingHit(malicious_url, page_url, | 860 protocol_manager_->ReportSafeBrowsingHit(malicious_url, page_url, |
859 referrer_url, is_subresource, | 861 referrer_url, is_subresource, |
860 threat_type); | 862 threat_type); |
861 } | 863 } |
OLD | NEW |