Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Side by Side Diff: chrome/browser/predictors/resource_prefetch_predictor.cc

Issue 23658056: content: Move kHttpScheme constant into content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/predictors/resource_prefetch_predictor.h" 5 #include "chrome/browser/predictors/resource_prefetch_predictor.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 content::ResourceRequestInfo::ForRequest(response); 171 content::ResourceRequestInfo::ForRequest(response);
172 if (!request_info) 172 if (!request_info)
173 return false; 173 return false;
174 174
175 return request_info->GetResourceType() == ResourceType::MAIN_FRAME && 175 return request_info->GetResourceType() == ResourceType::MAIN_FRAME &&
176 IsHandledMainPage(response); 176 IsHandledMainPage(response);
177 } 177 }
178 178
179 // static 179 // static
180 bool ResourcePrefetchPredictor::IsHandledMainPage(net::URLRequest* request) { 180 bool ResourcePrefetchPredictor::IsHandledMainPage(net::URLRequest* request) {
181 return request->original_url().scheme() == chrome::kHttpScheme; 181 return request->original_url().scheme() == content::kHttpScheme;
182 } 182 }
183 183
184 // static 184 // static
185 bool ResourcePrefetchPredictor::IsHandledSubresource( 185 bool ResourcePrefetchPredictor::IsHandledSubresource(
186 net::URLRequest* response) { 186 net::URLRequest* response) {
187 int resource_status = 0; 187 int resource_status = 0;
188 if (response->first_party_for_cookies().scheme() != chrome::kHttpScheme) 188 if (response->first_party_for_cookies().scheme() != content::kHttpScheme)
189 resource_status |= RESOURCE_STATUS_NOT_HTTP_PAGE; 189 resource_status |= RESOURCE_STATUS_NOT_HTTP_PAGE;
190 190
191 if (response->original_url().scheme() != chrome::kHttpScheme) 191 if (response->original_url().scheme() != content::kHttpScheme)
192 resource_status |= RESOURCE_STATUS_NOT_HTTP_RESOURCE; 192 resource_status |= RESOURCE_STATUS_NOT_HTTP_RESOURCE;
193 193
194 std::string mime_type; 194 std::string mime_type;
195 response->GetMimeType(&mime_type); 195 response->GetMimeType(&mime_type);
196 if (!mime_type.empty() && 196 if (!mime_type.empty() &&
197 !net::IsSupportedImageMimeType(mime_type.c_str()) && 197 !net::IsSupportedImageMimeType(mime_type.c_str()) &&
198 !net::IsSupportedJavascriptMimeType(mime_type.c_str()) && 198 !net::IsSupportedJavascriptMimeType(mime_type.c_str()) &&
199 !net::MatchesMimeType("text/css", mime_type)) { 199 !net::MatchesMimeType("text/css", mime_type)) {
200 resource_status |= RESOURCE_STATUS_UNSUPPORTED_MIME_TYPE; 200 resource_status |= RESOURCE_STATUS_UNSUPPORTED_MIME_TYPE;
201 } 201 }
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 RPP_PREDICTED_HISTOGRAM_PERCENTAGE( 1239 RPP_PREDICTED_HISTOGRAM_PERCENTAGE(
1240 "PrefetchFromNetworkPercentOfTotalFromNetwork", 1240 "PrefetchFromNetworkPercentOfTotalFromNetwork",
1241 prefetch_network * 100.0 / total_resources_fetched_from_network); 1241 prefetch_network * 100.0 / total_resources_fetched_from_network);
1242 } 1242 }
1243 1243
1244 #undef RPP_PREDICTED_HISTOGRAM_PERCENTAGE 1244 #undef RPP_PREDICTED_HISTOGRAM_PERCENTAGE
1245 #undef RPP_PREDICTED_HISTOGRAM_COUNTS 1245 #undef RPP_PREDICTED_HISTOGRAM_COUNTS
1246 } 1246 }
1247 1247
1248 } // namespace predictors 1248 } // namespace predictors
OLDNEW
« no previous file with comments | « chrome/browser/history/visit_database.cc ('k') | chrome/browser/prerender/prerender_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698