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

Side by Side Diff: components/safe_browsing_db/remote_database_manager.cc

Issue 1700943003: SafeBrowsing: DatabaseManager owns the V4GetHashProtocolManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Pass NULL for the url_context_getter Created 4 years, 10 months 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
« no previous file with comments | « components/safe_browsing_db/remote_database_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/safe_browsing_db/remote_database_manager.h" 5 #include "components/safe_browsing_db/remote_database_manager.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/string_split.h" 11 #include "base/strings/string_split.h"
12 #include "base/timer/elapsed_timer.h" 12 #include "base/timer/elapsed_timer.h"
13 #include "components/safe_browsing_db/safe_browsing_api_handler.h" 13 #include "components/safe_browsing_db/safe_browsing_api_handler.h"
14 #include "components/safe_browsing_db/v4_get_hash_protocol_manager.h"
14 #include "components/variations/variations_associated_data.h" 15 #include "components/variations/variations_associated_data.h"
15 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
16 17
17 using content::BrowserThread; 18 using content::BrowserThread;
18 19
19 namespace { 20 namespace {
20 21
21 // Android field trial for controlling types_to_check. 22 // Android field trial for controlling types_to_check.
22 const char kAndroidFieldExperiment[] = "SafeBrowsingAndroid"; 23 const char kAndroidFieldExperiment[] = "SafeBrowsingAndroid";
23 const char kAndroidTypesToCheckParam[] = "types_to_check"; 24 const char kAndroidTypesToCheckParam[] = "types_to_check";
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 // CancelCheck() will delete *this. 87 // CancelCheck() will delete *this.
87 db_manager_->CancelCheck(client_); 88 db_manager_->CancelCheck(client_);
88 } 89 }
89 90
90 // 91 //
91 // RemoteSafeBrowsingDatabaseManager methods 92 // RemoteSafeBrowsingDatabaseManager methods
92 // 93 //
93 94
94 // TODO(nparker): Add more tests for this class 95 // TODO(nparker): Add more tests for this class
95 RemoteSafeBrowsingDatabaseManager::RemoteSafeBrowsingDatabaseManager() 96 RemoteSafeBrowsingDatabaseManager::RemoteSafeBrowsingDatabaseManager()
96 : enabled_(false) { 97 : RemoteSafeBrowsingDatabaseManager(NULL, V4GetHashProtocolConfig()) {
98 }
99
100 RemoteSafeBrowsingDatabaseManager::RemoteSafeBrowsingDatabaseManager(
101 net::URLRequestContextGetter* request_context_getter,
102 const V4GetHashProtocolConfig& config)
103 : SafeBrowsingDatabaseManager(request_context_getter, config),
104 enabled_(false) {
97 // Decide which resource types to check. These two are the minimum. 105 // Decide which resource types to check. These two are the minimum.
98 resource_types_to_check_.insert(content::RESOURCE_TYPE_MAIN_FRAME); 106 resource_types_to_check_.insert(content::RESOURCE_TYPE_MAIN_FRAME);
99 resource_types_to_check_.insert(content::RESOURCE_TYPE_SUB_FRAME); 107 resource_types_to_check_.insert(content::RESOURCE_TYPE_SUB_FRAME);
100 108
101 // The param is expected to be a comma-separated list of ints 109 // The param is expected to be a comma-separated list of ints
102 // corresponding to the enum types. We're keeping this finch 110 // corresponding to the enum types. We're keeping this finch
103 // control around so we can add back types if they later become dangerous. 111 // control around so we can add back types if they later become dangerous.
104 const std::string ints_str = variations::GetVariationParamValue( 112 const std::string ints_str = variations::GetVariationParamValue(
105 kAndroidFieldExperiment, kAndroidTypesToCheckParam); 113 kAndroidFieldExperiment, kAndroidTypesToCheckParam);
106 if (ints_str.empty()) { 114 if (ints_str.empty()) {
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 // |current_requests_|, so we make a copy first. 285 // |current_requests_|, so we make a copy first.
278 std::vector<ClientRequest*> to_callback(current_requests_); 286 std::vector<ClientRequest*> to_callback(current_requests_);
279 for (auto req : to_callback) { 287 for (auto req : to_callback) {
280 DVLOG(1) << "Stopping: Invoking unfinished req for URL " << req->url(); 288 DVLOG(1) << "Stopping: Invoking unfinished req for URL " << req->url();
281 req->OnRequestDone(SB_THREAT_TYPE_SAFE, std::string()); 289 req->OnRequestDone(SB_THREAT_TYPE_SAFE, std::string());
282 } 290 }
283 enabled_ = false; 291 enabled_ = false;
284 } 292 }
285 293
286 } // namespace safe_browsing 294 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « components/safe_browsing_db/remote_database_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698