| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 | 5 |
| 6 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 6 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/histogram.h" | 9 #include "base/histogram.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 using base::Time; | 26 using base::Time; |
| 27 using base::TimeDelta; | 27 using base::TimeDelta; |
| 28 | 28 |
| 29 SafeBrowsingService::SafeBrowsingService() | 29 SafeBrowsingService::SafeBrowsingService() |
| 30 : io_loop_(NULL), | 30 : io_loop_(NULL), |
| 31 database_(NULL), | 31 database_(NULL), |
| 32 protocol_manager_(NULL), | 32 protocol_manager_(NULL), |
| 33 enabled_(false), | 33 enabled_(false), |
| 34 resetting_(false), | 34 resetting_(false), |
| 35 database_loaded_(false) { | 35 database_loaded_(false) { |
| 36 new_safe_browsing_ = CommandLine().HasSwitch(switches::kUseNewSafeBrowsing); | 36 new_safe_browsing_ = !CommandLine().HasSwitch(switches::kUseOldSafeBrowsing); |
| 37 } | 37 } |
| 38 | 38 |
| 39 SafeBrowsingService::~SafeBrowsingService() { | 39 SafeBrowsingService::~SafeBrowsingService() { |
| 40 } | 40 } |
| 41 | 41 |
| 42 // Only called on the UI thread. | 42 // Only called on the UI thread. |
| 43 void SafeBrowsingService::Initialize(MessageLoop* io_loop) { | 43 void SafeBrowsingService::Initialize(MessageLoop* io_loop) { |
| 44 io_loop_ = io_loop; | 44 io_loop_ = io_loop; |
| 45 | 45 |
| 46 // Get the profile's preference for SafeBrowsing. | 46 // Get the profile's preference for SafeBrowsing. |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 DCHECK(MessageLoop::current() == io_loop_); | 690 DCHECK(MessageLoop::current() == io_loop_); |
| 691 HISTOGRAM_COUNTS(L"SB.QueueDepth", queued_checks_.size()); | 691 HISTOGRAM_COUNTS(L"SB.QueueDepth", queued_checks_.size()); |
| 692 while (!queued_checks_.empty()) { | 692 while (!queued_checks_.empty()) { |
| 693 QueuedCheck check = queued_checks_.front(); | 693 QueuedCheck check = queued_checks_.front(); |
| 694 HISTOGRAM_TIMES(L"SB.QueueDelay", Time::Now() - check.start); | 694 HISTOGRAM_TIMES(L"SB.QueueDelay", Time::Now() - check.start); |
| 695 CheckUrl(check.url, check.client); | 695 CheckUrl(check.url, check.client); |
| 696 queued_checks_.pop_front(); | 696 queued_checks_.pop_front(); |
| 697 } | 697 } |
| 698 } | 698 } |
| 699 | 699 |
| OLD | NEW |