Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / net / predictor_tab_helper.cc
bloba6f59ba2f947eb775eec68ea6fe52e6d787ea772
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/net/predictor_tab_helper.h"
7 #include "base/command_line.h"
8 #include "chrome/browser/net/predictor.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/common/chrome_switches.h"
11 #include "chrome/common/url_constants.h"
13 DEFINE_WEB_CONTENTS_USER_DATA_KEY(chrome_browser_net::PredictorTabHelper);
15 namespace chrome_browser_net {
17 PredictorTabHelper::PredictorTabHelper(content::WebContents* web_contents)
18 : content::WebContentsObserver(web_contents) {
21 PredictorTabHelper::~PredictorTabHelper() {
24 void PredictorTabHelper::DidStartNavigationToPendingEntry(
25 const GURL& url,
26 content::NavigationController::ReloadType reload_type) {
27 Profile* profile =
28 Profile::FromBrowserContext(web_contents()->GetBrowserContext());
29 chrome_browser_net::Predictor* predictor = profile->GetNetworkPredictor();
30 if (!predictor)
31 return;
32 if (url.SchemeIs(url::kHttpScheme) || url.SchemeIs(url::kHttpsScheme))
33 predictor->PreconnectUrlAndSubresources(url, GURL());
36 } // namespace chrome_browser_net