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

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

Issue 2371043003: Small: Start checking URLs using PVer4. Verdict not returned to client yet. (Closed)
Patch Set: feature_list file for v4. Add V4Parallel feature. Created 4 years, 2 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>
11 11
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
15 #include "components/safe_browsing_db/v4_feature_list.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 safe_browsing { 20 namespace safe_browsing {
20 21
21 namespace { 22 namespace {
22 23
23 const ThreatSeverity kLeastSeverity = 24 const ThreatSeverity kLeastSeverity =
24 std::numeric_limits<ThreatSeverity>::max(); 25 std::numeric_limits<ThreatSeverity>::max();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 : client(client), 58 : client(client),
58 client_callback_type(client_callback_type), 59 client_callback_type(client_callback_type),
59 result_threat_type(SB_THREAT_TYPE_SAFE), 60 result_threat_type(SB_THREAT_TYPE_SAFE),
60 stores_to_check(stores_to_check), 61 stores_to_check(stores_to_check),
61 url(url) { 62 url(url) {
62 DCHECK_GT(ClientCallbackType::CHECK_MAX, client_callback_type); 63 DCHECK_GT(ClientCallbackType::CHECK_MAX, client_callback_type);
63 } 64 }
64 65
65 V4LocalDatabaseManager::PendingCheck::~PendingCheck() {} 66 V4LocalDatabaseManager::PendingCheck::~PendingCheck() {}
66 67
68 // static
69 V4LocalDatabaseManager* V4LocalDatabaseManager::Create(
70 const base::FilePath& base_path) {
71 if (!V4FeatureList::IsLocalDatabaseManagerEnabled()) {
72 return nullptr;
73 }
74 return new V4LocalDatabaseManager(base_path);
75 }
76
67 V4LocalDatabaseManager::V4LocalDatabaseManager(const base::FilePath& base_path) 77 V4LocalDatabaseManager::V4LocalDatabaseManager(const base::FilePath& base_path)
68 : base_path_(base_path), enabled_(false), list_infos_(GetListInfos()) { 78 : base_path_(base_path), enabled_(false), list_infos_(GetListInfos()) {
69 DCHECK(!base_path_.empty()); 79 DCHECK(!base_path_.empty());
70 DCHECK(!list_infos_.empty()); 80 DCHECK(!list_infos_.empty());
71 81
72 DVLOG(1) << "V4LocalDatabaseManager::V4LocalDatabaseManager: " 82 DVLOG(1) << "V4LocalDatabaseManager::V4LocalDatabaseManager: "
73 << "base_path_: " << base_path_.AsUTF8Unsafe(); 83 << "base_path_: " << base_path_.AsUTF8Unsafe();
74 } 84 }
75 85
76 V4LocalDatabaseManager::~V4LocalDatabaseManager() { 86 V4LocalDatabaseManager::~V4LocalDatabaseManager() {
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 } 469 }
460 470
461 void V4LocalDatabaseManager::UpdateRequestCompleted( 471 void V4LocalDatabaseManager::UpdateRequestCompleted(
462 std::unique_ptr<ParsedServerResponse> parsed_server_response) { 472 std::unique_ptr<ParsedServerResponse> parsed_server_response) {
463 DCHECK_CURRENTLY_ON(BrowserThread::IO); 473 DCHECK_CURRENTLY_ON(BrowserThread::IO);
464 v4_database_->ApplyUpdate(std::move(parsed_server_response), 474 v4_database_->ApplyUpdate(std::move(parsed_server_response),
465 db_updated_callback_); 475 db_updated_callback_);
466 } 476 }
467 477
468 } // namespace safe_browsing 478 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698