| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 #include "chrome/browser/net/predictor_tab_helper.h" | 5 #include "chrome/browser/net/predictor_tab_helper.h" |
| 6 | 6 |
| 7 #include "base/feature_list.h" | 7 #include "base/feature_list.h" |
| 8 #include "chrome/browser/chromeos/profiles/profile_helper.h" | |
| 9 #include "chrome/browser/net/predictor.h" | 8 #include "chrome/browser/net/predictor.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
| 12 #include "content/public/browser/navigation_handle.h" | 11 #include "content/public/browser/navigation_handle.h" |
| 13 #include "content/public/common/browser_side_navigation_policy.h" | 12 #include "content/public/common/browser_side_navigation_policy.h" |
| 14 | 13 |
| 14 #if defined(OS_CHROMEOS) |
| 15 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 16 #endif // defined(OS_CHROMEOS) |
| 17 |
| 15 DEFINE_WEB_CONTENTS_USER_DATA_KEY(chrome_browser_net::PredictorTabHelper); | 18 DEFINE_WEB_CONTENTS_USER_DATA_KEY(chrome_browser_net::PredictorTabHelper); |
| 16 | 19 |
| 17 namespace chrome_browser_net { | 20 namespace chrome_browser_net { |
| 18 | 21 |
| 19 namespace { | 22 namespace { |
| 20 | 23 |
| 21 // Triggers the preconnector on renderer-initiated navigations. This captures | 24 // Triggers the preconnector on renderer-initiated navigations. This captures |
| 22 // more navigations. | 25 // more navigations. |
| 23 const base::Feature kPreconnectMore{"PreconnectMore", | 26 const base::Feature kPreconnectMore{"PreconnectMore", |
| 24 base::FEATURE_DISABLED_BY_DEFAULT}; | 27 base::FEATURE_DISABLED_BY_DEFAULT}; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 79 |
| 77 void PredictorTabHelper::PreconnectUrl(const GURL& url) { | 80 void PredictorTabHelper::PreconnectUrl(const GURL& url) { |
| 78 Profile* profile = | 81 Profile* profile = |
| 79 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | 82 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
| 80 Predictor* predictor(profile->GetNetworkPredictor()); | 83 Predictor* predictor(profile->GetNetworkPredictor()); |
| 81 if (predictor && url.SchemeIsHTTPOrHTTPS()) | 84 if (predictor && url.SchemeIsHTTPOrHTTPS()) |
| 82 predictor->PreconnectUrlAndSubresources(url, GURL()); | 85 predictor->PreconnectUrlAndSubresources(url, GURL()); |
| 83 } | 86 } |
| 84 | 87 |
| 85 } // namespace chrome_browser_net | 88 } // namespace chrome_browser_net |
| OLD | NEW |