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

Unified Diff: chrome/browser/safe_browsing/protocol_manager.cc

Issue 302603008: [Android] Only update safe-browsing database on WiFi (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Take reviewer's suggestions. Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/protocol_manager.cc
diff --git a/chrome/browser/safe_browsing/protocol_manager.cc b/chrome/browser/safe_browsing/protocol_manager.cc
index 78d96ca102abcf7cb20ffa97c408eec0a222f946..2a856ec031bca0288dd25e00127e7b535ca38092 100644
--- a/chrome/browser/safe_browsing/protocol_manager.cc
+++ b/chrome/browser/safe_browsing/protocol_manager.cc
@@ -26,6 +26,10 @@
#include "net/url_request/url_request_context_getter.h"
#include "net/url_request/url_request_status.h"
+#if defined(OS_ANDROID)
+#include "net/base/network_change_notifier.h"
+#endif
+
using base::Time;
using base::TimeDelta;
@@ -197,8 +201,19 @@ void SafeBrowsingProtocolManager::GetFullHash(
void SafeBrowsingProtocolManager::GetNextUpdate() {
DCHECK(CalledOnValidThread());
- if (!request_.get() && request_type_ == NO_REQUEST)
- IssueUpdateRequest();
+ if (request_.get() || request_type_ != NO_REQUEST)
+ return;
+
+#if defined(OS_ANDROID)
+ net::NetworkChangeNotifier::ConnectionType type =
+ net::NetworkChangeNotifier::GetConnectionType();
+ if (type != net::NetworkChangeNotifier::CONNECTION_WIFI) {
+ ScheduleNextUpdate(false /* no back off */);
+ return;
+ }
+#endif
+
+ IssueUpdateRequest();
}
// net::URLFetcherDelegate implementation ----------------------------------
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698