| OLD | NEW |
| 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 #ifndef COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_ | 5 #ifndef COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_ |
| 6 #define COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_ | 6 #define COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_ |
| 7 | 7 |
| 8 // A class that provides the interface between the SafeBrowsing protocol manager | 8 // A class that provides the interface between the SafeBrowsing protocol manager |
| 9 // and database that holds the downloaded updates. | 9 // and database that holds the downloaded updates. |
| 10 | 10 |
| 11 #include <memory> | 11 #include <memory> |
| 12 | 12 |
| 13 #include "components/safe_browsing_db/database_manager.h" | 13 #include "components/safe_browsing_db/database_manager.h" |
| 14 #include "components/safe_browsing_db/hit_report.h" | 14 #include "components/safe_browsing_db/hit_report.h" |
| 15 #include "components/safe_browsing_db/v4_database.h" | 15 #include "components/safe_browsing_db/v4_database.h" |
| 16 #include "components/safe_browsing_db/v4_get_hash_protocol_manager.h" |
| 16 #include "components/safe_browsing_db/v4_protocol_manager_util.h" | 17 #include "components/safe_browsing_db/v4_protocol_manager_util.h" |
| 17 #include "components/safe_browsing_db/v4_update_protocol_manager.h" | 18 #include "components/safe_browsing_db/v4_update_protocol_manager.h" |
| 18 #include "url/gurl.h" | 19 #include "url/gurl.h" |
| 19 | 20 |
| 20 using content::ResourceType; | 21 using content::ResourceType; |
| 21 | 22 |
| 22 namespace safe_browsing { | 23 namespace safe_browsing { |
| 23 | 24 |
| 24 // Manages the local, on-disk database of updates downloaded from the | 25 // Manages the local, on-disk database of updates downloaded from the |
| 25 // SafeBrowsing service and interfaces with the protocol manager. | 26 // SafeBrowsing service and interfaces with the protocol manager. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 // successfully. | 71 // successfully. |
| 71 void UpdateRequestCompleted( | 72 void UpdateRequestCompleted( |
| 72 std::unique_ptr<ParsedServerResponse> parsed_server_response); | 73 std::unique_ptr<ParsedServerResponse> parsed_server_response); |
| 73 | 74 |
| 74 void SetupUpdateProtocolManager( | 75 void SetupUpdateProtocolManager( |
| 75 net::URLRequestContextGetter* request_context_getter, | 76 net::URLRequestContextGetter* request_context_getter, |
| 76 const V4ProtocolConfig& config); | 77 const V4ProtocolConfig& config); |
| 77 | 78 |
| 78 void SetupDatabase(); | 79 void SetupDatabase(); |
| 79 | 80 |
| 81 void OnFullHashResponse(const std::vector<FullHashInfo>& full_hash_infos); |
| 82 |
| 80 void DatabaseReady(std::unique_ptr<V4Database> v4_database); | 83 void DatabaseReady(std::unique_ptr<V4Database> v4_database); |
| 81 | 84 |
| 82 // Called when the database has been updated and schedules the next update. | 85 // Called when the database has been updated and schedules the next update. |
| 83 void DatabaseUpdated(); | 86 void DatabaseUpdated(); |
| 84 | 87 |
| 85 // The base directory under which to create the files that contain hashes. | 88 // The base directory under which to create the files that contain hashes. |
| 86 const base::FilePath base_path_; | 89 const base::FilePath base_path_; |
| 87 | 90 |
| 88 // Whether the service is running. | 91 // Whether the service is running. |
| 89 bool enabled_; | 92 bool enabled_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 108 // The sequenced task runner for running safe browsing database operations. | 111 // The sequenced task runner for running safe browsing database operations. |
| 109 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 112 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
| 110 | 113 |
| 111 friend class base::RefCountedThreadSafe<V4LocalDatabaseManager>; | 114 friend class base::RefCountedThreadSafe<V4LocalDatabaseManager>; |
| 112 DISALLOW_COPY_AND_ASSIGN(V4LocalDatabaseManager); | 115 DISALLOW_COPY_AND_ASSIGN(V4LocalDatabaseManager); |
| 113 }; // class V4LocalDatabaseManager | 116 }; // class V4LocalDatabaseManager |
| 114 | 117 |
| 115 } // namespace safe_browsing | 118 } // namespace safe_browsing |
| 116 | 119 |
| 117 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_ | 120 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_LOCAL_DATABASE_MANAGER_H_ |
| OLD | NEW |