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

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

Issue 1932753005: Download Malware blacklist on desktop platforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@v4_01_enable_v4db
Patch Set: Add link to bug Created 4 years, 7 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 #include "components/safe_browsing_db/v4_local_database_manager.h" 5 #include "components/safe_browsing_db/v4_local_database_manager.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "components/safe_browsing_db/safebrowsing.pb.h"
9 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
10 11
11 using content::BrowserThread; 12 using content::BrowserThread;
12 13
13 namespace safe_browsing { 14 namespace safe_browsing {
14 15
15 V4LocalDatabaseManager::V4LocalDatabaseManager() : enabled_(false) {} 16 V4LocalDatabaseManager::V4LocalDatabaseManager() : enabled_(false) {}
16 17
17 V4LocalDatabaseManager::~V4LocalDatabaseManager() { 18 V4LocalDatabaseManager::~V4LocalDatabaseManager() {
18 DCHECK(!enabled_); 19 DCHECK(!enabled_);
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 132
132 void V4LocalDatabaseManager::CancelCheck(Client* client) { 133 void V4LocalDatabaseManager::CancelCheck(Client* client) {
133 // TODO(vakh): Implement this skeleton. 134 // TODO(vakh): Implement this skeleton.
134 DCHECK_CURRENTLY_ON(BrowserThread::IO); 135 DCHECK_CURRENTLY_ON(BrowserThread::IO);
135 DCHECK(enabled_); 136 DCHECK(enabled_);
136 } 137 }
137 138
138 void V4LocalDatabaseManager::StartOnIOThread( 139 void V4LocalDatabaseManager::StartOnIOThread(
139 net::URLRequestContextGetter* request_context_getter, 140 net::URLRequestContextGetter* request_context_getter,
140 const V4ProtocolConfig& config) { 141 const V4ProtocolConfig& config) {
141 // TODO(vakh): Implement this skeleton.
142 VLOG(1) << "V4LocalDatabaseManager starting";
143 SafeBrowsingDatabaseManager::StartOnIOThread(request_context_getter, config); 142 SafeBrowsingDatabaseManager::StartOnIOThread(request_context_getter, config);
144 143
144 #if defined(OS_WIN) || defined (OS_LINUX) || defined (OS_MACOSX)
145 // TODO(vakh): Remove this if/endif block when the V4Database is implemented.
146 // Filed as http://crbug.com/608075
147 UpdateListIdentifier update_list_identifier;
148 #if defined(OS_WIN)
149 update_list_identifier.platform_type = WINDOWS_PLATFORM;
150 #elif defined (OS_LINUX)
Nathan Parker 2016/04/30 00:16:49 I think OS_LINUX _include_ chromeos (I don't know
vakh (use Gerrit instead) 2016/04/30 00:18:37 There's no separate Enum value for ChromeOS so I t
151 update_list_identifier.platform_type = LINUX_PLATFORM;
152 #else
153 update_list_identifier.platform_type = OSX_PLATFORM;
154 #endif
155 update_list_identifier.threat_entry_type = URL_EXPRESSION;
156 update_list_identifier.threat_type = MALWARE_THREAT;
157 current_list_states_[update_list_identifier] = "";
158 #endif
159
145 V4UpdateCallback callback = base::Bind( 160 V4UpdateCallback callback = base::Bind(
146 &V4LocalDatabaseManager::UpdateRequestCompleted, base::Unretained(this)); 161 &V4LocalDatabaseManager::UpdateRequestCompleted, base::Unretained(this));
147 v4_update_protocol_manager_ = V4UpdateProtocolManager::Create( 162 v4_update_protocol_manager_ = V4UpdateProtocolManager::Create(
148 request_context_getter, config, current_list_states_, callback); 163 request_context_getter, config, current_list_states_, callback);
149 164
150 enabled_ = true; 165 enabled_ = true;
151 } 166 }
152 167
153 void V4LocalDatabaseManager::StopOnIOThread(bool shutdown) { 168 void V4LocalDatabaseManager::StopOnIOThread(bool shutdown) {
154 DCHECK_CURRENTLY_ON(BrowserThread::IO); 169 DCHECK_CURRENTLY_ON(BrowserThread::IO);
155 DVLOG(1) << "V4LocalDatabaseManager stopping";
156 170
157 // Delete the V4UpdateProtocolManager. 171 // Delete the V4UpdateProtocolManager.
158 // This cancels any in-flight update request. 172 // This cancels any in-flight update request.
159 if (v4_update_protocol_manager_.get()) { 173 if (v4_update_protocol_manager_.get()) {
160 v4_update_protocol_manager_.reset(); 174 v4_update_protocol_manager_.reset();
161 } 175 }
162 176
163 enabled_ = false; 177 enabled_ = false;
164 SafeBrowsingDatabaseManager::StopOnIOThread(shutdown); 178 SafeBrowsingDatabaseManager::StopOnIOThread(shutdown);
165 } 179 }
166 180
167 void V4LocalDatabaseManager::UpdateRequestCompleted( 181 void V4LocalDatabaseManager::UpdateRequestCompleted(
168 const std::vector<ListUpdateResponse>& responses) { 182 const std::vector<ListUpdateResponse>& responses) {
169 // TODO(vakh): Updates downloaded. Store them on disk and record new state. 183 // TODO(vakh): Updates downloaded. Store them on disk and record new state.
170 } 184 }
171 185
172 } // namespace safe_browsing 186 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « components/safe_browsing_db/BUILD.gn ('k') | components/safe_browsing_db/v4_update_protocol_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698