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

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

Issue 11347005: Change SafeBrowsingProtocolManager::GetFullHash signature. (Closed) Base URL: http://git.chromium.org/chromium/src.git@in_progress
Patch Set: Fix rebase with browser_test Created 8 years, 1 month 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
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 857
858 // No request in progress, so we're the first for this prefix. 858 // No request in progress, so we're the first for this prefix.
859 GetHashRequestors requestors; 859 GetHashRequestors requestors;
860 requestors.push_back(check); 860 requestors.push_back(check);
861 gethash_requests_[prefix] = requestors; 861 gethash_requests_[prefix] = requestors;
862 } 862 }
863 863
864 // Reset the start time so that we can measure the network time without the 864 // Reset the start time so that we can measure the network time without the
865 // database time. 865 // database time.
866 check->start = base::TimeTicks::Now(); 866 check->start = base::TimeTicks::Now();
867 protocol_manager_->GetFullHash(check, check->prefix_hits); 867 // Note: If |this| is deleted or stopped, the protocol_manager will
868 // be destroyed as well - hence it's OK to do unretained in this case.
869 protocol_manager_->GetFullHash(
870 check->prefix_hits,
871 base::Bind(&SafeBrowsingService::HandleGetHashResults,
872 base::Unretained(this),
873 check),
874 check->is_download);
868 } else { 875 } else {
869 // We may have cached results for previous GetHash queries. Since 876 // We may have cached results for previous GetHash queries. Since
870 // this data comes from cache, don't histogram hits. 877 // this data comes from cache, don't histogram hits.
871 HandleOneCheck(check, check->full_hits); 878 HandleOneCheck(check, check->full_hits);
872 } 879 }
873 } 880 }
874 881
875 void SafeBrowsingService::GetAllChunksFromDatabase() { 882 void SafeBrowsingService::GetAllChunksFromDatabase() {
876 DCHECK_EQ(MessageLoop::current(), safe_browsing_thread_->message_loop()); 883 DCHECK_EQ(MessageLoop::current(), safe_browsing_thread_->message_loop());
877 884
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
1439 Stop(); 1446 Stop();
1440 1447
1441 if (csd_service_.get()) 1448 if (csd_service_.get())
1442 csd_service_->SetEnabledAndRefreshState(enable); 1449 csd_service_->SetEnabledAndRefreshState(enable);
1443 if (download_service_.get()) { 1450 if (download_service_.get()) {
1444 download_service_->SetEnabled( 1451 download_service_->SetEnabled(
1445 enable && !CommandLine::ForCurrentProcess()->HasSwitch( 1452 enable && !CommandLine::ForCurrentProcess()->HasSwitch(
1446 switches::kDisableImprovedDownloadProtection)); 1453 switches::kDisableImprovedDownloadProtection));
1447 } 1454 }
1448 } 1455 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698