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

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

Issue 2647323009: Add extended reporting level in the update request (Closed)
Patch Set: Created 3 years, 11 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 // This file should not be build on Android but is currently getting built. 5 // This file should not be build on Android but is currently getting built.
6 // TODO(vakh): Fix that: http://crbug.com/621647 6 // TODO(vakh): Fix that: http://crbug.com/621647
7 7
8 #include "components/safe_browsing_db/v4_local_database_manager.h" 8 #include "components/safe_browsing_db/v4_local_database_manager.h"
9 9
10 #include <vector> 10 #include <vector>
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 client_callback_type(client_callback_type), 121 client_callback_type(client_callback_type),
122 result_threat_type(SB_THREAT_TYPE_SAFE), 122 result_threat_type(SB_THREAT_TYPE_SAFE),
123 stores_to_check(stores_to_check) { 123 stores_to_check(stores_to_check) {
124 full_hashes.assign(full_hashes_set.begin(), full_hashes_set.end()); 124 full_hashes.assign(full_hashes_set.begin(), full_hashes_set.end());
125 } 125 }
126 126
127 V4LocalDatabaseManager::PendingCheck::~PendingCheck() {} 127 V4LocalDatabaseManager::PendingCheck::~PendingCheck() {}
128 128
129 // static 129 // static
130 scoped_refptr<V4LocalDatabaseManager> V4LocalDatabaseManager::Create( 130 scoped_refptr<V4LocalDatabaseManager> V4LocalDatabaseManager::Create(
131 const base::FilePath& base_path) { 131 const base::FilePath& base_path,
132 ExtendedReportingLevelCallback extended_reporting_level_callback) {
132 if (!V4FeatureList::IsLocalDatabaseManagerEnabled()) { 133 if (!V4FeatureList::IsLocalDatabaseManagerEnabled()) {
133 return nullptr; 134 return nullptr;
134 } 135 }
135 136
136 return make_scoped_refptr(new V4LocalDatabaseManager(base_path)); 137 return make_scoped_refptr(
138 new V4LocalDatabaseManager(base_path, extended_reporting_level_callback));
137 } 139 }
138 140
139 V4LocalDatabaseManager::V4LocalDatabaseManager(const base::FilePath& base_path) 141 V4LocalDatabaseManager::V4LocalDatabaseManager(
142 const base::FilePath& base_path,
143 ExtendedReportingLevelCallback extended_reporting_level_callback)
140 : base_path_(base_path), 144 : base_path_(base_path),
141 enabled_(false), 145 enabled_(false),
146 extended_reporting_level_callback_(extended_reporting_level_callback),
142 list_infos_(GetListInfos()), 147 list_infos_(GetListInfos()),
143 weak_factory_(this) { 148 weak_factory_(this) {
144 DCHECK(!base_path_.empty()); 149 DCHECK(!base_path_.empty());
145 DCHECK(!list_infos_.empty()); 150 DCHECK(!list_infos_.empty());
146 151
147 DVLOG(1) << "V4LocalDatabaseManager::V4LocalDatabaseManager: " 152 DVLOG(1) << "V4LocalDatabaseManager::V4LocalDatabaseManager: "
148 << "base_path_: " << base_path_.AsUTF8Unsafe(); 153 << "base_path_: " << base_path_.AsUTF8Unsafe();
149 } 154 }
150 155
151 V4LocalDatabaseManager::~V4LocalDatabaseManager() { 156 V4LocalDatabaseManager::~V4LocalDatabaseManager() {
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 // has been created, swap it out on the IO thread. 706 // has been created, swap it out on the IO thread.
702 NewDatabaseReadyCallback db_ready_callback = 707 NewDatabaseReadyCallback db_ready_callback =
703 base::Bind(&V4LocalDatabaseManager::DatabaseReadyForChecks, 708 base::Bind(&V4LocalDatabaseManager::DatabaseReadyForChecks,
704 weak_factory_.GetWeakPtr()); 709 weak_factory_.GetWeakPtr());
705 V4Database::Create(task_runner_, base_path_, list_infos_, db_ready_callback); 710 V4Database::Create(task_runner_, base_path_, list_infos_, db_ready_callback);
706 } 711 }
707 712
708 void V4LocalDatabaseManager::SetupUpdateProtocolManager( 713 void V4LocalDatabaseManager::SetupUpdateProtocolManager(
709 net::URLRequestContextGetter* request_context_getter, 714 net::URLRequestContextGetter* request_context_getter,
710 const V4ProtocolConfig& config) { 715 const V4ProtocolConfig& config) {
711 V4UpdateCallback callback = 716 V4UpdateCallback update_callback =
712 base::Bind(&V4LocalDatabaseManager::UpdateRequestCompleted, 717 base::Bind(&V4LocalDatabaseManager::UpdateRequestCompleted,
713 weak_factory_.GetWeakPtr()); 718 weak_factory_.GetWeakPtr());
714 719
715 v4_update_protocol_manager_ = 720 v4_update_protocol_manager_ = V4UpdateProtocolManager::Create(
716 V4UpdateProtocolManager::Create(request_context_getter, config, callback); 721 request_context_getter, config, update_callback,
722 extended_reporting_level_callback_);
717 } 723 }
718 724
719 void V4LocalDatabaseManager::UpdateRequestCompleted( 725 void V4LocalDatabaseManager::UpdateRequestCompleted(
720 std::unique_ptr<ParsedServerResponse> parsed_server_response) { 726 std::unique_ptr<ParsedServerResponse> parsed_server_response) {
721 DCHECK_CURRENTLY_ON(BrowserThread::IO); 727 DCHECK_CURRENTLY_ON(BrowserThread::IO);
722 v4_database_->ApplyUpdate(std::move(parsed_server_response), 728 v4_database_->ApplyUpdate(std::move(parsed_server_response),
723 db_updated_callback_); 729 db_updated_callback_);
724 } 730 }
725 731
726 bool V4LocalDatabaseManager::AreStoresAvailableNow( 732 bool V4LocalDatabaseManager::AreStoresAvailableNow(
727 const StoresToCheck& stores_to_check) const { 733 const StoresToCheck& stores_to_check) const {
728 return enabled_ && v4_database_ && 734 return enabled_ && v4_database_ &&
729 v4_database_->AreStoresAvailable(stores_to_check); 735 v4_database_->AreStoresAvailable(stores_to_check);
730 } 736 }
731 737
732 } // namespace safe_browsing 738 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698