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

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 browser_tests after rebase 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 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 856
857 // No request in progress, so we're the first for this prefix. 857 // No request in progress, so we're the first for this prefix.
858 GetHashRequestors requestors; 858 GetHashRequestors requestors;
859 requestors.push_back(check); 859 requestors.push_back(check);
860 gethash_requests_[prefix] = requestors; 860 gethash_requests_[prefix] = requestors;
861 } 861 }
862 862
863 // Reset the start time so that we can measure the network time without the 863 // Reset the start time so that we can measure the network time without the
864 // database time. 864 // database time.
865 check->start = base::TimeTicks::Now(); 865 check->start = base::TimeTicks::Now();
866 protocol_manager_->GetFullHash(check, check->prefix_hits); 866 // Note: If |this| is deleted or stopped, the protocol_manager will
867 // be destroyed as well - hence it's OK to do unretained in this case.
868 protocol_manager_->GetFullHash(
869 check->prefix_hits,
870 base::Bind(&SafeBrowsingService::HandleGetHashResults,
871 base::Unretained(this),
872 check),
873 check->is_download);
867 } else { 874 } else {
868 // We may have cached results for previous GetHash queries. Since 875 // We may have cached results for previous GetHash queries. Since
869 // this data comes from cache, don't histogram hits. 876 // this data comes from cache, don't histogram hits.
870 HandleOneCheck(check, check->full_hits); 877 HandleOneCheck(check, check->full_hits);
871 } 878 }
872 } 879 }
873 880
874 void SafeBrowsingService::GetAllChunksFromDatabase() { 881 void SafeBrowsingService::GetAllChunksFromDatabase() {
875 DCHECK_EQ(MessageLoop::current(), safe_browsing_thread_->message_loop()); 882 DCHECK_EQ(MessageLoop::current(), safe_browsing_thread_->message_loop());
876 883
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
1438 Stop(); 1445 Stop();
1439 1446
1440 if (csd_service_.get()) 1447 if (csd_service_.get())
1441 csd_service_->SetEnabledAndRefreshState(enable); 1448 csd_service_->SetEnabledAndRefreshState(enable);
1442 if (download_service_.get()) { 1449 if (download_service_.get()) {
1443 download_service_->SetEnabled( 1450 download_service_->SetEnabled(
1444 enable && !CommandLine::ForCurrentProcess()->HasSwitch( 1451 enable && !CommandLine::ForCurrentProcess()->HasSwitch(
1445 switches::kDisableImprovedDownloadProtection)); 1452 switches::kDisableImprovedDownloadProtection));
1446 } 1453 }
1447 } 1454 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/protocol_manager.cc ('k') | chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698