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

Unified Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 425653002: content: ResourceType cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: REBASE Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/loader/resource_dispatcher_host_impl.cc
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc
index b132d953bb919bd126d1f52aa5e0a89e4a83ba11..b72e96a24852a7b0015eaf1b8e14e3a74a2e0689 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.cc
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -136,10 +136,10 @@ const double kMaxRequestsPerProcessRatio = 0.45;
// same resource (see bugs 46104 and 31014).
const int kDefaultDetachableCancelDelayMs = 30000;
-bool IsDetachableResourceType(ResourceType::Type type) {
+bool IsDetachableResourceType(ResourceType type) {
switch (type) {
- case ResourceType::PREFETCH:
- case ResourceType::PING:
+ case RESOURCE_TYPE_PREFETCH:
+ case RESOURCE_TYPE_PING:
return true;
default:
return false;
@@ -677,7 +677,7 @@ bool ResourceDispatcherHostImpl::HandleExternalProtocol(ResourceLoader* loader,
ResourceRequestInfoImpl* info = loader->GetRequestInfo();
- if (!ResourceType::IsFrame(info->GetResourceType()))
+ if (!IsResourceTypeFrame(info->GetResourceType()))
return false;
const net::URLRequestJobFactory* job_factory =
@@ -747,7 +747,7 @@ void ResourceDispatcherHostImpl::DidFinishLoading(ResourceLoader* loader) {
ResourceRequestInfo* info = loader->GetRequestInfo();
// Record final result of all resource loads.
- if (info->GetResourceType() == ResourceType::MAIN_FRAME) {
+ if (info->GetResourceType() == RESOURCE_TYPE_MAIN_FRAME) {
// This enumeration has "3" appended to its name to distinguish it from
// older versions.
UMA_HISTOGRAM_SPARSE_SLOWLY(
@@ -768,7 +768,7 @@ void ResourceDispatcherHostImpl::DidFinishLoading(ResourceLoader* loader) {
"Net.CertificateTransparency.MainFrameValidSCTCount", num_valid_scts);
}
} else {
- if (info->GetResourceType() == ResourceType::IMAGE) {
+ if (info->GetResourceType() == RESOURCE_TYPE_IMAGE) {
UMA_HISTOGRAM_SPARSE_SLOWLY(
"Net.ErrorCodesForImages",
-loader->request()->status().error());
@@ -1064,7 +1064,7 @@ void ResourceDispatcherHostImpl::BeginRequest(
}
bool allow_download = request_data.allow_download &&
- ResourceType::IsFrame(request_data.resource_type);
+ IsResourceTypeFrame(request_data.resource_type);
// Make extra info and read footer (contains request ID).
ResourceRequestInfoImpl* extra_info =
@@ -1167,12 +1167,12 @@ scoped_ptr<ResourceHandler> ResourceDispatcherHostImpl::CreateResourceHandler(
// let us check whether a transfer is required and pause for the unload
// handler either if so or if a cross-process navigation is already under way.
bool is_swappable_navigation =
- request_data.resource_type == ResourceType::MAIN_FRAME;
+ request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME;
// If we are using --site-per-process, install it for subframes as well.
if (!is_swappable_navigation &&
CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess)) {
is_swappable_navigation =
- request_data.resource_type == ResourceType::SUB_FRAME;
+ request_data.resource_type == RESOURCE_TYPE_SUB_FRAME;
}
if (is_swappable_navigation && process_type == PROCESS_TYPE_RENDERER)
handler.reset(new CrossSiteResourceHandler(handler.Pass(), request));
@@ -1298,7 +1298,7 @@ ResourceRequestInfoImpl* ResourceDispatcherHostImpl::CreateRequestInfo(
false, // is_main_frame
false, // parent_is_main_frame
-1, // parent_render_frame_id
- ResourceType::SUB_RESOURCE,
+ RESOURCE_TYPE_SUB_RESOURCE,
PAGE_TRANSITION_LINK,
false, // should_replace_current_entry
download, // is_download
@@ -1942,15 +1942,15 @@ int ResourceDispatcherHostImpl::BuildLoadFlagsForRequest(
// keep-alive connection created to load a sub-frame or a sub-resource could
// be reused to load a main frame.
load_flags |= net::LOAD_VERIFY_EV_CERT;
- if (request_data.resource_type == ResourceType::MAIN_FRAME) {
+ if (request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME) {
load_flags |= net::LOAD_MAIN_FRAME;
- } else if (request_data.resource_type == ResourceType::SUB_FRAME) {
+ } else if (request_data.resource_type == RESOURCE_TYPE_SUB_FRAME) {
load_flags |= net::LOAD_SUB_FRAME;
- } else if (request_data.resource_type == ResourceType::PREFETCH) {
+ } else if (request_data.resource_type == RESOURCE_TYPE_PREFETCH) {
load_flags |= (net::LOAD_PREFETCH | net::LOAD_DO_NOT_PROMPT_FOR_LOGIN);
- } else if (request_data.resource_type == ResourceType::FAVICON) {
+ } else if (request_data.resource_type == RESOURCE_TYPE_FAVICON) {
load_flags |= net::LOAD_DO_NOT_PROMPT_FOR_LOGIN;
- } else if (request_data.resource_type == ResourceType::IMAGE) {
+ } else if (request_data.resource_type == RESOURCE_TYPE_IMAGE) {
// Prevent third-party image content from prompting for login, as this
// is often a scam to extract credentials for another domain from the user.
// Only block image loads, as the attack applies largely to the "src"
@@ -1988,7 +1988,7 @@ int ResourceDispatcherHostImpl::BuildLoadFlagsForRequest(
// Add a flag to selectively bypass the data reduction proxy if the resource
// type is not an image.
- if (request_data.resource_type != ResourceType::IMAGE)
+ if (request_data.resource_type != RESOURCE_TYPE_IMAGE)
load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY;
return load_flags;
« no previous file with comments | « content/browser/loader/cross_site_resource_handler.cc ('k') | content/browser/loader/resource_dispatcher_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698