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

Unified Diff: chrome/browser/prefetch/prefetch.cc

Issue 357413004: Poll CanPredictNetworkActionsIO in prefetch::IsPrefetchEnabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use correct interface. Created 6 years, 6 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/prefetch/prefetch.cc
diff --git a/chrome/browser/prefetch/prefetch.cc b/chrome/browser/prefetch/prefetch.cc
index ccf13e22a1522b185ea993ffc464afa54df85b2a..68eccc6058cc80f1f41646d716a154a938238f79 100644
--- a/chrome/browser/prefetch/prefetch.cc
+++ b/chrome/browser/prefetch/prefetch.cc
@@ -8,6 +8,7 @@
#include "base/metrics/field_trial.h"
#include "base/strings/string_util.h"
+#include "chrome/browser/net/prediction_options.h"
#include "chrome/browser/prefetch/prefetch_field_trial.h"
#include "chrome/browser/profiles/profile_io_data.h"
#include "net/base/network_change_notifier.h"
@@ -17,16 +18,12 @@ namespace prefetch {
bool IsPrefetchEnabled(content::ResourceContext* resource_context) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
- // TODO(jkarlin): Eventually tie this to a new Chrome preference to predict
- // network actions when on cellular connections. See crbug.com/370454.
- if (net::NetworkChangeNotifier::IsConnectionCellular(
- net::NetworkChangeNotifier::GetConnectionType()))
- return false;
-
ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context);
- if (io_data != NULL && io_data->network_prediction_enabled()->GetValue())
- return IsPrefetchFieldTrialEnabled();
- return false;
+
+ DCHECK(io_data);
+
+ return IsPrefetchFieldTrialEnabled() &&
+ chrome_browser_net::CanPredictNetworkActionsIO(io_data);
}
} // namespace prefetch
« 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