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

Unified Diff: chrome/browser/safe_browsing/local_database_manager.h

Issue 1848973004: Makes V4UpdateProtocolManager auto-schedule update fetching (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@v4_01_
Patch Set: formatting and removed ClearCurrentListStates from test Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/local_database_manager.h
diff --git a/chrome/browser/safe_browsing/local_database_manager.h b/chrome/browser/safe_browsing/local_database_manager.h
index 4891d6cf4076af157ae5941ef4fb45258c34a218..3cec17441d2a12312fc09d3c5bae8e9745fc1b15 100644
--- a/chrome/browser/safe_browsing/local_database_manager.h
+++ b/chrome/browser/safe_browsing/local_database_manager.h
@@ -28,7 +28,10 @@
#include "chrome/browser/safe_browsing/protocol_manager.h"
#include "chrome/browser/safe_browsing/safe_browsing_util.h"
#include "components/safe_browsing_db/database_manager.h"
+#include "components/safe_browsing_db/safebrowsing.pb.h"
#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing_db/v4_protocol_manager_util.h"
+#include "components/safe_browsing_db/v4_update_protocol_manager.h"
#include "url/gurl.h"
namespace net {
@@ -82,7 +85,7 @@ class LocalSafeBrowsingDatabaseManager
bool is_extended_reporting;
bool need_get_hash;
base::TimeTicks start; // When check was sent to SB service.
- ListType check_type; // See comment in constructor.
+ ListType check_type; // See comment in constructor.
std::vector<SBThreatType> expected_threats;
std::vector<SBPrefix> prefix_hits;
std::vector<SBFullHashResult> cache_hits;
@@ -131,9 +134,8 @@ class LocalSafeBrowsingDatabaseManager
bool IsMalwareKillSwitchOn() override;
bool IsCsdWhitelistKillSwitchOn() override;
void CancelCheck(Client* client) override;
- void StartOnIOThread(
- net::URLRequestContextGetter* request_context_getter,
- const V4ProtocolConfig& config) override;
+ void StartOnIOThread(net::URLRequestContextGetter* request_context_getter,
+ const V4ProtocolConfig& config) override;
void StopOnIOThread(bool shutdown) override;
bool download_protection_enabled() const override;
@@ -155,8 +157,7 @@ class LocalSafeBrowsingDatabaseManager
friend class SafeBrowsingServiceTest;
friend class SafeBrowsingServiceTestHelper;
friend class LocalDatabaseManagerTest;
- FRIEND_TEST_ALL_PREFIXES(LocalDatabaseManagerTest,
- GetUrlSeverestThreatType);
+ FRIEND_TEST_ALL_PREFIXES(LocalDatabaseManagerTest, GetUrlSeverestThreatType);
FRIEND_TEST_ALL_PREFIXES(LocalDatabaseManagerTest,
ServiceStopWithPendingChecks);
@@ -194,6 +195,11 @@ class LocalSafeBrowsingDatabaseManager
const std::vector<SBFullHashResult>& full_hashes,
size_t* index);
+ // Return whether we are running headless, i.e. on a bot.
+ static bool IsRunningHeadless();
+
+ void UpdateRequestCompleted(const std::vector<ListUpdateResponse>& responses);
+
// Called to stop operations on the io_thread. This may be called multiple
// times during the life of the DatabaseManager. Should be called on IO
// thread.
@@ -256,7 +262,7 @@ class LocalSafeBrowsingDatabaseManager
AddChunksCallback callback);
void DeleteDatabaseChunks(
- scoped_ptr<std::vector<SBChunkDelete> > chunk_deletes);
+ scoped_ptr<std::vector<SBChunkDelete>> chunk_deletes);
void NotifyClientBlockingComplete(Client* client, bool proceed);
@@ -380,6 +386,13 @@ class LocalSafeBrowsingDatabaseManager
// Timeout to use for safe browsing checks.
base::TimeDelta check_timeout_;
+ // Stores the current status of the lists to download from the SafeBrowsing
+ // servers.
+ base::hash_map<UpdateListIdentifier, std::string> current_list_states_;
Nathan Parker 2016/04/01 01:04:52 Do you want this in the local_database_manager, or
vakh (use Gerrit instead) 2016/04/01 02:29:09 I want to keep this CL small so I don't want to cr
Nathan Parker 2016/04/01 17:56:58 Sure, though it's probably better to not add it to
vakh (use Gerrit instead) 2016/04/01 19:35:48 Good point. Removed. Will add it in the V4DBManage
+
+ // The protocol manager that downloads the hash prefix updates.
+ scoped_ptr<V4UpdateProtocolManager> v4_update_protocol_manager_;
+
DISALLOW_COPY_AND_ASSIGN(LocalSafeBrowsingDatabaseManager);
}; // class LocalSafeBrowsingDatabaseManager
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/local_database_manager.cc » ('j') | components/safe_browsing_db/database_manager.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698