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 "chrome/browser/net/predictor.h" | 7 #include "chrome/browser/net/predictor.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
10 #include "content/public/common/frame_navigate_params.h" | 10 #include "content/public/common/frame_navigate_params.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 : content::WebContentsObserver(web_contents) { | 35 : content::WebContentsObserver(web_contents) { |
36 } | 36 } |
37 | 37 |
38 PredictorTabHelper::~PredictorTabHelper() { | 38 PredictorTabHelper::~PredictorTabHelper() { |
39 } | 39 } |
40 | 40 |
41 void PredictorTabHelper::DidNavigateMainFrame( | 41 void PredictorTabHelper::DidNavigateMainFrame( |
42 const content::LoadCommittedDetails& details, | 42 const content::LoadCommittedDetails& details, |
43 const content::FrameNavigateParams& params) { | 43 const content::FrameNavigateParams& params) { |
44 if (!IsUserLinkNavigationRequest(params.transition) || | 44 if (!IsUserLinkNavigationRequest(params.transition) || |
45 !(params.url.SchemeIs("http") || params.url.SchemeIs("https"))) | 45 !(params.url.SchemeIsHTTPOrHTTPS())) |
46 return; | 46 return; |
47 | 47 |
48 Profile* profile = Profile::FromBrowserContext( | 48 Profile* profile = Profile::FromBrowserContext( |
49 web_contents()->GetBrowserContext()); | 49 web_contents()->GetBrowserContext()); |
50 Predictor* predictor = profile->GetNetworkPredictor(); | 50 Predictor* predictor = profile->GetNetworkPredictor(); |
51 if (predictor) { | 51 if (predictor) { |
52 BrowserThread::PostTask( | 52 BrowserThread::PostTask( |
53 BrowserThread::IO, | 53 BrowserThread::IO, |
54 FROM_HERE, | 54 FROM_HERE, |
55 base::Bind(&Predictor::RecordLinkNavigation, | 55 base::Bind(&Predictor::RecordLinkNavigation, |
56 base::Unretained(predictor), | 56 base::Unretained(predictor), |
57 params.url)); | 57 params.url)); |
58 } | 58 } |
59 } | 59 } |
60 | 60 |
61 } // namespace chrome_browser_net | 61 } // namespace chrome_browser_net |
OLD | NEW |