OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ | 5 #ifndef CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ |
6 #define CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ | 6 #define CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 NavigationID navigation_id; | 85 NavigationID navigation_id; |
86 GURL resource_url; | 86 GURL resource_url; |
87 content::ResourceType resource_type; | 87 content::ResourceType resource_type; |
88 net::RequestPriority priority; | 88 net::RequestPriority priority; |
89 | 89 |
90 // Only for responses. | 90 // Only for responses. |
91 std::string mime_type; | 91 std::string mime_type; |
92 bool was_cached; | 92 bool was_cached; |
93 GURL redirect_url; // Empty unless request was redirected to a valid url. | 93 GURL redirect_url; // Empty unless request was redirected to a valid url. |
| 94 |
| 95 // Initializes a |URLRequestSummary| from a |URLRequest| response. |
| 96 // Returns true for success. |
| 97 static bool SummarizeResponse(const net::URLRequest& request, |
| 98 URLRequestSummary* summary); |
94 }; | 99 }; |
95 | 100 |
96 ResourcePrefetchPredictor(const ResourcePrefetchPredictorConfig& config, | 101 ResourcePrefetchPredictor(const ResourcePrefetchPredictorConfig& config, |
97 Profile* profile); | 102 Profile* profile); |
98 ~ResourcePrefetchPredictor() override; | 103 ~ResourcePrefetchPredictor() override; |
99 | 104 |
100 // Thread safe. | 105 // Thread safe. |
101 static bool ShouldRecordRequest(net::URLRequest* request, | 106 static bool ShouldRecordRequest(net::URLRequest* request, |
102 content::ResourceType resource_type); | 107 content::ResourceType resource_type); |
103 static bool ShouldRecordResponse(net::URLRequest* response); | 108 static bool ShouldRecordResponse(net::URLRequest* response); |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 | 338 |
334 ScopedObserver<history::HistoryService, history::HistoryServiceObserver> | 339 ScopedObserver<history::HistoryService, history::HistoryServiceObserver> |
335 history_service_observer_; | 340 history_service_observer_; |
336 | 341 |
337 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetchPredictor); | 342 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetchPredictor); |
338 }; | 343 }; |
339 | 344 |
340 } // namespace predictors | 345 } // namespace predictors |
341 | 346 |
342 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ | 347 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ |
OLD | NEW |