OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/prerender/prerender_local_predictor.h" | 5 #include "chrome/browser/prerender/prerender_local_predictor.h" |
6 | 6 |
7 #include <ctype.h> | 7 #include <ctype.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "chrome/browser/safe_browsing/database_manager.h" | 32 #include "chrome/browser/safe_browsing/database_manager.h" |
33 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 33 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
34 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" | 34 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" |
35 #include "chrome/common/prefetch_messages.h" | 35 #include "chrome/common/prefetch_messages.h" |
36 #include "content/public/browser/browser_thread.h" | 36 #include "content/public/browser/browser_thread.h" |
37 #include "content/public/browser/navigation_controller.h" | 37 #include "content/public/browser/navigation_controller.h" |
38 #include "content/public/browser/navigation_entry.h" | 38 #include "content/public/browser/navigation_entry.h" |
39 #include "content/public/browser/render_frame_host.h" | 39 #include "content/public/browser/render_frame_host.h" |
40 #include "content/public/browser/render_process_host.h" | 40 #include "content/public/browser/render_process_host.h" |
41 #include "content/public/browser/web_contents.h" | 41 #include "content/public/browser/web_contents.h" |
42 #include "content/public/common/page_transition_types.h" | |
43 #include "crypto/secure_hash.h" | 42 #include "crypto/secure_hash.h" |
44 #include "grit/browser_resources.h" | 43 #include "grit/browser_resources.h" |
45 #include "net/base/escape.h" | 44 #include "net/base/escape.h" |
46 #include "net/base/load_flags.h" | 45 #include "net/base/load_flags.h" |
47 #include "net/url_request/url_fetcher.h" | 46 #include "net/url_request/url_fetcher.h" |
| 47 #include "ui/base/page_transition_types.h" |
48 #include "ui/base/resource/resource_bundle.h" | 48 #include "ui/base/resource/resource_bundle.h" |
49 #include "url/url_canon.h" | 49 #include "url/url_canon.h" |
50 | 50 |
51 using base::DictionaryValue; | 51 using base::DictionaryValue; |
52 using base::ListValue; | 52 using base::ListValue; |
53 using base::Value; | 53 using base::Value; |
54 using content::BrowserThread; | 54 using content::BrowserThread; |
55 using content::PageTransition; | 55 using ui::PageTransition; |
56 using content::RenderFrameHost; | 56 using content::RenderFrameHost; |
57 using content::SessionStorageNamespace; | 57 using content::SessionStorageNamespace; |
58 using content::WebContents; | 58 using content::WebContents; |
59 using history::URLID; | 59 using history::URLID; |
60 using net::URLFetcher; | 60 using net::URLFetcher; |
61 using predictors::LoggedInPredictorTable; | 61 using predictors::LoggedInPredictorTable; |
62 using std::string; | 62 using std::string; |
63 using std::vector; | 63 using std::vector; |
64 | 64 |
65 namespace prerender { | 65 namespace prerender { |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 const int kVisitHistoryPruneThreshold = 120 * 1000; | 242 const int kVisitHistoryPruneThreshold = 120 * 1000; |
243 const int kVisitHistoryPruneAmount = 20 * 1000; | 243 const int kVisitHistoryPruneAmount = 20 * 1000; |
244 | 244 |
245 const int kMinLocalPredictionTimeMs = 500; | 245 const int kMinLocalPredictionTimeMs = 500; |
246 | 246 |
247 int GetMaxLocalPredictionTimeMs() { | 247 int GetMaxLocalPredictionTimeMs() { |
248 return GetLocalPredictorTTLSeconds() * 1000; | 248 return GetLocalPredictorTTLSeconds() * 1000; |
249 } | 249 } |
250 | 250 |
251 bool IsBackForward(PageTransition transition) { | 251 bool IsBackForward(PageTransition transition) { |
252 return (transition & content::PAGE_TRANSITION_FORWARD_BACK) != 0; | 252 return (transition & ui::PAGE_TRANSITION_FORWARD_BACK) != 0; |
253 } | 253 } |
254 | 254 |
255 bool IsHomePage(PageTransition transition) { | 255 bool IsHomePage(PageTransition transition) { |
256 return (transition & content::PAGE_TRANSITION_HOME_PAGE) != 0; | 256 return (transition & ui::PAGE_TRANSITION_HOME_PAGE) != 0; |
257 } | 257 } |
258 | 258 |
259 bool IsIntermediateRedirect(PageTransition transition) { | 259 bool IsIntermediateRedirect(PageTransition transition) { |
260 return (transition & content::PAGE_TRANSITION_CHAIN_END) == 0; | 260 return (transition & ui::PAGE_TRANSITION_CHAIN_END) == 0; |
261 } | 261 } |
262 | 262 |
263 bool IsFormSubmit(PageTransition transition) { | 263 bool IsFormSubmit(PageTransition transition) { |
264 return PageTransitionCoreTypeIs(transition, | 264 return ui::PageTransitionCoreTypeIs(transition, |
265 content::PAGE_TRANSITION_FORM_SUBMIT); | 265 ui::PAGE_TRANSITION_FORM_SUBMIT); |
266 } | 266 } |
267 | 267 |
268 bool ShouldExcludeTransitionForPrediction(PageTransition transition) { | 268 bool ShouldExcludeTransitionForPrediction(PageTransition transition) { |
269 return IsBackForward(transition) || IsHomePage(transition) || | 269 return IsBackForward(transition) || IsHomePage(transition) || |
270 IsIntermediateRedirect(transition); | 270 IsIntermediateRedirect(transition); |
271 } | 271 } |
272 | 272 |
273 base::Time GetCurrentTime() { | 273 base::Time GetCurrentTime() { |
274 return base::Time::Now(); | 274 return base::Time::Now(); |
275 } | 275 } |
(...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1566 break; | 1566 break; |
1567 case content::SessionStorageNamespace::MERGE_RESULT_MERGEABLE: | 1567 case content::SessionStorageNamespace::MERGE_RESULT_MERGEABLE: |
1568 RecordEvent(EVENT_NAMESPACE_MISMATCH_MERGE_RESULT_MERGEABLE); | 1568 RecordEvent(EVENT_NAMESPACE_MISMATCH_MERGE_RESULT_MERGEABLE); |
1569 break; | 1569 break; |
1570 default: | 1570 default: |
1571 NOTREACHED(); | 1571 NOTREACHED(); |
1572 } | 1572 } |
1573 } | 1573 } |
1574 | 1574 |
1575 } // namespace prerender | 1575 } // namespace prerender |
OLD | NEW |