| 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 18 matching lines...) Expand all Loading... |
| 29 using base::TimeDelta; | 29 using base::TimeDelta; |
| 30 | 30 |
| 31 SafeBrowsingService::SafeBrowsingService() | 31 SafeBrowsingService::SafeBrowsingService() |
| 32 : io_loop_(NULL), | 32 : io_loop_(NULL), |
| 33 database_(NULL), | 33 database_(NULL), |
| 34 protocol_manager_(NULL), | 34 protocol_manager_(NULL), |
| 35 enabled_(false), | 35 enabled_(false), |
| 36 resetting_(false), | 36 resetting_(false), |
| 37 database_loaded_(false), | 37 database_loaded_(false), |
| 38 update_in_progress_(false) { | 38 update_in_progress_(false) { |
| 39 new_safe_browsing_ = !CommandLine().HasSwitch(switches::kUseOldSafeBrowsing); | 39 new_safe_browsing_ = !CommandLine::ForCurrentProcess()->HasSwitch( |
| 40 switches::kUseOldSafeBrowsing); |
| 40 base::SystemMonitor* monitor = base::SystemMonitor::Get(); | 41 base::SystemMonitor* monitor = base::SystemMonitor::Get(); |
| 41 DCHECK(monitor); | 42 DCHECK(monitor); |
| 42 if (monitor) | 43 if (monitor) |
| 43 monitor->AddObserver(this); | 44 monitor->AddObserver(this); |
| 44 } | 45 } |
| 45 | 46 |
| 46 SafeBrowsingService::~SafeBrowsingService() { | 47 SafeBrowsingService::~SafeBrowsingService() { |
| 47 base::SystemMonitor* monitor = base::SystemMonitor::Get(); | 48 base::SystemMonitor* monitor = base::SystemMonitor::Get(); |
| 48 if (monitor) | 49 if (monitor) |
| 49 monitor->RemoveObserver(this); | 50 monitor->RemoveObserver(this); |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 DCHECK(MessageLoop::current() == io_loop_); | 719 DCHECK(MessageLoop::current() == io_loop_); |
| 719 HISTOGRAM_COUNTS(L"SB.QueueDepth", queued_checks_.size()); | 720 HISTOGRAM_COUNTS(L"SB.QueueDepth", queued_checks_.size()); |
| 720 while (!queued_checks_.empty()) { | 721 while (!queued_checks_.empty()) { |
| 721 QueuedCheck check = queued_checks_.front(); | 722 QueuedCheck check = queued_checks_.front(); |
| 722 HISTOGRAM_TIMES(L"SB.QueueDelay", Time::Now() - check.start); | 723 HISTOGRAM_TIMES(L"SB.QueueDelay", Time::Now() - check.start); |
| 723 CheckUrl(check.url, check.client); | 724 CheckUrl(check.url, check.client); |
| 724 queued_checks_.pop_front(); | 725 queued_checks_.pop_front(); |
| 725 } | 726 } |
| 726 } | 727 } |
| 727 | 728 |
| OLD | NEW |