summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-31 00:59:40 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-31 00:59:40 +0000
commit6c1e05217fb089245b77e39fd6a46f26c4b85e54 (patch)
tree770ce08ff82343a522b92e37558faa1aff8e4804
parent1ecda815adaacdc68dc7769c1f34d5182799abc4 (diff)
downloadchromium_src-6c1e05217fb089245b77e39fd6a46f26c4b85e54.zip
chromium_src-6c1e05217fb089245b77e39fd6a46f26c4b85e54.tar.gz
chromium_src-6c1e05217fb089245b77e39fd6a46f26c4b85e54.tar.bz2
content: ResourceType cleanup.
0) Converted the ResourceType::Type enum to ResourceType enum in content namespace, like this: enum ResourceType { RESOURCE_TYPE_MAIN_FRAME = 0, //... RESOURCE_TYPE_SUB_FRAME, // ... RESOURCE_TYPE_STYLESHEET, // ... . . . }; 1) FromWebURLRequest() is is only called from within content (child & renderer), moved into content/child/web_url_request_util.* and renamed to WebURLRequestToResourceType(). 2) ValidType/FromInt/IsSubresource aren't called from anywhere. Removed. 3) IsSharedWorker/IsServiceWorker are not necessary, they're just an enum comparison and are only called in 5 places. Removed them and just the if check directly. -IsFrame is called in a number of places. Leave it in this header as a function. Since it's not scoped in a class anymore, it needs a more descriptive name. Renamed to IsResourceTypeFrame(). BUG=None TEST=None R=jam@chromium.org TBR=darin@chromium # trivial changes all around src/ Review URL: https://codereview.chromium.org/425653002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@286665 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--android_webview/browser/aw_content_browser_client.cc2
-rw-r--r--android_webview/browser/aw_content_browser_client.h2
-rw-r--r--android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc12
-rw-r--r--android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.h2
-rw-r--r--android_webview/native/aw_contents_io_thread_client_impl.cc2
-rw-r--r--chrome/browser/captive_portal/captive_portal_tab_helper.cc4
-rw-r--r--chrome/browser/captive_portal/captive_portal_tab_helper.h2
-rw-r--r--chrome/browser/captive_portal/captive_portal_tab_helper_unittest.cc15
-rw-r--r--chrome/browser/chrome_content_browser_client.cc4
-rw-r--r--chrome/browser/chrome_content_browser_client.h2
-rw-r--r--chrome/browser/chromeos/login/signin/merge_session_throttle.cc8
-rw-r--r--chrome/browser/chromeos/login/signin/merge_session_throttle.h10
-rw-r--r--chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute.cc6
-rw-r--r--chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute.h4
-rw-r--r--chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc18
-rw-r--r--chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_unittest.cc24
-rw-r--r--chrome/browser/extensions/api/web_navigation/web_navigation_api.cc4
-rw-r--r--chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc4
-rw-r--r--chrome/browser/extensions/api/web_request/web_request_api.cc21
-rw-r--r--chrome/browser/extensions/api/web_request/web_request_api.h4
-rw-r--r--chrome/browser/extensions/api/web_request/web_request_api_helpers.cc30
-rw-r--r--chrome/browser/extensions/api/web_request/web_request_api_helpers.h8
-rw-r--r--chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc20
-rw-r--r--chrome/browser/extensions/url_request_util.cc2
-rw-r--r--chrome/browser/extensions/user_script_listener.cc8
-rw-r--r--chrome/browser/extensions/user_script_listener.h4
-rw-r--r--chrome/browser/extensions/user_script_listener_unittest.cc6
-rw-r--r--chrome/browser/guest_view/web_view/web_view_guest.cc4
-rw-r--r--chrome/browser/net/chrome_network_delegate.cc4
-rw-r--r--chrome/browser/prerender/prerender_contents.cc2
-rw-r--r--chrome/browser/prerender/prerender_pending_swap_throttle.cc2
-rw-r--r--chrome/browser/prerender/prerender_resource_throttle.cc8
-rw-r--r--chrome/browser/prerender/prerender_resource_throttle.h4
-rw-r--r--chrome/browser/prerender/prerender_tracker_unittest.cc29
-rw-r--r--chrome/browser/prerender/prerender_util.cc4
-rw-r--r--chrome/browser/prerender/prerender_util.h2
-rw-r--r--chrome/browser/prerender/prerender_util_unittest.cc17
-rw-r--r--chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc30
-rw-r--r--chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.h6
-rw-r--r--chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate_browsertest.cc2
-rw-r--r--chrome/browser/safe_browsing/browser_feature_extractor.cc2
-rw-r--r--chrome/browser/safe_browsing/browser_feature_extractor.h4
-rw-r--r--chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc16
-rw-r--r--chrome/browser/safe_browsing/client_side_detection_host.cc11
-rw-r--r--chrome/browser/safe_browsing/client_side_detection_host.h2
-rw-r--r--chrome/browser/safe_browsing/client_side_detection_host_unittest.cc15
-rw-r--r--chrome/browser/search/iframe_source_unittest.cc15
-rw-r--r--chrome/renderer/chrome_render_process_observer.cc2
-rw-r--r--chrome/renderer/security_filter_peer.cc4
-rw-r--r--chrome/renderer/security_filter_peer.h2
-rw-r--r--chromecast/shell/browser/cast_content_browser_client.cc2
-rw-r--r--chromecast/shell/browser/cast_content_browser_client.h2
-rw-r--r--components/navigation_interception/intercept_navigation_resource_throttle_unittest.cc2
-rw-r--r--content/browser/appcache/appcache_host.cc2
-rw-r--r--content/browser/appcache/appcache_host.h3
-rw-r--r--content/browser/appcache/appcache_interceptor.cc11
-rw-r--r--content/browser/appcache/appcache_interceptor.h2
-rw-r--r--content/browser/appcache/appcache_request_handler.cc28
-rw-r--r--content/browser/appcache/appcache_request_handler.h10
-rw-r--r--content/browser/appcache/appcache_request_handler_unittest.cc44
-rw-r--r--content/browser/appcache/appcache_storage_impl_unittest.cc2
-rw-r--r--content/browser/child_process_security_policy_impl.cc9
-rw-r--r--content/browser/child_process_security_policy_impl.h2
-rw-r--r--content/browser/cross_site_transfer_browsertest.cc2
-rw-r--r--content/browser/loader/async_resource_handler.cc2
-rw-r--r--content/browser/loader/cross_site_resource_handler.cc2
-rw-r--r--content/browser/loader/resource_dispatcher_host_impl.cc32
-rw-r--r--content/browser/loader/resource_dispatcher_host_unittest.cc120
-rw-r--r--content/browser/loader/resource_loader.cc4
-rw-r--r--content/browser/loader/resource_loader_unittest.cc2
-rw-r--r--content/browser/loader/resource_message_filter.h3
-rw-r--r--content/browser/loader/resource_request_info_impl.cc21
-rw-r--r--content/browser/loader/resource_request_info_impl.h6
-rw-r--r--content/browser/loader/resource_scheduler_unittest.cc2
-rw-r--r--content/browser/renderer_host/render_process_host_impl.cc8
-rw-r--r--content/browser/renderer_host/socket_stream_dispatcher_host.cc4
-rw-r--r--content/browser/renderer_host/socket_stream_dispatcher_host.h2
-rw-r--r--content/browser/renderer_host/websocket_host.cc2
-rw-r--r--content/browser/service_worker/service_worker_context_request_handler.cc6
-rw-r--r--content/browser/service_worker/service_worker_context_request_handler.h2
-rw-r--r--content/browser/service_worker/service_worker_controllee_request_handler.cc2
-rw-r--r--content/browser/service_worker/service_worker_controllee_request_handler.h2
-rw-r--r--content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc2
-rw-r--r--content/browser/service_worker/service_worker_provider_host.cc2
-rw-r--r--content/browser/service_worker/service_worker_provider_host.h2
-rw-r--r--content/browser/service_worker/service_worker_request_handler.cc4
-rw-r--r--content/browser/service_worker/service_worker_request_handler.h6
-rw-r--r--content/browser/service_worker/service_worker_utils.h13
-rw-r--r--content/browser/service_worker/service_worker_write_to_cache_job.cc4
-rw-r--r--content/browser/service_worker/service_worker_write_to_cache_job.h4
-rw-r--r--content/browser/ssl/ssl_cert_error_handler.cc8
-rw-r--r--content/browser/ssl/ssl_cert_error_handler.h2
-rw-r--r--content/browser/ssl/ssl_error_handler.cc2
-rw-r--r--content/browser/ssl/ssl_error_handler.h6
-rw-r--r--content/browser/ssl/ssl_manager.cc4
-rw-r--r--content/browser/ssl/ssl_manager.h2
-rw-r--r--content/browser/ssl/ssl_request_info.cc2
-rw-r--r--content/browser/ssl/ssl_request_info.h6
-rw-r--r--content/browser/transition_browsertest.cc2
-rw-r--r--content/browser/web_contents/web_contents_impl.cc4
-rw-r--r--content/browser/web_contents/web_contents_impl.h2
-rw-r--r--content/child/npapi/plugin_url_fetcher.cc2
-rw-r--r--content/child/request_info.cc2
-rw-r--r--content/child/request_info.h2
-rw-r--r--content/child/resource_dispatcher.cc6
-rw-r--r--content/child/resource_dispatcher.h7
-rw-r--r--content/child/resource_dispatcher_unittest.cc2
-rw-r--r--content/child/site_isolation_policy.cc6
-rw-r--r--content/child/site_isolation_policy.h8
-rw-r--r--content/child/web_url_loader_impl.cc3
-rw-r--r--content/child/web_url_request_util.cc120
-rw-r--r--content/child/web_url_request_util.h22
-rw-r--r--content/common/content_param_traits_macros.h4
-rw-r--r--content/common/resource_messages.h2
-rw-r--r--content/common/view_messages.h2
-rw-r--r--content/content_child.gypi2
-rw-r--r--content/public/browser/content_browser_client.h21
-rw-r--r--content/public/browser/load_from_memory_cache_details.cc2
-rw-r--r--content/public/browser/load_from_memory_cache_details.h4
-rw-r--r--content/public/browser/resource_dispatcher_host_delegate.cc4
-rw-r--r--content/public/browser/resource_dispatcher_host_delegate.h84
-rw-r--r--content/public/browser/resource_request_details.h2
-rw-r--r--content/public/browser/resource_request_info.h17
-rw-r--r--content/public/child/resource_dispatcher_delegate.h16
-rw-r--r--content/public/common/resource_type.cc112
-rw-r--r--content/public/common/resource_type.h85
-rw-r--r--content/renderer/render_frame_impl.cc3
-rw-r--r--extensions/browser/extension_protocols.cc2
-rw-r--r--extensions/browser/extension_protocols_unittest.cc18
129 files changed, 725 insertions, 670 deletions
diff --git a/android_webview/browser/aw_content_browser_client.cc b/android_webview/browser/aw_content_browser_client.cc
index 44a8bc7..000a09b 100644
--- a/android_webview/browser/aw_content_browser_client.cc
+++ b/android_webview/browser/aw_content_browser_client.cc
@@ -361,7 +361,7 @@ void AwContentBrowserClient::AllowCertificateError(
int cert_error,
const net::SSLInfo& ssl_info,
const GURL& request_url,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
bool overridable,
bool strict_enforcement,
const base::Callback<void(bool)>& callback,
diff --git a/android_webview/browser/aw_content_browser_client.h b/android_webview/browser/aw_content_browser_client.h
index 21d954b..d6b9ec5 100644
--- a/android_webview/browser/aw_content_browser_client.h
+++ b/android_webview/browser/aw_content_browser_client.h
@@ -97,7 +97,7 @@ class AwContentBrowserClient : public content::ContentBrowserClient {
int cert_error,
const net::SSLInfo& ssl_info,
const GURL& request_url,
- content::ResourceType::Type resource_type,
+ content::ResourceType resource_type,
bool overridable,
bool strict_enforcement,
const base::Callback<void(bool)>& callback,
diff --git a/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc
index 981acf5..f55b36a 100644
--- a/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc
+++ b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc
@@ -211,7 +211,7 @@ void AwResourceDispatcherHostDelegate::RequestBeginning(
net::URLRequest* request,
content::ResourceContext* resource_context,
content::AppCacheService* appcache_service,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
int child_id,
int route_id,
ScopedVector<content::ResourceThrottle>* throttles) {
@@ -232,7 +232,7 @@ void AwResourceDispatcherHostDelegate::RequestBeginning(
// We allow intercepting only navigations within main frames. This
// is used to post onPageStarted. We handle shouldOverrideUrlLoading
// via a sync IPC.
- if (resource_type == ResourceType::MAIN_FRAME)
+ if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME)
throttles->push_back(InterceptNavigationDelegate::CreateThrottleFor(
request));
}
@@ -321,7 +321,7 @@ void AwResourceDispatcherHostDelegate::OnResponseStarted(
return;
}
- if (request_info->GetResourceType() == ResourceType::MAIN_FRAME) {
+ if (request_info->GetResourceType() == content::RESOURCE_TYPE_MAIN_FRAME) {
// Check for x-auto-login header.
auto_login_parser::HeaderData header_data;
if (auto_login_parser::ParserHeaderInResponse(
@@ -403,8 +403,10 @@ void AwResourceDispatcherHostDelegate::AddExtraHeadersIfNeeded(
content::ResourceContext* resource_context) {
const content::ResourceRequestInfo* request_info =
content::ResourceRequestInfo::ForRequest(request);
- if (!request_info) return;
- if (request_info->GetResourceType() != ResourceType::MAIN_FRAME) return;
+ if (!request_info)
+ return;
+ if (request_info->GetResourceType() != content::RESOURCE_TYPE_MAIN_FRAME)
+ return;
const content::PageTransition transition = request_info->GetPageTransition();
const bool is_load_url =
diff --git a/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.h b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.h
index 40a05e9..2723c4f 100644
--- a/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.h
+++ b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.h
@@ -33,7 +33,7 @@ class AwResourceDispatcherHostDelegate
net::URLRequest* request,
content::ResourceContext* resource_context,
content::AppCacheService* appcache_service,
- content::ResourceType::Type resource_type,
+ content::ResourceType resource_type,
int child_id,
int route_id,
ScopedVector<content::ResourceThrottle>* throttles) OVERRIDE;
diff --git a/android_webview/native/aw_contents_io_thread_client_impl.cc b/android_webview/native/aw_contents_io_thread_client_impl.cc
index 12ffb15..8bdbf77 100644
--- a/android_webview/native/aw_contents_io_thread_client_impl.cc
+++ b/android_webview/native/aw_contents_io_thread_client_impl.cc
@@ -243,7 +243,7 @@ AwContentsIoThreadClientImpl::ShouldInterceptRequest(
const content::ResourceRequestInfo* info =
content::ResourceRequestInfo::ForRequest(request);
bool is_main_frame = info &&
- info->GetResourceType() == ResourceType::MAIN_FRAME;
+ info->GetResourceType() == content::RESOURCE_TYPE_MAIN_FRAME;
bool has_user_gesture = info && info->HasUserGesture();
vector<string> headers_names;
diff --git a/chrome/browser/captive_portal/captive_portal_tab_helper.cc b/chrome/browser/captive_portal/captive_portal_tab_helper.cc
index b3f0f88..2d2c1e1 100644
--- a/chrome/browser/captive_portal/captive_portal_tab_helper.cc
+++ b/chrome/browser/captive_portal/captive_portal_tab_helper.cc
@@ -194,10 +194,10 @@ bool CaptivePortalTabHelper::IsLoginTab() const {
}
void CaptivePortalTabHelper::OnRedirect(int child_id,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
const GURL& new_url) {
// Only main frame redirects for the provisional RenderViewHost matter.
- if (resource_type != ResourceType::MAIN_FRAME ||
+ if (resource_type != content::RESOURCE_TYPE_MAIN_FRAME ||
!provisional_render_view_host_ ||
provisional_render_view_host_->GetProcess()->GetID() != child_id) {
return;
diff --git a/chrome/browser/captive_portal/captive_portal_tab_helper.h b/chrome/browser/captive_portal/captive_portal_tab_helper.h
index 52d5c36..5379291 100644
--- a/chrome/browser/captive_portal/captive_portal_tab_helper.h
+++ b/chrome/browser/captive_portal/captive_portal_tab_helper.h
@@ -108,7 +108,7 @@ class CaptivePortalTabHelper
// Called by Observe in response to the corresponding event.
void OnRedirect(int child_id,
- content::ResourceType::Type resource_type,
+ content::ResourceType resource_type,
const GURL& new_url);
// Called by Observe in response to the corresponding event.
diff --git a/chrome/browser/captive_portal/captive_portal_tab_helper_unittest.cc b/chrome/browser/captive_portal/captive_portal_tab_helper_unittest.cc
index f8ff597..55b8943 100644
--- a/chrome/browser/captive_portal/captive_portal_tab_helper_unittest.cc
+++ b/chrome/browser/captive_portal/captive_portal_tab_helper_unittest.cc
@@ -204,7 +204,7 @@ class CaptivePortalTabHelperTest : public ChromeRenderViewHostTestHarness {
}
// Simulates a redirect. Uses OnRedirect rather than Observe, for simplicity.
- void OnRedirect(ResourceType::Type type, const GURL& new_url, int child_id) {
+ void OnRedirect(ResourceType type, const GURL& new_url, int child_id) {
tab_helper().OnRedirect(child_id, type, new_url);
}
@@ -483,7 +483,8 @@ TEST_F(CaptivePortalTabHelperTest, HttpToHttpsRedirectTimeout) {
GURL https_url(kHttpsUrl);
EXPECT_CALL(mock_reloader(), OnRedirect(true)).Times(1);
- OnRedirect(ResourceType::MAIN_FRAME, https_url,
+ OnRedirect(content::RESOURCE_TYPE_MAIN_FRAME,
+ https_url,
render_view_host1()->GetProcess()->GetID());
tab_helper().DidFailProvisionalLoad(main_render_frame1(),
@@ -511,7 +512,7 @@ TEST_F(CaptivePortalTabHelperTest, HttpsToHttpRedirect) {
GURL http_url(kHttpUrl);
EXPECT_CALL(mock_reloader(), OnRedirect(http_url.SchemeIsSecure())).Times(1);
- OnRedirect(ResourceType::MAIN_FRAME, http_url,
+ OnRedirect(content::RESOURCE_TYPE_MAIN_FRAME, http_url,
render_view_host1()->GetProcess()->GetID());
EXPECT_CALL(mock_reloader(), OnLoadCommitted(net::OK)).Times(1);
@@ -528,7 +529,7 @@ TEST_F(CaptivePortalTabHelperTest, HttpToHttpRedirect) {
main_render_frame1(), http_url, false, false);
EXPECT_CALL(mock_reloader(), OnRedirect(http_url.SchemeIsSecure())).Times(1);
- OnRedirect(ResourceType::MAIN_FRAME, http_url,
+ OnRedirect(content::RESOURCE_TYPE_MAIN_FRAME, http_url,
render_view_host1()->GetProcess()->GetID());
EXPECT_CALL(mock_reloader(), OnLoadCommitted(net::OK)).Times(1);
@@ -545,7 +546,8 @@ TEST_F(CaptivePortalTabHelperTest, SubframeRedirect) {
main_render_frame1(), http_url, false, false);
GURL https_url(kHttpsUrl);
- OnRedirect(ResourceType::SUB_FRAME, https_url,
+ OnRedirect(content::RESOURCE_TYPE_SUB_FRAME,
+ https_url,
render_view_host1()->GetProcess()->GetID());
EXPECT_CALL(mock_reloader(), OnLoadCommitted(net::OK)).Times(1);
@@ -563,7 +565,8 @@ TEST_F(CaptivePortalTabHelperTest, OtherRenderViewHostRedirect) {
// Another RenderViewHost sees a redirect. None of the reloader's functions
// should be called.
GURL https_url(kHttpsUrl);
- OnRedirect(ResourceType::MAIN_FRAME, https_url,
+ OnRedirect(content::RESOURCE_TYPE_MAIN_FRAME,
+ https_url,
render_view_host2()->GetProcess()->GetID());
tab_helper().DidFailProvisionalLoad(main_render_frame1(),
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 342c7f6..8a174a6 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -1981,12 +1981,12 @@ void ChromeContentBrowserClient::AllowCertificateError(
int cert_error,
const net::SSLInfo& ssl_info,
const GURL& request_url,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
bool overridable,
bool strict_enforcement,
const base::Callback<void(bool)>& callback,
content::CertificateRequestResultType* result) {
- if (resource_type != ResourceType::MAIN_FRAME) {
+ if (resource_type != content::RESOURCE_TYPE_MAIN_FRAME) {
// A sub-resource has a certificate error. The user doesn't really
// have a context for making the right decision, so block the
// request hard, without an info bar to allow showing the insecure
diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h
index 4604a82..4390c7e 100644
--- a/chrome/browser/chrome_content_browser_client.h
+++ b/chrome/browser/chrome_content_browser_client.h
@@ -166,7 +166,7 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient {
int cert_error,
const net::SSLInfo& ssl_info,
const GURL& request_url,
- content::ResourceType::Type resource_type,
+ content::ResourceType resource_type,
bool overridable,
bool strict_enforcement,
const base::Callback<void(bool)>& callback,
diff --git a/chrome/browser/chromeos/login/signin/merge_session_throttle.cc b/chrome/browser/chromeos/login/signin/merge_session_throttle.cc
index 259e84b..ddc90eb 100644
--- a/chrome/browser/chromeos/login/signin/merge_session_throttle.cc
+++ b/chrome/browser/chromeos/login/signin/merge_session_throttle.cc
@@ -73,7 +73,7 @@ ProfileSet* ProfileSet::Get() {
base::AtomicRefCount MergeSessionThrottle::all_profiles_restored_(0);
MergeSessionThrottle::MergeSessionThrottle(net::URLRequest* request,
- ResourceType::Type resource_type)
+ ResourceType resource_type)
: request_(request),
resource_type_(resource_type) {
}
@@ -243,7 +243,7 @@ bool MergeSessionThrottle::ShouldDelayRequest(
// static.
void MergeSessionThrottle::DeleayResourceLoadingOnUIThread(
- ResourceType::Type resource_type,
+ ResourceType resource_type,
int render_process_id,
int render_view_id,
const GURL& url,
@@ -258,12 +258,12 @@ void MergeSessionThrottle::DeleayResourceLoadingOnUIThread(
RenderViewHost::FromID(render_process_id, render_view_id);
WebContents* web_contents = render_view_host ?
WebContents::FromRenderViewHost(render_view_host) : NULL;
- if (resource_type == ResourceType::MAIN_FRAME) {
+ if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME) {
DVLOG(1) << "Creating page waiter for " << url.spec();
(new chromeos::MergeSessionLoadPage(web_contents, url, callback))->Show();
} else {
DVLOG(1) << "Creating XHR waiter for " << url.spec();
- DCHECK(resource_type == ResourceType::XHR);
+ DCHECK(resource_type == content::RESOURCE_TYPE_XHR);
Profile* profile = Profile::FromBrowserContext(
web_contents->GetBrowserContext());
(new chromeos::MergeSessionXHRRequestWaiter(profile,
diff --git a/chrome/browser/chromeos/login/signin/merge_session_throttle.h b/chrome/browser/chromeos/login/signin/merge_session_throttle.h
index a208e43..b07c57e 100644
--- a/chrome/browser/chromeos/login/signin/merge_session_throttle.h
+++ b/chrome/browser/chromeos/login/signin/merge_session_throttle.h
@@ -36,7 +36,7 @@ class MergeSessionThrottle
typedef base::Closure CompletionCallback;
explicit MergeSessionThrottle(net::URLRequest* request,
- content::ResourceType::Type resource_type);
+ content::ResourceType resource_type);
virtual ~MergeSessionThrottle();
// content::ResourceThrottle implementation:
@@ -70,18 +70,18 @@ class MergeSessionThrottle
int render_view_id);
// Tests merge session status and if needed generates request
- // waiter (for ResourceType::XHR content) or shows interstitial page
- // (for ResourceType::MAIN_FRAME).
+ // waiter (for content::RESOURCE_TYPE_XHR content) or shows interstitial page
+ // (for content::RESOURCE_TYPE_MAIN_FRAME).
// The function must be called from UI thread.
static void DeleayResourceLoadingOnUIThread(
- content::ResourceType::Type resource_type,
+ content::ResourceType resource_type,
int render_process_id,
int render_view_id,
const GURL& url,
const MergeSessionThrottle::CompletionCallback& callback);
net::URLRequest* request_;
- content::ResourceType::Type resource_type_;
+ content::ResourceType resource_type_;
// Global counter that keeps the track of session merge status for all
// encountered profiles. This is used to determine if a throttle should
diff --git a/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute.cc b/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute.cc
index a0218d3..1d88a42 100644
--- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute.cc
+++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute.cc
@@ -125,7 +125,7 @@ WebRequestConditionAttribute::Create(
WebRequestConditionAttributeResourceType::
WebRequestConditionAttributeResourceType(
- const std::vector<ResourceType::Type>& types)
+ const std::vector<ResourceType>& types)
: types_(types) {}
WebRequestConditionAttributeResourceType::
@@ -148,11 +148,11 @@ WebRequestConditionAttributeResourceType::Create(
size_t number_types = value_as_list->GetSize();
- std::vector<ResourceType::Type> passed_types;
+ std::vector<ResourceType> passed_types;
passed_types.reserve(number_types);
for (size_t i = 0; i < number_types; ++i) {
std::string resource_type_string;
- ResourceType::Type type = ResourceType::LAST_TYPE;
+ ResourceType type = content::RESOURCE_TYPE_LAST_TYPE;
if (!value_as_list->GetString(i, &resource_type_string) ||
!helpers::ParseResourceType(resource_type_string, &type)) {
*error = ErrorUtils::FormatErrorMessage(kInvalidValue,
diff --git a/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute.h b/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute.h
index d8e8028..a4c7088 100644
--- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute.h
+++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute.h
@@ -105,10 +105,10 @@ class WebRequestConditionAttributeResourceType
private:
explicit WebRequestConditionAttributeResourceType(
- const std::vector<content::ResourceType::Type>& types);
+ const std::vector<content::ResourceType>& types);
virtual ~WebRequestConditionAttributeResourceType();
- const std::vector<content::ResourceType::Type> types_;
+ const std::vector<content::ResourceType> types_;
DISALLOW_COPY_AND_ASSIGN(WebRequestConditionAttributeResourceType);
};
diff --git a/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc b/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc
index db269a1..ff462ff 100644
--- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc
+++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc
@@ -84,7 +84,7 @@ TEST(WebRequestConditionAttributeTest, ResourceType) {
std::string error;
base::ListValue resource_types;
// The 'sub_frame' value is chosen arbitrarily, so as the corresponding
- // ResourceType::Type is not 0, the default value.
+ // content::ResourceType is not 0, the default value.
resource_types.Append(new base::StringValue("sub_frame"));
scoped_refptr<const WebRequestConditionAttribute> attribute =
@@ -98,14 +98,26 @@ TEST(WebRequestConditionAttributeTest, ResourceType) {
net::TestURLRequest url_request_ok(
GURL("http://www.example.com"), net::DEFAULT_PRIORITY, NULL, &context);
content::ResourceRequestInfo::AllocateForTesting(
- &url_request_ok, ResourceType::SUB_FRAME, NULL, -1, -1, -1, false);
+ &url_request_ok,
+ content::RESOURCE_TYPE_SUB_FRAME,
+ NULL,
+ -1,
+ -1,
+ -1,
+ false);
EXPECT_TRUE(attribute->IsFulfilled(WebRequestData(&url_request_ok,
ON_BEFORE_REQUEST)));
net::TestURLRequest url_request_fail(
GURL("http://www.example.com"), net::DEFAULT_PRIORITY, NULL, &context);
content::ResourceRequestInfo::AllocateForTesting(
- &url_request_fail, ResourceType::MAIN_FRAME, NULL, -1, -1, -1, false);
+ &url_request_fail,
+ content::RESOURCE_TYPE_MAIN_FRAME,
+ NULL,
+ -1,
+ -1,
+ -1,
+ false);
EXPECT_FALSE(attribute->IsFulfilled(WebRequestData(&url_request_fail,
ON_BEFORE_REQUEST)));
}
diff --git a/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_unittest.cc b/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_unittest.cc
index dab3389..2da3e03 100644
--- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_unittest.cc
+++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_unittest.cc
@@ -85,7 +85,13 @@ TEST(WebRequestConditionTest, CreateCondition) {
request_data.url_match_ids = matcher.MatchURL(http_url);
EXPECT_EQ(1u, request_data.url_match_ids.size());
content::ResourceRequestInfo::AllocateForTesting(
- &match_request, ResourceType::MAIN_FRAME, NULL, -1, -1, -1, false);
+ &match_request,
+ content::RESOURCE_TYPE_MAIN_FRAME,
+ NULL,
+ -1,
+ -1,
+ -1,
+ false);
EXPECT_TRUE(result->IsFulfilled(request_data));
const GURL https_url("https://www.example.com");
@@ -96,7 +102,13 @@ TEST(WebRequestConditionTest, CreateCondition) {
// Make sure IsFulfilled does not fail because of URL matching.
EXPECT_EQ(1u, request_data.url_match_ids.size());
content::ResourceRequestInfo::AllocateForTesting(
- &wrong_resource_type, ResourceType::SUB_FRAME, NULL, -1, -1, -1, false);
+ &wrong_resource_type,
+ content::RESOURCE_TYPE_SUB_FRAME,
+ NULL,
+ -1,
+ -1,
+ -1,
+ false);
EXPECT_FALSE(result->IsFulfilled(request_data));
}
@@ -136,7 +148,13 @@ TEST(WebRequestConditionTest, CreateConditionFirstPartyForCookies) {
request_data.first_party_url_match_ids = matcher.MatchURL(first_party_url);
EXPECT_EQ(1u, request_data.first_party_url_match_ids.size());
content::ResourceRequestInfo::AllocateForTesting(
- &match_request, ResourceType::MAIN_FRAME, NULL, -1, -1, -1, false);
+ &match_request,
+ content::RESOURCE_TYPE_MAIN_FRAME,
+ NULL,
+ -1,
+ -1,
+ -1,
+ false);
EXPECT_TRUE(result->IsFulfilled(request_data));
}
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
index 830d5ec..ec17b8a 100644
--- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
+++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
@@ -560,8 +560,8 @@ void WebNavigationTabObserver::DidFailLoad(
void WebNavigationTabObserver::DidGetRedirectForResourceRequest(
content::RenderViewHost* render_view_host,
const content::ResourceRedirectDetails& details) {
- if (details.resource_type != ResourceType::MAIN_FRAME &&
- details.resource_type != ResourceType::SUB_FRAME) {
+ if (details.resource_type != content::RESOURCE_TYPE_MAIN_FRAME &&
+ details.resource_type != content::RESOURCE_TYPE_SUB_FRAME) {
return;
}
content::RenderFrameHost* render_frame_host =
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
index ffbad82..7caa659 100644
--- a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
+++ b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
@@ -94,7 +94,7 @@ class TestNavigationListener
// Needs to be invoked on the IO thread.
content::ResourceThrottle* CreateResourceThrottle(
const GURL& url,
- ResourceType::Type resource_type) {
+ ResourceType resource_type) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
if (urls_to_delay_.find(url) == urls_to_delay_.end())
return NULL;
@@ -229,7 +229,7 @@ class TestResourceDispatcherHostDelegate
net::URLRequest* request,
content::ResourceContext* resource_context,
content::AppCacheService* appcache_service,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
int child_id,
int route_id,
ScopedVector<content::ResourceThrottle>* throttles) OVERRIDE {
diff --git a/chrome/browser/extensions/api/web_request/web_request_api.cc b/chrome/browser/extensions/api/web_request/web_request_api.cc
index dccfde0..80690a0 100644
--- a/chrome/browser/extensions/api/web_request/web_request_api.cc
+++ b/chrome/browser/extensions/api/web_request/web_request_api.cc
@@ -203,7 +203,7 @@ void ExtractRequestInfoDetails(net::URLRequest* request,
int* window_id,
int* render_process_host_id,
int* routing_id,
- ResourceType::Type* resource_type) {
+ ResourceType* resource_type) {
if (!request->GetUserData(NULL))
return;
@@ -221,7 +221,7 @@ void ExtractRequestInfoDetails(net::URLRequest* request,
if (helpers::IsRelevantResourceType(info->GetResourceType()))
*resource_type = info->GetResourceType();
else
- *resource_type = ResourceType::LAST_TYPE;
+ *resource_type = content::RESOURCE_TYPE_LAST_TYPE;
}
// Extracts from |request| information for the keys requestId, url, method,
@@ -238,7 +238,7 @@ void ExtractRequestInfo(net::URLRequest* request, base::DictionaryValue* out) {
int window_id = -1;
int render_process_host_id = -1;
int routing_id = -1;
- ResourceType::Type resource_type = ResourceType::LAST_TYPE;
+ ResourceType resource_type = content::RESOURCE_TYPE_LAST_TYPE;
ExtractRequestInfoDetails(request, &is_main_frame, &frame_id,
&parent_is_main_frame, &parent_frame_id, &tab_id,
&window_id, &render_process_host_id, &routing_id,
@@ -623,7 +623,7 @@ bool ExtensionWebRequestEventRouter::RequestFilter::InitFromValue(
return false;
for (size_t i = 0; i < types_value->GetSize(); ++i) {
std::string type_str;
- ResourceType::Type type;
+ ResourceType type;
if (!types_value->GetString(i, &type_str) ||
!helpers::ParseResourceType(type_str, &type))
return false;
@@ -1412,14 +1412,14 @@ bool ExtensionWebRequestEventRouter::IsPageLoad(
int window_id = -1;
int render_process_host_id = -1;
int routing_id = -1;
- ResourceType::Type resource_type = ResourceType::LAST_TYPE;
+ ResourceType resource_type = content::RESOURCE_TYPE_LAST_TYPE;
ExtractRequestInfoDetails(request, &is_main_frame, &frame_id,
&parent_is_main_frame, &parent_frame_id,
&tab_id, &window_id, &render_process_host_id,
&routing_id, &resource_type);
- return resource_type == ResourceType::MAIN_FRAME;
+ return resource_type == content::RESOURCE_TYPE_MAIN_FRAME;
}
void ExtensionWebRequestEventRouter::NotifyPageLoad() {
@@ -1464,7 +1464,7 @@ void ExtensionWebRequestEventRouter::GetMatchingListenersImpl(
int window_id,
int render_process_host_id,
int routing_id,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
bool is_async_request,
bool is_request_from_extension,
int* extra_info_spec,
@@ -1520,8 +1520,9 @@ void ExtensionWebRequestEventRouter::GetMatchingListenersImpl(
// and therefore prevent the extension from processing the request
// handler. This is only a problem for blocking listeners.
// http://crbug.com/105656
- bool synchronous_xhr_from_extension = !is_async_request &&
- is_request_from_extension && resource_type == ResourceType::XHR;
+ bool synchronous_xhr_from_extension =
+ !is_async_request && is_request_from_extension &&
+ resource_type == content::RESOURCE_TYPE_XHR;
// Only send webRequest events for URLs the extension has access to.
if (blocking_listener && synchronous_xhr_from_extension)
@@ -1550,7 +1551,7 @@ ExtensionWebRequestEventRouter::GetMatchingListeners(
int window_id = -1;
int render_process_host_id = -1;
int routing_id = -1;
- ResourceType::Type resource_type = ResourceType::LAST_TYPE;
+ ResourceType resource_type = content::RESOURCE_TYPE_LAST_TYPE;
const GURL& url = request->url();
ExtractRequestInfoDetails(request, &is_main_frame, &frame_id,
diff --git a/chrome/browser/extensions/api/web_request/web_request_api.h b/chrome/browser/extensions/api/web_request/web_request_api.h
index 2851b5b..18de73d 100644
--- a/chrome/browser/extensions/api/web_request/web_request_api.h
+++ b/chrome/browser/extensions/api/web_request/web_request_api.h
@@ -119,7 +119,7 @@ class ExtensionWebRequestEventRouter
bool InitFromValue(const base::DictionaryValue& value, std::string* error);
extensions::URLPatternSet urls;
- std::vector<content::ResourceType::Type> types;
+ std::vector<content::ResourceType> types;
int tab_id;
int window_id;
};
@@ -357,7 +357,7 @@ class ExtensionWebRequestEventRouter
int window_id,
int render_process_host_id,
int routing_id,
- content::ResourceType::Type resource_type,
+ content::ResourceType resource_type,
bool is_async_request,
bool is_request_from_extension,
int* extra_info_spec,
diff --git a/chrome/browser/extensions/api/web_request/web_request_api_helpers.cc b/chrome/browser/extensions/api/web_request/web_request_api_helpers.cc
index ab64755..7d32183 100644
--- a/chrome/browser/extensions/api/web_request/web_request_api_helpers.cc
+++ b/chrome/browser/extensions/api/web_request/web_request_api_helpers.cc
@@ -55,21 +55,21 @@ static const char* kResourceTypeStrings[] = {
"other",
};
-static ResourceType::Type kResourceTypeValues[] = {
- ResourceType::MAIN_FRAME,
- ResourceType::SUB_FRAME,
- ResourceType::STYLESHEET,
- ResourceType::SCRIPT,
- ResourceType::IMAGE,
- ResourceType::OBJECT,
- ResourceType::XHR,
- ResourceType::LAST_TYPE, // represents "other"
+static ResourceType kResourceTypeValues[] = {
+ content::RESOURCE_TYPE_MAIN_FRAME,
+ content::RESOURCE_TYPE_SUB_FRAME,
+ content::RESOURCE_TYPE_STYLESHEET,
+ content::RESOURCE_TYPE_SCRIPT,
+ content::RESOURCE_TYPE_IMAGE,
+ content::RESOURCE_TYPE_OBJECT,
+ content::RESOURCE_TYPE_XHR,
+ content::RESOURCE_TYPE_LAST_TYPE, // represents "other"
// TODO(jochen): We duplicate the last entry, so the array's size is not a
// power of two. If it is, this triggers a bug in gcc 4.4 in Release builds
// (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43949). Once we use a version
// of gcc with this bug fixed, or the array is changed so this duplicate
// entry is no longer required, this should be removed.
- ResourceType::LAST_TYPE,
+ content::RESOURCE_TYPE_LAST_TYPE,
};
COMPILE_ASSERT(
@@ -1184,14 +1184,14 @@ bool MergeOnAuthRequiredResponses(
#define ARRAYEND(array) (array + arraysize(array))
-bool IsRelevantResourceType(ResourceType::Type type) {
- ResourceType::Type* iter =
+bool IsRelevantResourceType(ResourceType type) {
+ ResourceType* iter =
std::find(kResourceTypeValues, ARRAYEND(kResourceTypeValues), type);
return iter != ARRAYEND(kResourceTypeValues);
}
-const char* ResourceTypeToString(ResourceType::Type type) {
- ResourceType::Type* iter =
+const char* ResourceTypeToString(ResourceType type) {
+ ResourceType* iter =
std::find(kResourceTypeValues, ARRAYEND(kResourceTypeValues), type);
if (iter == ARRAYEND(kResourceTypeValues))
return "other";
@@ -1200,7 +1200,7 @@ const char* ResourceTypeToString(ResourceType::Type type) {
}
bool ParseResourceType(const std::string& type_str,
- ResourceType::Type* type) {
+ ResourceType* type) {
const char** iter =
std::find(kResourceTypeStrings, ARRAYEND(kResourceTypeStrings), type_str);
if (iter == ARRAYEND(kResourceTypeStrings))
diff --git a/chrome/browser/extensions/api/web_request/web_request_api_helpers.h b/chrome/browser/extensions/api/web_request/web_request_api_helpers.h
index 069ba85..1fac04e 100644
--- a/chrome/browser/extensions/api/web_request/web_request_api_helpers.h
+++ b/chrome/browser/extensions/api/web_request/web_request_api_helpers.h
@@ -304,17 +304,17 @@ bool MergeOnAuthRequiredResponses(
// Returns whether |type| is a ResourceType that is handled by the web request
// API.
-bool IsRelevantResourceType(content::ResourceType::Type type);
+bool IsRelevantResourceType(content::ResourceType type);
// Returns a string representation of |type| or |other| if |type| is not handled
// by the web request API.
-const char* ResourceTypeToString(content::ResourceType::Type type);
+const char* ResourceTypeToString(content::ResourceType type);
-// Stores a |ResourceType::Type| representation in |type| if |type_str| is
+// Stores a |content::ResourceType| representation in |type| if |type_str| is
// a resource type handled by the web request API. Returns true in case of
// success.
bool ParseResourceType(const std::string& type_str,
- content::ResourceType::Type* type);
+ content::ResourceType* type);
// Triggers clearing each renderer's in-memory cache the next time it navigates.
void ClearCacheOnNavigation();
diff --git a/chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc b/chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc
index b6f11d0..117c550 100644
--- a/chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc
+++ b/chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc
@@ -131,9 +131,13 @@ TEST_F(ExtensionWebRequestHelpersTestWithThreadsTest, TestHideRequestForURL) {
int view_id = 17;
net::TestURLRequest sensitive_request(
non_sensitive_url, net::DEFAULT_PRIORITY, NULL, &context);
- ResourceRequestInfo::AllocateForTesting(
- &sensitive_request, ResourceType::SCRIPT, NULL,
- process_id, view_id, MSG_ROUTING_NONE, false);
+ ResourceRequestInfo::AllocateForTesting(&sensitive_request,
+ content::RESOURCE_TYPE_SCRIPT,
+ NULL,
+ process_id,
+ view_id,
+ MSG_ROUTING_NONE,
+ false);
extension_info_map_->RegisterExtensionProcess(
extension_misc::kWebStoreAppId, process_id, site_instance_id);
EXPECT_TRUE(WebRequestPermissions::HideRequest(extension_info_map_.get(),
@@ -145,9 +149,13 @@ TEST_F(ExtensionWebRequestHelpersTestWithThreadsTest, TestHideRequestForURL) {
int view_id = 19;
net::TestURLRequest sensitive_request(
non_sensitive_url, net::DEFAULT_PRIORITY, NULL, &context);
- ResourceRequestInfo::AllocateForTesting(
- &sensitive_request, ResourceType::SCRIPT, NULL,
- process_id, view_id, MSG_ROUTING_NONE, false);
+ ResourceRequestInfo::AllocateForTesting(&sensitive_request,
+ content::RESOURCE_TYPE_SCRIPT,
+ NULL,
+ process_id,
+ view_id,
+ MSG_ROUTING_NONE,
+ false);
EXPECT_TRUE(WebRequestPermissions::HideRequest(extension_info_map_.get(),
&sensitive_request));
}
diff --git a/chrome/browser/extensions/url_request_util.cc b/chrome/browser/extensions/url_request_util.cc
index e75cf5c..789c4a94 100644
--- a/chrome/browser/extensions/url_request_util.cc
+++ b/chrome/browser/extensions/url_request_util.cc
@@ -166,7 +166,7 @@ bool AllowCrossRendererResourceLoad(net::URLRequest* request,
// If the request is for navigations outside of webviews, then it should be
// allowed. The navigation logic in CrossSiteResourceHandler will properly
// transfer the navigation to a privileged process before it commits.
- if (ResourceType::IsFrame(info->GetResourceType()) && !is_guest)
+ if (content::IsResourceTypeFrame(info->GetResourceType()) && !is_guest)
return true;
if (!content::PageTransitionIsWebTriggerable(info->GetPageTransition()))
diff --git a/chrome/browser/extensions/user_script_listener.cc b/chrome/browser/extensions/user_script_listener.cc
index fcebfa5..eda5957 100644
--- a/chrome/browser/extensions/user_script_listener.cc
+++ b/chrome/browser/extensions/user_script_listener.cc
@@ -84,7 +84,7 @@ UserScriptListener::UserScriptListener()
ResourceThrottle* UserScriptListener::CreateResourceThrottle(
const GURL& url,
- ResourceType::Type resource_type) {
+ ResourceType resource_type) {
if (!ShouldDelayRequest(url, resource_type))
return NULL;
@@ -97,13 +97,13 @@ UserScriptListener::~UserScriptListener() {
}
bool UserScriptListener::ShouldDelayRequest(const GURL& url,
- ResourceType::Type resource_type) {
+ ResourceType resource_type) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
// If it's a frame load, then we need to check the URL against the list of
// user scripts to see if we need to wait.
- if (resource_type != ResourceType::MAIN_FRAME &&
- resource_type != ResourceType::SUB_FRAME)
+ if (resource_type != content::RESOURCE_TYPE_MAIN_FRAME &&
+ resource_type != content::RESOURCE_TYPE_SUB_FRAME)
return false;
// Note: we could delay only requests made by the profile who is causing the
diff --git a/chrome/browser/extensions/user_script_listener.h b/chrome/browser/extensions/user_script_listener.h
index 7063121..05c24ce 100644
--- a/chrome/browser/extensions/user_script_listener.h
+++ b/chrome/browser/extensions/user_script_listener.h
@@ -46,7 +46,7 @@ class UserScriptListener
// given URL. Otherwise, this method returns NULL.
content::ResourceThrottle* CreateResourceThrottle(
const GURL& url,
- content::ResourceType::Type resource_type);
+ content::ResourceType resource_type);
private:
friend struct content::BrowserThread::DeleteOnThread<
@@ -58,7 +58,7 @@ class UserScriptListener
virtual ~UserScriptListener();
bool ShouldDelayRequest(const GURL& url,
- content::ResourceType::Type resource_type);
+ content::ResourceType resource_type);
void StartDelayedRequests();
// Update user_scripts_ready_ based on the status of all profiles. On a
diff --git a/chrome/browser/extensions/user_script_listener_unittest.cc b/chrome/browser/extensions/user_script_listener_unittest.cc
index b49d740..42be1e7 100644
--- a/chrome/browser/extensions/user_script_listener_unittest.cc
+++ b/chrome/browser/extensions/user_script_listener_unittest.cc
@@ -167,8 +167,8 @@ class UserScriptListenerTest : public ExtensionServiceTestBase {
net::TestURLRequest* request =
new net::TestURLRequest(url, net::DEFAULT_PRIORITY, delegate, context);
- ResourceThrottle* throttle =
- listener_->CreateResourceThrottle(url, ResourceType::MAIN_FRAME);
+ ResourceThrottle* throttle = listener_->CreateResourceThrottle(
+ url, content::RESOURCE_TYPE_MAIN_FRAME);
bool defer = false;
if (throttle) {
@@ -336,7 +336,7 @@ TEST_F(UserScriptListenerTest, ResumeBeforeStart) {
new net::TestURLRequest(url, net::DEFAULT_PRIORITY, &delegate, &context));
ResourceThrottle* throttle =
- listener_->CreateResourceThrottle(url, ResourceType::MAIN_FRAME);
+ listener_->CreateResourceThrottle(url, content::RESOURCE_TYPE_MAIN_FRAME);
ASSERT_TRUE(throttle);
request->SetUserData(NULL, new ThrottleController(request.get(), throttle));
diff --git a/chrome/browser/guest_view/web_view/web_view_guest.cc b/chrome/browser/guest_view/web_view/web_view_guest.cc
index a404477..88ff3dd 100644
--- a/chrome/browser/guest_view/web_view/web_view_guest.cc
+++ b/chrome/browser/guest_view/web_view/web_view_guest.cc
@@ -606,8 +606,8 @@ void WebViewGuest::Observe(int type,
guest_web_contents());
content::ResourceRedirectDetails* resource_redirect_details =
content::Details<content::ResourceRedirectDetails>(details).ptr();
- bool is_top_level =
- resource_redirect_details->resource_type == ResourceType::MAIN_FRAME;
+ bool is_top_level = resource_redirect_details->resource_type ==
+ content::RESOURCE_TYPE_MAIN_FRAME;
LoadRedirect(resource_redirect_details->url,
resource_redirect_details->new_url,
is_top_level);
diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/chrome_network_delegate.cc
index 48c9cfd..b0c1616 100644
--- a/chrome/browser/net/chrome_network_delegate.cc
+++ b/chrome/browser/net/chrome_network_delegate.cc
@@ -629,8 +629,8 @@ bool ChromeNetworkDelegate::OnCanGetCookies(
bool is_for_blocking_resource = false;
const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(&request);
if (info && ((!info->IsAsync()) ||
- info->GetResourceType() == ResourceType::STYLESHEET ||
- info->GetResourceType() == ResourceType::SCRIPT)) {
+ info->GetResourceType() == content::RESOURCE_TYPE_STYLESHEET ||
+ info->GetResourceType() == content::RESOURCE_TYPE_SCRIPT)) {
is_for_blocking_resource = true;
}
diff --git a/chrome/browser/prerender/prerender_contents.cc b/chrome/browser/prerender/prerender_contents.cc
index 85f2c9e..4f9ff17 100644
--- a/chrome/browser/prerender/prerender_contents.cc
+++ b/chrome/browser/prerender/prerender_contents.cc
@@ -684,7 +684,7 @@ void PrerenderContents::DidGetRedirectForResourceRequest(
// it's a redirect on the top-level resource, the name needs to be remembered
// for future matching, and if it redirects to an https resource, it needs to
// be canceled. If a subresource is redirected, nothing changes.
- if (details.resource_type != ResourceType::MAIN_FRAME)
+ if (details.resource_type != content::RESOURCE_TYPE_MAIN_FRAME)
return;
CheckURL(details.new_url);
}
diff --git a/chrome/browser/prerender/prerender_pending_swap_throttle.cc b/chrome/browser/prerender/prerender_pending_swap_throttle.cc
index 5c519e3..5148ace 100644
--- a/chrome/browser/prerender/prerender_pending_swap_throttle.cc
+++ b/chrome/browser/prerender/prerender_pending_swap_throttle.cc
@@ -30,7 +30,7 @@ void PrerenderPendingSwapThrottle::WillStartRequest(bool* defer) {
content::ResourceRequestInfo::ForRequest(request_);
// We only care about main frame loads.
- if (info->GetResourceType() != ResourceType::MAIN_FRAME)
+ if (info->GetResourceType() != content::RESOURCE_TYPE_MAIN_FRAME)
return;
int render_process_id = info->GetChildID();
diff --git a/chrome/browser/prerender/prerender_resource_throttle.cc b/chrome/browser/prerender/prerender_resource_throttle.cc
index d578f4f..70e1aee 100644
--- a/chrome/browser/prerender/prerender_resource_throttle.cc
+++ b/chrome/browser/prerender/prerender_resource_throttle.cc
@@ -78,7 +78,7 @@ void PrerenderResourceThrottle::Cancel() {
void PrerenderResourceThrottle::WillStartRequestOnUI(
const base::WeakPtr<PrerenderResourceThrottle>& throttle,
const std::string& method,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
int render_process_id,
int render_frame_id,
const GURL& url) {
@@ -96,7 +96,7 @@ void PrerenderResourceThrottle::WillStartRequestOnUI(
ReportUnsupportedPrerenderScheme(url);
cancel = true;
#if defined(OS_ANDROID)
- } else if (resource_type == ResourceType::FAVICON) {
+ } else if (resource_type == content::RESOURCE_TYPE_FAVICON) {
// Delay icon fetching until the contents are getting swapped in
// to conserve network usage in mobile devices.
prerender_contents->AddResourceThrottle(throttle);
@@ -115,7 +115,7 @@ void PrerenderResourceThrottle::WillStartRequestOnUI(
void PrerenderResourceThrottle::WillRedirectRequestOnUI(
const base::WeakPtr<PrerenderResourceThrottle>& throttle,
const std::string& follow_only_when_prerender_shown_header,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
bool async,
int render_process_id,
int render_frame_id,
@@ -130,7 +130,7 @@ void PrerenderResourceThrottle::WillRedirectRequestOnUI(
ReportUnsupportedPrerenderScheme(new_url);
cancel = true;
} else if (follow_only_when_prerender_shown_header == "1" &&
- resource_type != ResourceType::MAIN_FRAME) {
+ resource_type != content::RESOURCE_TYPE_MAIN_FRAME) {
// Only defer redirects with the Follow-Only-When-Prerender-Shown
// header. Do not defer redirects on main frame loads.
if (!async) {
diff --git a/chrome/browser/prerender/prerender_resource_throttle.h b/chrome/browser/prerender/prerender_resource_throttle.h
index 3d2a43c..c2535b9 100644
--- a/chrome/browser/prerender/prerender_resource_throttle.h
+++ b/chrome/browser/prerender/prerender_resource_throttle.h
@@ -49,7 +49,7 @@ class PrerenderResourceThrottle
static void WillStartRequestOnUI(
const base::WeakPtr<PrerenderResourceThrottle>& throttle,
const std::string& method,
- content::ResourceType::Type resource_type,
+ content::ResourceType resource_type,
int render_process_id,
int render_frame_id,
const GURL& url);
@@ -57,7 +57,7 @@ class PrerenderResourceThrottle
static void WillRedirectRequestOnUI(
const base::WeakPtr<PrerenderResourceThrottle>& throttle,
const std::string& follow_only_when_prerender_shown_header,
- content::ResourceType::Type resource_type,
+ content::ResourceType resource_type,
bool async,
int render_process_id,
int render_frame_id,
diff --git a/chrome/browser/prerender/prerender_tracker_unittest.cc b/chrome/browser/prerender/prerender_tracker_unittest.cc
index fa4330e..eb19533 100644
--- a/chrome/browser/prerender/prerender_tracker_unittest.cc
+++ b/chrome/browser/prerender/prerender_tracker_unittest.cc
@@ -228,9 +228,13 @@ TEST_F(PrerenderTrackerTest, PrerenderThrottledRedirectResume) {
net::DEFAULT_PRIORITY,
&delegate,
&url_request_context);
- content::ResourceRequestInfo::AllocateForTesting(
- &request, ResourceType::IMAGE, NULL,
- kDefaultChildId, kDefaultRouteId, MSG_ROUTING_NONE, true);
+ content::ResourceRequestInfo::AllocateForTesting(&request,
+ content::RESOURCE_TYPE_IMAGE,
+ NULL,
+ kDefaultChildId,
+ kDefaultRouteId,
+ MSG_ROUTING_NONE,
+ true);
// Install a prerender throttle.
PrerenderResourceThrottle throttle(&request);
@@ -268,8 +272,13 @@ TEST_F(PrerenderTrackerTest, PrerenderThrottledRedirectMainFrame) {
&delegate,
&url_request_context);
content::ResourceRequestInfo::AllocateForTesting(
- &request, ResourceType::MAIN_FRAME, NULL,
- kDefaultChildId, kDefaultRouteId, MSG_ROUTING_NONE, true);
+ &request,
+ content::RESOURCE_TYPE_MAIN_FRAME,
+ NULL,
+ kDefaultChildId,
+ kDefaultRouteId,
+ MSG_ROUTING_NONE,
+ true);
// Install a prerender throttle.
PrerenderResourceThrottle throttle(&request);
@@ -304,9 +313,13 @@ TEST_F(PrerenderTrackerTest, PrerenderThrottledRedirectSyncXHR) {
net::DEFAULT_PRIORITY,
&delegate,
&url_request_context);
- content::ResourceRequestInfo::AllocateForTesting(
- &request, ResourceType::XHR, NULL,
- kDefaultChildId, kDefaultRouteId, MSG_ROUTING_NONE, false);
+ content::ResourceRequestInfo::AllocateForTesting(&request,
+ content::RESOURCE_TYPE_XHR,
+ NULL,
+ kDefaultChildId,
+ kDefaultRouteId,
+ MSG_ROUTING_NONE,
+ false);
// Install a prerender throttle.
PrerenderResourceThrottle throttle(&request);
diff --git a/chrome/browser/prerender/prerender_util.cc b/chrome/browser/prerender/prerender_util.cc
index 67670aa..e7ae9d1 100644
--- a/chrome/browser/prerender/prerender_util.cc
+++ b/chrome/browser/prerender/prerender_util.cc
@@ -163,10 +163,10 @@ bool IsControlGroupExperiment(uint8 experiment_id) {
return experiment_id == 7 || experiment_id == 8;
}
-void GatherPagespeedData(const ResourceType::Type resource_type,
+void GatherPagespeedData(const ResourceType resource_type,
const GURL& request_url,
const net::HttpResponseHeaders* response_headers) {
- if (resource_type != ResourceType::MAIN_FRAME ||
+ if (resource_type != content::RESOURCE_TYPE_MAIN_FRAME ||
!request_url.SchemeIsHTTPOrHTTPS())
return;
diff --git a/chrome/browser/prerender/prerender_util.h b/chrome/browser/prerender/prerender_util.h
index 5addd03..7394501 100644
--- a/chrome/browser/prerender/prerender_util.h
+++ b/chrome/browser/prerender/prerender_util.h
@@ -51,7 +51,7 @@ bool IsControlGroupExperiment(uint8 experiment_id);
// Called by URLRequestResponseStarted to gather data about Pagespeed headers
// into the Prerender.PagespeedHeader histogram. Public so it can be accessed
// by the unit test.
-void GatherPagespeedData(const content::ResourceType::Type resource_type,
+void GatherPagespeedData(const content::ResourceType resource_type,
const GURL& request_url,
const net::HttpResponseHeaders* response_headers);
diff --git a/chrome/browser/prerender/prerender_util_unittest.cc b/chrome/browser/prerender/prerender_util_unittest.cc
index 6ee79a4..528eec8 100644
--- a/chrome/browser/prerender/prerender_util_unittest.cc
+++ b/chrome/browser/prerender/prerender_util_unittest.cc
@@ -102,7 +102,7 @@ TEST_F(PrerenderUtilTest, CountPageSpeedHeadersTest) {
scoped_ptr<base::HistogramSamples> version_samples;
// No PageSpeed header. The VersionCounts histogram isn't created yet.
- GatherPagespeedData(ResourceType::MAIN_FRAME, url, headers.get());
+ GatherPagespeedData(content::RESOURCE_TYPE_MAIN_FRAME, url, headers.get());
base::HistogramBase* server_histogram =
base::StatisticsRecorder::FindHistogram(
"Prerender.PagespeedHeader.ServerCounts");
@@ -119,7 +119,7 @@ TEST_F(PrerenderUtilTest, CountPageSpeedHeadersTest) {
// X-Mod-Pagespeed header in expected format. VersionCounts now exists.
headers->AddHeader("X-Mod-Pagespeed: 1.2.24.1-2300");
- GatherPagespeedData(ResourceType::MAIN_FRAME, url, headers.get());
+ GatherPagespeedData(content::RESOURCE_TYPE_MAIN_FRAME, url, headers.get());
base::HistogramBase* version_histogram =
base::StatisticsRecorder::FindHistogram(
"Prerender.PagespeedHeader.VersionCounts");
@@ -138,7 +138,7 @@ TEST_F(PrerenderUtilTest, CountPageSpeedHeadersTest) {
// X-Mod-Pagespeed header in unexpected format.
headers->AddHeader("X-Mod-Pagespeed: Powered By PageSpeed!");
- GatherPagespeedData(ResourceType::MAIN_FRAME, url, headers.get());
+ GatherPagespeedData(content::RESOURCE_TYPE_MAIN_FRAME, url, headers.get());
server_samples = server_histogram->SnapshotSamples();
version_samples = version_histogram->SnapshotSamples();
EXPECT_EQ(++num_responses, server_samples->GetCount(0));
@@ -153,7 +153,7 @@ TEST_F(PrerenderUtilTest, CountPageSpeedHeadersTest) {
// X-Page-Speed header in mod_pagespeed format (so ngx_pagespeed).
headers->AddHeader("X-Page-Speed: 1.3.25.2-2530");
- GatherPagespeedData(ResourceType::MAIN_FRAME, url, headers.get());
+ GatherPagespeedData(content::RESOURCE_TYPE_MAIN_FRAME, url, headers.get());
server_samples = server_histogram->SnapshotSamples();
version_samples = version_histogram->SnapshotSamples();
EXPECT_EQ(++num_responses, server_samples->GetCount(0));
@@ -168,7 +168,7 @@ TEST_F(PrerenderUtilTest, CountPageSpeedHeadersTest) {
// X-Page-Speed header in PageSpeed Service format.
headers->AddHeader("X-Page-Speed: 97_4_bo");
- GatherPagespeedData(ResourceType::MAIN_FRAME, url, headers.get());
+ GatherPagespeedData(content::RESOURCE_TYPE_MAIN_FRAME, url, headers.get());
server_samples = server_histogram->SnapshotSamples();
version_samples = version_histogram->SnapshotSamples();
EXPECT_EQ(++num_responses, server_samples->GetCount(0));
@@ -183,7 +183,7 @@ TEST_F(PrerenderUtilTest, CountPageSpeedHeadersTest) {
// X-Page-Speed header in an unrecognized format (IISpeed in this case).
headers->AddHeader("X-Page-Speed: 1.0PS1.2-20130615");
- GatherPagespeedData(ResourceType::MAIN_FRAME, url, headers.get());
+ GatherPagespeedData(content::RESOURCE_TYPE_MAIN_FRAME, url, headers.get());
server_samples = server_histogram->SnapshotSamples();
version_samples = version_histogram->SnapshotSamples();
EXPECT_EQ(++num_responses, server_samples->GetCount(0));
@@ -195,7 +195,7 @@ TEST_F(PrerenderUtilTest, CountPageSpeedHeadersTest) {
EXPECT_EQ( num_bucket_33, version_samples->GetCount(33));
// Not a main frame => not counted at all.
- GatherPagespeedData(ResourceType::SUB_FRAME, url, headers.get());
+ GatherPagespeedData(content::RESOURCE_TYPE_SUB_FRAME, url, headers.get());
server_samples = server_histogram->SnapshotSamples();
version_samples = version_histogram->SnapshotSamples();
EXPECT_EQ( num_responses, server_samples->GetCount(0));
@@ -209,7 +209,8 @@ TEST_F(PrerenderUtilTest, CountPageSpeedHeadersTest) {
// Not a http/https URL => not counted at all.
GURL data_url("data:image/png;base64,yadda yadda==");
- GatherPagespeedData(ResourceType::MAIN_FRAME, data_url, headers.get());
+ GatherPagespeedData(
+ content::RESOURCE_TYPE_MAIN_FRAME, data_url, headers.get());
server_samples = server_histogram->SnapshotSamples();
version_samples = version_histogram->SnapshotSamples();
EXPECT_EQ( num_responses, server_samples->GetCount(0));
diff --git a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
index 4a9f0a8..1c5e698 100644
--- a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
+++ b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
@@ -226,7 +226,7 @@ void LaunchURL(const GURL& url, int render_process_id, int render_view_id) {
void AppendComponentUpdaterThrottles(
net::URLRequest* request,
content::ResourceContext* resource_context,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
ScopedVector<content::ResourceThrottle>* throttles) {
const char* crx_id = NULL;
component_updater::ComponentUpdateService* cus =
@@ -234,7 +234,7 @@ void AppendComponentUpdaterThrottles(
if (!cus)
return;
// Check for PNaCl pexe request.
- if (resource_type == ResourceType::OBJECT) {
+ if (resource_type == content::RESOURCE_TYPE_OBJECT) {
const net::HttpRequestHeaders& headers = request->extra_request_headers();
std::string accept_headers;
if (headers.GetHeader("Accept", &accept_headers)) {
@@ -275,13 +275,13 @@ bool ChromeResourceDispatcherHostDelegate::ShouldBeginRequest(
int route_id,
const std::string& method,
const GURL& url,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
content::ResourceContext* resource_context) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
// Handle a PREFETCH resource type. If prefetch is disabled, squelch the
// request. Otherwise, do a normal request to warm the cache.
- if (resource_type == ResourceType::PREFETCH) {
+ if (resource_type == content::RESOURCE_TYPE_PREFETCH) {
// All PREFETCH requests should be GETs, but be defensive about it.
if (method != "GET")
return false;
@@ -298,7 +298,7 @@ void ChromeResourceDispatcherHostDelegate::RequestBeginning(
net::URLRequest* request,
content::ResourceContext* resource_context,
content::AppCacheService* appcache_service,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
int child_id,
int route_id,
ScopedVector<content::ResourceThrottle>* throttles) {
@@ -321,12 +321,12 @@ void ChromeResourceDispatcherHostDelegate::RequestBeginning(
#if defined(OS_ANDROID)
// TODO(davidben): This is insufficient to integrate with prerender properly.
// https://crbug.com/370595
- if (resource_type == ResourceType::MAIN_FRAME && !is_prerendering) {
+ if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME && !is_prerendering) {
throttles->push_back(
InterceptNavigationDelegate::CreateThrottleFor(request));
}
#else
- if (resource_type == ResourceType::MAIN_FRAME) {
+ if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME) {
// Redirect some navigations to apps that have registered matching URL
// handlers ('url_handlers' in the manifest).
content::ResourceThrottle* url_to_app_throttle =
@@ -348,7 +348,7 @@ void ChromeResourceDispatcherHostDelegate::RequestBeginning(
#if defined(OS_CHROMEOS)
// Check if we need to add offline throttle. This should be done only
// for main frames.
- if (resource_type == ResourceType::MAIN_FRAME) {
+ if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME) {
// We check offline first, then check safe browsing so that we still can
// block unsafe site after we remove offline page.
throttles->push_back(new OfflineResourceThrottle(request,
@@ -357,8 +357,8 @@ void ChromeResourceDispatcherHostDelegate::RequestBeginning(
// Check if we need to add merge session throttle. This throttle will postpone
// loading of main frames and XHR request.
- if (resource_type == ResourceType::MAIN_FRAME ||
- resource_type == ResourceType::XHR) {
+ if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME ||
+ resource_type == content::RESOURCE_TYPE_XHR) {
// Add interstitial page while merge session process (cookie
// reconstruction from OAuth2 refresh token in ChromeOS login) is still in
// progress while we are attempting to load a google property.
@@ -443,7 +443,7 @@ void ChromeResourceDispatcherHostDelegate::DownloadStarting(
if (!request->is_pending()) {
AppendStandardResourceThrottles(request,
resource_context,
- ResourceType::MAIN_FRAME,
+ content::RESOURCE_TYPE_MAIN_FRAME,
throttles);
}
}
@@ -480,7 +480,7 @@ bool ChromeResourceDispatcherHostDelegate::HandleExternalProtocol(
void ChromeResourceDispatcherHostDelegate::AppendStandardResourceThrottles(
net::URLRequest* request,
content::ResourceContext* resource_context,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
ScopedVector<content::ResourceThrottle>* throttles) {
ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context);
#if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING)
@@ -491,7 +491,8 @@ void ChromeResourceDispatcherHostDelegate::AppendStandardResourceThrottles(
|| io_data->IsDataReductionProxyEnabled()
#endif
) {
- bool is_subresource_request = resource_type != ResourceType::MAIN_FRAME;
+ bool is_subresource_request =
+ resource_type != content::RESOURCE_TYPE_MAIN_FRAME;
content::ResourceThrottle* throttle =
SafeBrowsingResourceThrottleFactory::Create(request,
resource_context,
@@ -503,7 +504,8 @@ void ChromeResourceDispatcherHostDelegate::AppendStandardResourceThrottles(
#endif
#if defined(ENABLE_MANAGED_USERS)
- bool is_subresource_request = resource_type != ResourceType::MAIN_FRAME;
+ bool is_subresource_request =
+ resource_type != content::RESOURCE_TYPE_MAIN_FRAME;
throttles->push_back(new SupervisedUserResourceThrottle(
request, !is_subresource_request,
io_data->supervised_user_url_filter()));
diff --git a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.h b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.h
index ee825fb..e6c2f83 100644
--- a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.h
+++ b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.h
@@ -43,13 +43,13 @@ class ChromeResourceDispatcherHostDelegate
int route_id,
const std::string& method,
const GURL& url,
- content::ResourceType::Type resource_type,
+ content::ResourceType resource_type,
content::ResourceContext* resource_context) OVERRIDE;
virtual void RequestBeginning(
net::URLRequest* request,
content::ResourceContext* resource_context,
content::AppCacheService* appcache_service,
- content::ResourceType::Type resource_type,
+ content::ResourceType resource_type,
int child_id,
int route_id,
ScopedVector<content::ResourceThrottle>* throttles) OVERRIDE;
@@ -105,7 +105,7 @@ class ChromeResourceDispatcherHostDelegate
void AppendStandardResourceThrottles(
net::URLRequest* request,
content::ResourceContext* resource_context,
- content::ResourceType::Type resource_type,
+ content::ResourceType resource_type,
ScopedVector<content::ResourceThrottle>* throttles);
#if defined(ENABLE_ONE_CLICK_SIGNIN)
diff --git a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate_browsertest.cc b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate_browsertest.cc
index 6784b6a..797e70d 100644
--- a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate_browsertest.cc
+++ b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate_browsertest.cc
@@ -63,7 +63,7 @@ class TestDispatcherHostDelegate : public ChromeResourceDispatcherHostDelegate {
net::URLRequest* request,
content::ResourceContext* resource_context,
content::AppCacheService* appcache_service,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
int child_id,
int route_id,
ScopedVector<content::ResourceThrottle>* throttles) OVERRIDE {
diff --git a/chrome/browser/safe_browsing/browser_feature_extractor.cc b/chrome/browser/safe_browsing/browser_feature_extractor.cc
index 50c0ae4..0a37c7f 100644
--- a/chrome/browser/safe_browsing/browser_feature_extractor.cc
+++ b/chrome/browser/safe_browsing/browser_feature_extractor.cc
@@ -59,7 +59,7 @@ void FilterBenignIpsOnIOThread(
IPUrlInfo::IPUrlInfo(const std::string& url,
const std::string& method,
const std::string& referrer,
- const ResourceType::Type& resource_type)
+ const ResourceType& resource_type)
: url(url),
method(method),
referrer(referrer),
diff --git a/chrome/browser/safe_browsing/browser_feature_extractor.h b/chrome/browser/safe_browsing/browser_feature_extractor.h
index c077e3b..ef8f3ff 100644
--- a/chrome/browser/safe_browsing/browser_feature_extractor.h
+++ b/chrome/browser/safe_browsing/browser_feature_extractor.h
@@ -45,12 +45,12 @@ struct IPUrlInfo {
std::string url;
std::string method;
std::string referrer;
- content::ResourceType::Type resource_type;
+ content::ResourceType resource_type;
IPUrlInfo(const std::string& url,
const std::string& method,
const std::string& referrer,
- const content::ResourceType::Type& resource_type);
+ const content::ResourceType& resource_type);
~IPUrlInfo();
};
diff --git a/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc b/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc
index 26c489d..d02ae93 100644
--- a/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc
+++ b/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc
@@ -599,15 +599,15 @@ TEST_F(BrowserFeatureExtractorTest, MalwareFeatures) {
request.set_url("http://www.foo.com/");
std::vector<IPUrlInfo> bad_urls;
- bad_urls.push_back(IPUrlInfo("http://bad.com", "GET", "",
- ResourceType::SCRIPT));
- bad_urls.push_back(IPUrlInfo("http://evil.com", "GET", "",
- ResourceType::SCRIPT));
+ bad_urls.push_back(
+ IPUrlInfo("http://bad.com", "GET", "", content::RESOURCE_TYPE_SCRIPT));
+ bad_urls.push_back(
+ IPUrlInfo("http://evil.com", "GET", "", content::RESOURCE_TYPE_SCRIPT));
browse_info_->ips.insert(std::make_pair("193.5.163.8", bad_urls));
browse_info_->ips.insert(std::make_pair("92.92.92.92", bad_urls));
std::vector<IPUrlInfo> good_urls;
- good_urls.push_back(IPUrlInfo("http://ok.com", "GET", "",
- ResourceType::SCRIPT));
+ good_urls.push_back(
+ IPUrlInfo("http://ok.com", "GET", "", content::RESOURCE_TYPE_SCRIPT));
browse_info_->ips.insert(std::make_pair("23.94.78.1", good_urls));
EXPECT_CALL(*db_manager_, MatchMalwareIP("193.5.163.8"))
.WillOnce(Return(true));
@@ -639,8 +639,8 @@ TEST_F(BrowserFeatureExtractorTest, MalwareFeatures_ExceedLimit) {
request.set_url("http://www.foo.com/");
std::vector<IPUrlInfo> bad_urls;
- bad_urls.push_back(IPUrlInfo("http://bad.com", "GET", "",
- ResourceType::SCRIPT));
+ bad_urls.push_back(
+ IPUrlInfo("http://bad.com", "GET", "", content::RESOURCE_TYPE_SCRIPT));
std::vector<std::string> ips;
for (int i = 0; i < 7; ++i) { // Add 7 ips
std::string ip = base::StringPrintf("%d.%d.%d.%d", i, i, i, i);
diff --git a/chrome/browser/safe_browsing/client_side_detection_host.cc b/chrome/browser/safe_browsing/client_side_detection_host.cc
index d81b392..89a4196 100644
--- a/chrome/browser/safe_browsing/client_side_detection_host.cc
+++ b/chrome/browser/safe_browsing/client_side_detection_host.cc
@@ -678,12 +678,11 @@ void ClientSideDetectionHost::MalwareFeatureExtractionDone(
}
}
-void ClientSideDetectionHost::UpdateIPUrlMap(
- const std::string& ip,
- const std::string& url,
- const std::string& method,
- const std::string& referrer,
- const ResourceType::Type resource_type) {
+void ClientSideDetectionHost::UpdateIPUrlMap(const std::string& ip,
+ const std::string& url,
+ const std::string& method,
+ const std::string& referrer,
+ const ResourceType resource_type) {
if (ip.empty() || url.empty())
return;
diff --git a/chrome/browser/safe_browsing/client_side_detection_host.h b/chrome/browser/safe_browsing/client_side_detection_host.h
index c74bd6d..6a8de53 100644
--- a/chrome/browser/safe_browsing/client_side_detection_host.h
+++ b/chrome/browser/safe_browsing/client_side_detection_host.h
@@ -118,7 +118,7 @@ class ClientSideDetectionHost : public content::WebContentsObserver,
const std::string& url,
const std::string& method,
const std::string& referrer,
- const content::ResourceType::Type resource_type);
+ const content::ResourceType resource_type);
// From NotificationObserver. Called when a notification comes in. This
// method is called in the UI thread.
diff --git a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc
index 8e153c3..20590b5 100644
--- a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc
+++ b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc
@@ -250,7 +250,7 @@ class ClientSideDetectionHostTest : public ChromeRenderViewHostTestHarness {
}
void UpdateIPUrlMap(const std::string& ip, const std::string& host) {
- csd_host_->UpdateIPUrlMap(ip, host, "", "", ResourceType::OBJECT);
+ csd_host_->UpdateIPUrlMap(ip, host, "", "", content::RESOURCE_TYPE_OBJECT);
}
BrowseInfo* GetBrowseInfo() {
@@ -836,7 +836,8 @@ TEST_F(ClientSideDetectionHostTest, UpdateIPUrlMap) {
std::vector<IPUrlInfo> expected_urls;
for (int i = 0; i < 20; i++) {
std::string url = base::StringPrintf("http://%d.com/", i);
- expected_urls.push_back(IPUrlInfo(url, "", "", ResourceType::OBJECT));
+ expected_urls.push_back(
+ IPUrlInfo(url, "", "", content::RESOURCE_TYPE_OBJECT));
UpdateIPUrlMap("250.10.10.10", url);
}
ASSERT_EQ(1U, browse_info->ips.size());
@@ -855,8 +856,8 @@ TEST_F(ClientSideDetectionHostTest, UpdateIPUrlMap) {
for (int i = 0; i < 199; i++) {
std::string ip = base::StringPrintf("%d.%d.%d.256", i, i, i);
expected_urls.clear();
- expected_urls.push_back(IPUrlInfo("test.com/", "", "",
- ResourceType::OBJECT));
+ expected_urls.push_back(
+ IPUrlInfo("test.com/", "", "", content::RESOURCE_TYPE_OBJECT));
UpdateIPUrlMap(ip, "test.com/");
ASSERT_EQ(1U, browse_info->ips[ip].size());
CheckIPUrlEqual(expected_urls,
@@ -874,8 +875,10 @@ TEST_F(ClientSideDetectionHostTest, UpdateIPUrlMap) {
UpdateIPUrlMap("100.100.100.256", "more.com/");
ASSERT_EQ(2U, browse_info->ips["100.100.100.256"].size());
expected_urls.clear();
- expected_urls.push_back(IPUrlInfo("test.com/", "", "", ResourceType::OBJECT));
- expected_urls.push_back(IPUrlInfo("more.com/", "", "", ResourceType::OBJECT));
+ expected_urls.push_back(
+ IPUrlInfo("test.com/", "", "", content::RESOURCE_TYPE_OBJECT));
+ expected_urls.push_back(
+ IPUrlInfo("more.com/", "", "", content::RESOURCE_TYPE_OBJECT));
CheckIPUrlEqual(expected_urls,
browse_info->ips["100.100.100.256"]);
}
diff --git a/chrome/browser/search/iframe_source_unittest.cc b/chrome/browser/search/iframe_source_unittest.cc
index 30aee8e..8baf16f 100644
--- a/chrome/browser/search/iframe_source_unittest.cc
+++ b/chrome/browser/search/iframe_source_unittest.cc
@@ -104,13 +104,14 @@ class IframeSourceTest : public testing::Test {
NULL,
resource_context_.GetRequestContext());
if (allocate_info) {
- content::ResourceRequestInfo::AllocateForTesting(request,
- ResourceType::SUB_FRAME,
- &resource_context_,
- render_process_id,
- render_frame_id,
- MSG_ROUTING_NONE,
- false);
+ content::ResourceRequestInfo::AllocateForTesting(
+ request,
+ content::RESOURCE_TYPE_SUB_FRAME,
+ &resource_context_,
+ render_process_id,
+ render_frame_id,
+ MSG_ROUTING_NONE,
+ false);
}
return request;
}
diff --git a/chrome/renderer/chrome_render_process_observer.cc b/chrome/renderer/chrome_render_process_observer.cc
index 1565729..55ddc80 100644
--- a/chrome/renderer/chrome_render_process_observer.cc
+++ b/chrome/renderer/chrome_render_process_observer.cc
@@ -67,7 +67,7 @@ class RendererResourceDelegate : public content::ResourceDispatcherDelegate {
virtual content::RequestPeer* OnRequestComplete(
content::RequestPeer* current_peer,
- content::ResourceType::Type resource_type,
+ content::ResourceType resource_type,
int error_code) OVERRIDE {
// Update the browser about our cache.
// Rate limit informing the host of our cache stats.
diff --git a/chrome/renderer/security_filter_peer.cc b/chrome/renderer/security_filter_peer.cc
index ad76a31..4a2ad8b 100644
--- a/chrome/renderer/security_filter_peer.cc
+++ b/chrome/renderer/security_filter_peer.cc
@@ -21,7 +21,7 @@ SecurityFilterPeer::~SecurityFilterPeer() {
// static
SecurityFilterPeer*
SecurityFilterPeer::CreateSecurityFilterPeerForDeniedRequest(
- content::ResourceType::Type resource_type,
+ content::ResourceType resource_type,
content::RequestPeer* peer,
int os_error) {
// Create a filter for SSL and CERT errors.
@@ -40,7 +40,7 @@ SecurityFilterPeer::CreateSecurityFilterPeerForDeniedRequest(
case net::ERR_CERT_NAME_CONSTRAINT_VIOLATION:
case net::ERR_INSECURE_RESPONSE:
case net::ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN:
- if (content::ResourceType::IsFrame(resource_type))
+ if (content::IsResourceTypeFrame(resource_type))
return CreateSecurityFilterPeerForFrame(peer, os_error);
// Any other content is entirely filtered-out.
return new ReplaceContentPeer(peer, std::string(), std::string());
diff --git a/chrome/renderer/security_filter_peer.h b/chrome/renderer/security_filter_peer.h
index 3520fa9..8fa57497 100644
--- a/chrome/renderer/security_filter_peer.h
+++ b/chrome/renderer/security_filter_peer.h
@@ -21,7 +21,7 @@ class SecurityFilterPeer : public content::RequestPeer {
virtual ~SecurityFilterPeer();
static SecurityFilterPeer* CreateSecurityFilterPeerForDeniedRequest(
- content::ResourceType::Type resource_type,
+ content::ResourceType resource_type,
content::RequestPeer* peer,
int os_error);
diff --git a/chromecast/shell/browser/cast_content_browser_client.cc b/chromecast/shell/browser/cast_content_browser_client.cc
index 68d8391..fc1dac8 100644
--- a/chromecast/shell/browser/cast_content_browser_client.cc
+++ b/chromecast/shell/browser/cast_content_browser_client.cc
@@ -106,7 +106,7 @@ void CastContentBrowserClient::AllowCertificateError(
int cert_error,
const net::SSLInfo& ssl_info,
const GURL& request_url,
- content::ResourceType::Type resource_type,
+ content::ResourceType resource_type,
bool overridable,
bool strict_enforcement,
const base::Callback<void(bool)>& callback,
diff --git a/chromecast/shell/browser/cast_content_browser_client.h b/chromecast/shell/browser/cast_content_browser_client.h
index 0bfe197..8647cd2 100644
--- a/chromecast/shell/browser/cast_content_browser_client.h
+++ b/chromecast/shell/browser/cast_content_browser_client.h
@@ -43,7 +43,7 @@ class CastContentBrowserClient: public content::ContentBrowserClient {
int cert_error,
const net::SSLInfo& ssl_info,
const GURL& request_url,
- content::ResourceType::Type resource_type,
+ content::ResourceType resource_type,
bool overridable,
bool strict_enforcement,
const base::Callback<void(bool)>& callback,
diff --git a/components/navigation_interception/intercept_navigation_resource_throttle_unittest.cc b/components/navigation_interception/intercept_navigation_resource_throttle_unittest.cc
index b5c251f..1959a86 100644
--- a/components/navigation_interception/intercept_navigation_resource_throttle_unittest.cc
+++ b/components/navigation_interception/intercept_navigation_resource_throttle_unittest.cc
@@ -130,7 +130,7 @@ class TestIOThreadState {
render_frame_id != MSG_ROUTING_NONE) {
content::ResourceRequestInfo::AllocateForTesting(
&request_,
- ResourceType::MAIN_FRAME,
+ content::RESOURCE_TYPE_MAIN_FRAME,
&resource_context_,
render_process_id,
MSG_ROUTING_NONE,
diff --git a/content/browser/appcache/appcache_host.cc b/content/browser/appcache/appcache_host.cc
index db04dad..2e3c95a 100644
--- a/content/browser/appcache/appcache_host.cc
+++ b/content/browser/appcache/appcache_host.cc
@@ -285,7 +285,7 @@ AppCacheHost* AppCacheHost::GetParentAppCacheHost() const {
AppCacheRequestHandler* AppCacheHost::CreateRequestHandler(
net::URLRequest* request,
- ResourceType::Type resource_type) {
+ ResourceType resource_type) {
if (is_for_dedicated_worker()) {
AppCacheHost* parent_host = GetParentAppCacheHost();
if (parent_host)
diff --git a/content/browser/appcache/appcache_host.h b/content/browser/appcache/appcache_host.h
index 2201c8c..7a63d35 100644
--- a/content/browser/appcache/appcache_host.h
+++ b/content/browser/appcache/appcache_host.h
@@ -110,7 +110,8 @@ class CONTENT_EXPORT AppCacheHost
// Support for loading resources out of the appcache.
// May return NULL if the request isn't subject to retrieval from an appache.
AppCacheRequestHandler* CreateRequestHandler(
- net::URLRequest* request, ResourceType::Type resource_type);
+ net::URLRequest* request,
+ ResourceType resource_type);
// Support for devtools inspecting appcache resources.
void GetResourceList(std::vector<AppCacheResourceInfo>* resource_infos);
diff --git a/content/browser/appcache/appcache_interceptor.cc b/content/browser/appcache/appcache_interceptor.cc
index 76c5c0d..3385e54 100644
--- a/content/browser/appcache/appcache_interceptor.cc
+++ b/content/browser/appcache/appcache_interceptor.cc
@@ -18,8 +18,8 @@ AppCacheInterceptor* AppCacheInterceptor::GetInstance() {
return Singleton<AppCacheInterceptor>::get();
}
-void AppCacheInterceptor::SetHandler(
- net::URLRequest* request, AppCacheRequestHandler* handler) {
+void AppCacheInterceptor::SetHandler(net::URLRequest* request,
+ AppCacheRequestHandler* handler) {
request->SetUserData(GetInstance(), handler); // request takes ownership
}
@@ -30,8 +30,11 @@ AppCacheRequestHandler* AppCacheInterceptor::GetHandler(
}
void AppCacheInterceptor::SetExtraRequestInfo(
- net::URLRequest* request, AppCacheServiceImpl* service, int process_id,
- int host_id, ResourceType::Type resource_type) {
+ net::URLRequest* request,
+ AppCacheServiceImpl* service,
+ int process_id,
+ int host_id,
+ ResourceType resource_type) {
if (!service || (host_id == kAppCacheNoHostId))
return;
diff --git a/content/browser/appcache/appcache_interceptor.h b/content/browser/appcache/appcache_interceptor.h
index cbfcb24..b584919 100644
--- a/content/browser/appcache/appcache_interceptor.h
+++ b/content/browser/appcache/appcache_interceptor.h
@@ -31,7 +31,7 @@ class CONTENT_EXPORT AppCacheInterceptor
AppCacheServiceImpl* service,
int process_id,
int host_id,
- ResourceType::Type resource_type);
+ ResourceType resource_type);
// May be called after response headers are complete to retrieve extra
// info about the response.
diff --git a/content/browser/appcache/appcache_request_handler.cc b/content/browser/appcache/appcache_request_handler.cc
index 2db7a52..7987a99 100644
--- a/content/browser/appcache/appcache_request_handler.cc
+++ b/content/browser/appcache/appcache_request_handler.cc
@@ -13,12 +13,16 @@
namespace content {
-AppCacheRequestHandler::AppCacheRequestHandler(
- AppCacheHost* host, ResourceType::Type resource_type)
- : host_(host), resource_type_(resource_type),
- is_waiting_for_cache_selection_(false), found_group_id_(0),
- found_cache_id_(0), found_network_namespace_(false),
- cache_entry_not_found_(false), maybe_load_resource_executed_(false) {
+AppCacheRequestHandler::AppCacheRequestHandler(AppCacheHost* host,
+ ResourceType resource_type)
+ : host_(host),
+ resource_type_(resource_type),
+ is_waiting_for_cache_selection_(false),
+ found_group_id_(0),
+ found_cache_id_(0),
+ found_network_namespace_(false),
+ cache_entry_not_found_(false),
+ maybe_load_resource_executed_(false) {
DCHECK(host_);
host_->AddObserver(this);
}
@@ -210,7 +214,7 @@ void AppCacheRequestHandler::DeliverAppCachedResponse(
DCHECK(host_ && job_.get() && job_->is_waiting());
DCHECK(entry.has_response_id());
- if (ResourceType::IsFrame(resource_type_) && !namespace_entry_url.is_empty())
+ if (IsResourceTypeFrame(resource_type_) && !namespace_entry_url.is_empty())
host_->NotifyMainResourceIsNamespaceEntry(namespace_entry_url);
job_->DeliverAppCachedResponse(manifest_url, group_id, cache_id,
@@ -235,8 +239,8 @@ void AppCacheRequestHandler::MaybeLoadMainResource(
DCHECK(host_);
const AppCacheHost* spawning_host =
- ResourceType::IsSharedWorker(resource_type_) ?
- host_ : host_->GetSpawningHost();
+ (resource_type_ == RESOURCE_TYPE_SHARED_WORKER) ?
+ host_ : host_->GetSpawningHost();
GURL preferred_manifest_url = spawning_host ?
spawning_host->preferred_manifest_url() : GURL();
@@ -267,17 +271,17 @@ void AppCacheRequestHandler::OnMainResponseFound(
!policy->CanLoadAppCache(manifest_url, host_->first_party_url());
if (was_blocked_by_policy) {
- if (ResourceType::IsFrame(resource_type_)) {
+ if (IsResourceTypeFrame(resource_type_)) {
host_->NotifyMainResourceBlocked(manifest_url);
} else {
- DCHECK(ResourceType::IsSharedWorker(resource_type_));
+ DCHECK_EQ(resource_type_, RESOURCE_TYPE_SHARED_WORKER);
host_->frontend()->OnContentBlocked(host_->host_id(), manifest_url);
}
DeliverNetworkResponse();
return;
}
- if (ResourceType::IsFrame(resource_type_) && cache_id != kAppCacheNoCacheId) {
+ if (IsResourceTypeFrame(resource_type_) && cache_id != kAppCacheNoCacheId) {
// AppCacheHost loads and holds a reference to the main resource cache
// for two reasons, firstly to preload the cache into the working set
// in advance of subresource loads happening, secondly to prevent the
diff --git a/content/browser/appcache/appcache_request_handler.h b/content/browser/appcache/appcache_request_handler.h
index d851685..4ff72a3 100644
--- a/content/browser/appcache/appcache_request_handler.h
+++ b/content/browser/appcache/appcache_request_handler.h
@@ -50,16 +50,16 @@ class CONTENT_EXPORT AppCacheRequestHandler
void PrepareForCrossSiteTransfer(int old_process_id);
void CompleteCrossSiteTransfer(int new_process_id, int new_host_id);
- static bool IsMainResourceType(ResourceType::Type type) {
- return ResourceType::IsFrame(type) ||
- ResourceType::IsSharedWorker(type);
+ static bool IsMainResourceType(ResourceType type) {
+ return IsResourceTypeFrame(type) ||
+ type == RESOURCE_TYPE_SHARED_WORKER;
}
private:
friend class AppCacheHost;
// Callers should use AppCacheHost::CreateRequestHandler.
- AppCacheRequestHandler(AppCacheHost* host, ResourceType::Type resource_type);
+ AppCacheRequestHandler(AppCacheHost* host, ResourceType resource_type);
// AppCacheHost::Observer override
virtual void OnDestructionImminent(AppCacheHost* host) OVERRIDE;
@@ -108,7 +108,7 @@ class CONTENT_EXPORT AppCacheRequestHandler
AppCacheHost* host_;
// Frame vs subresource vs sharedworker loads are somewhat different.
- ResourceType::Type resource_type_;
+ ResourceType resource_type_;
// Subresource requests wait until after cache selection completes.
bool is_waiting_for_cache_selection_;
diff --git a/content/browser/appcache/appcache_request_handler_unittest.cc b/content/browser/appcache/appcache_request_handler_unittest.cc
index e8cc8f6..6376a0f 100644
--- a/content/browser/appcache/appcache_request_handler_unittest.cc
+++ b/content/browser/appcache/appcache_request_handler_unittest.cc
@@ -265,7 +265,7 @@ class AppCacheRequestHandlerTest : public testing::Test {
request_.reset(new MockURLRequest(GURL("http://blah/"), &empty_context_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
- ResourceType::MAIN_FRAME));
+ RESOURCE_TYPE_MAIN_FRAME));
EXPECT_TRUE(handler_.get());
job_ = handler_->MaybeLoadResource(request_.get(),
@@ -312,7 +312,7 @@ class AppCacheRequestHandlerTest : public testing::Test {
request_.reset(new MockURLRequest(GURL("http://blah/"), &empty_context_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
- ResourceType::MAIN_FRAME));
+ RESOURCE_TYPE_MAIN_FRAME));
EXPECT_TRUE(handler_.get());
mock_storage()->SimulateFindMainResource(
@@ -360,7 +360,7 @@ class AppCacheRequestHandlerTest : public testing::Test {
request_.reset(new MockURLRequest(GURL("http://blah/"), &empty_context_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
- ResourceType::MAIN_FRAME));
+ RESOURCE_TYPE_MAIN_FRAME));
EXPECT_TRUE(handler_.get());
mock_storage()->SimulateFindMainResource(
@@ -442,7 +442,7 @@ class AppCacheRequestHandlerTest : public testing::Test {
request_.reset(new MockURLRequest(GURL("http://blah/fallback-override"),
&empty_context_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
- ResourceType::MAIN_FRAME));
+ RESOURCE_TYPE_MAIN_FRAME));
EXPECT_TRUE(handler_.get());
mock_storage()->SimulateFindMainResource(
@@ -494,7 +494,7 @@ class AppCacheRequestHandlerTest : public testing::Test {
void SubResource_Miss_WithNoCacheSelected() {
request_.reset(new MockURLRequest(GURL("http://blah/"), &empty_context_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
- ResourceType::SUB_RESOURCE));
+ RESOURCE_TYPE_SUB_RESOURCE));
// We avoid creating handler when possible, sub-resource requests are not
// subject to retrieval from an appcache when there's no associated cache.
@@ -512,7 +512,7 @@ class AppCacheRequestHandlerTest : public testing::Test {
request_.reset(new MockURLRequest(GURL("http://blah/"), &empty_context_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
- ResourceType::SUB_RESOURCE));
+ RESOURCE_TYPE_SUB_RESOURCE));
EXPECT_TRUE(handler_.get());
job_ = handler_->MaybeLoadResource(request_.get(),
@@ -543,7 +543,7 @@ class AppCacheRequestHandlerTest : public testing::Test {
request_.reset(new MockURLRequest(GURL("http://blah/"), &empty_context_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
- ResourceType::SUB_RESOURCE));
+ RESOURCE_TYPE_SUB_RESOURCE));
EXPECT_TRUE(handler_.get());
job_ = handler_->MaybeLoadResource(request_.get(),
request_->context()->network_delegate());
@@ -577,7 +577,7 @@ class AppCacheRequestHandlerTest : public testing::Test {
request_.reset(new MockURLRequest(GURL("http://blah/"), &empty_context_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
- ResourceType::SUB_RESOURCE));
+ RESOURCE_TYPE_SUB_RESOURCE));
EXPECT_TRUE(handler_.get());
job_ = handler_->MaybeLoadResource(request_.get(),
request_->context()->network_delegate());
@@ -609,7 +609,7 @@ class AppCacheRequestHandlerTest : public testing::Test {
request_.reset(new MockURLRequest(GURL("http://blah/"), &empty_context_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
- ResourceType::SUB_RESOURCE));
+ RESOURCE_TYPE_SUB_RESOURCE));
EXPECT_TRUE(handler_.get());
job_ = handler_->MaybeLoadResource(request_.get(),
request_->context()->network_delegate());
@@ -642,7 +642,7 @@ class AppCacheRequestHandlerTest : public testing::Test {
request_.reset(new MockURLRequest(GURL("http://blah/"), &empty_context_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
- ResourceType::SUB_RESOURCE));
+ RESOURCE_TYPE_SUB_RESOURCE));
EXPECT_TRUE(handler_.get());
job_ = handler_->MaybeLoadResource(request_.get(),
request_->context()->network_delegate());
@@ -676,7 +676,7 @@ class AppCacheRequestHandlerTest : public testing::Test {
request_.reset(new MockURLRequest(GURL("http://blah/"), &empty_context_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
- ResourceType::SUB_RESOURCE));
+ RESOURCE_TYPE_SUB_RESOURCE));
EXPECT_TRUE(handler_.get());
job_ = handler_->MaybeLoadResource(request_.get(),
request_->context()->network_delegate());
@@ -705,7 +705,7 @@ class AppCacheRequestHandlerTest : public testing::Test {
request_.reset(new MockURLRequest(GURL("http://blah/"), &empty_context_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
- ResourceType::SUB_RESOURCE));
+ RESOURCE_TYPE_SUB_RESOURCE));
EXPECT_TRUE(handler_.get());
backend_impl_->UnregisterHost(1);
@@ -731,7 +731,7 @@ class AppCacheRequestHandlerTest : public testing::Test {
request_.reset(new MockURLRequest(GURL("http://blah/"), &empty_context_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
- ResourceType::SUB_RESOURCE));
+ RESOURCE_TYPE_SUB_RESOURCE));
EXPECT_TRUE(handler_.get());
job_ = handler_->MaybeLoadResource(request_.get(),
@@ -763,7 +763,7 @@ class AppCacheRequestHandlerTest : public testing::Test {
request_.reset(new MockURLRequest(GURL("ftp://blah/"), &empty_context_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
- ResourceType::SUB_RESOURCE));
+ RESOURCE_TYPE_SUB_RESOURCE));
EXPECT_TRUE(handler_.get()); // we could redirect to http (conceivably)
EXPECT_FALSE(handler_->MaybeLoadResource(
@@ -783,7 +783,7 @@ class AppCacheRequestHandlerTest : public testing::Test {
void CanceledRequest() {
request_.reset(new MockURLRequest(GURL("http://blah/"), &empty_context_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
- ResourceType::MAIN_FRAME));
+ RESOURCE_TYPE_MAIN_FRAME));
EXPECT_TRUE(handler_.get());
job_ = handler_->MaybeLoadResource(request_.get(),
@@ -809,13 +809,13 @@ class AppCacheRequestHandlerTest : public testing::Test {
void WorkerRequest() {
EXPECT_TRUE(AppCacheRequestHandler::IsMainResourceType(
- ResourceType::MAIN_FRAME));
+ RESOURCE_TYPE_MAIN_FRAME));
EXPECT_TRUE(AppCacheRequestHandler::IsMainResourceType(
- ResourceType::SUB_FRAME));
+ RESOURCE_TYPE_SUB_FRAME));
EXPECT_TRUE(AppCacheRequestHandler::IsMainResourceType(
- ResourceType::SHARED_WORKER));
+ RESOURCE_TYPE_SHARED_WORKER));
EXPECT_FALSE(AppCacheRequestHandler::IsMainResourceType(
- ResourceType::WORKER));
+ RESOURCE_TYPE_WORKER));
request_.reset(new MockURLRequest(GURL("http://blah/"), &empty_context_));
@@ -828,7 +828,7 @@ class AppCacheRequestHandlerTest : public testing::Test {
AppCacheHost* worker_host = backend_impl_->GetHost(kWorkerHostId);
worker_host->SelectCacheForWorker(kParentHostId, kMockProcessId);
handler_.reset(worker_host->CreateRequestHandler(
- request_.get(), ResourceType::SHARED_WORKER));
+ request_.get(), RESOURCE_TYPE_SHARED_WORKER));
EXPECT_TRUE(handler_.get());
// Verify that the handler is associated with the parent host.
EXPECT_EQ(host_, handler_->host_);
@@ -841,7 +841,7 @@ class AppCacheRequestHandlerTest : public testing::Test {
EXPECT_EQ(NULL, backend_impl_->GetHost(kNonExsitingHostId));
worker_host->SelectCacheForWorker(kNonExsitingHostId, kMockProcessId);
handler_.reset(worker_host->CreateRequestHandler(
- request_.get(), ResourceType::SHARED_WORKER));
+ request_.get(), RESOURCE_TYPE_SHARED_WORKER));
EXPECT_FALSE(handler_.get());
TestFinished();
@@ -856,7 +856,7 @@ class AppCacheRequestHandlerTest : public testing::Test {
request_.reset(new MockURLRequest(GURL("http://blah/"), &empty_context_));
handler_.reset(host_->CreateRequestHandler(request_.get(),
- ResourceType::MAIN_FRAME));
+ RESOURCE_TYPE_MAIN_FRAME));
EXPECT_TRUE(handler_.get());
mock_policy_->can_load_return_value_ = false;
diff --git a/content/browser/appcache/appcache_storage_impl_unittest.cc b/content/browser/appcache/appcache_storage_impl_unittest.cc
index da3bb56..1c2154e 100644
--- a/content/browser/appcache/appcache_storage_impl_unittest.cc
+++ b/content/browser/appcache/appcache_storage_impl_unittest.cc
@@ -1768,7 +1768,7 @@ class AppCacheStorageImplTest : public testing::Test {
AppCacheInterceptor::SetExtraRequestInfo(
request_.get(), service_.get(),
backend_->process_id(), host2->host_id(),
- ResourceType::MAIN_FRAME);
+ RESOURCE_TYPE_MAIN_FRAME);
request_->Start();
}
diff --git a/content/browser/child_process_security_policy_impl.cc b/content/browser/child_process_security_policy_impl.cc
index 68f4e81..3f8e216 100644
--- a/content/browser/child_process_security_policy_impl.cc
+++ b/content/browser/child_process_security_policy_impl.cc
@@ -580,14 +580,13 @@ void ChildProcessSecurityPolicyImpl::RevokeReadRawCookies(int child_id) {
state->second->RevokeReadRawCookies();
}
-bool ChildProcessSecurityPolicyImpl::CanLoadPage(
- int child_id,
- const GURL& url,
- ResourceType::Type resource_type) {
+bool ChildProcessSecurityPolicyImpl::CanLoadPage(int child_id,
+ const GURL& url,
+ ResourceType resource_type) {
// If --site-per-process flag is passed, we should enforce
// stronger security restrictions on page navigation.
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess) &&
- ResourceType::IsFrame(resource_type)) {
+ IsResourceTypeFrame(resource_type)) {
// TODO(nasko): Do the proper check for site-per-process, once
// out-of-process iframes is ready to go.
return true;
diff --git a/content/browser/child_process_security_policy_impl.h b/content/browser/child_process_security_policy_impl.h
index 3cd1dd3..9699215 100644
--- a/content/browser/child_process_security_policy_impl.h
+++ b/content/browser/child_process_security_policy_impl.h
@@ -140,7 +140,7 @@ class CONTENT_EXPORT ChildProcessSecurityPolicyImpl
// Only might return false if --site-per-process flag is used.
bool CanLoadPage(int child_id,
const GURL& url,
- ResourceType::Type resource_type);
+ ResourceType resource_type);
// Explicit permissions checks for FileSystemURL specified files.
bool CanReadFileSystemFile(int child_id, const fileapi::FileSystemURL& url);
diff --git a/content/browser/cross_site_transfer_browsertest.cc b/content/browser/cross_site_transfer_browsertest.cc
index 9d2d1cc..05837b5 100644
--- a/content/browser/cross_site_transfer_browsertest.cc
+++ b/content/browser/cross_site_transfer_browsertest.cc
@@ -37,7 +37,7 @@ class TrackingResourceDispatcherHostDelegate
net::URLRequest* request,
ResourceContext* resource_context,
AppCacheService* appcache_service,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
int child_id,
int route_id,
ScopedVector<ResourceThrottle>* throttles) OVERRIDE {
diff --git a/content/browser/loader/async_resource_handler.cc b/content/browser/loader/async_resource_handler.cc
index 69e831bd2..825fc2f4 100644
--- a/content/browser/loader/async_resource_handler.cc
+++ b/content/browser/loader/async_resource_handler.cc
@@ -185,7 +185,7 @@ bool AsyncResourceHandler::OnResponseStarted(ResourceResponse* response,
HostZoomMap* host_zoom_map =
GetHostZoomMapForResourceContext(info->GetContext());
- if (info->GetResourceType() == ResourceType::MAIN_FRAME && host_zoom_map) {
+ if (info->GetResourceType() == RESOURCE_TYPE_MAIN_FRAME && host_zoom_map) {
const GURL& request_url = request()->url();
info->filter()->Send(new ViewMsg_SetZoomLevelForLoadingURL(
info->GetRouteID(),
diff --git a/content/browser/loader/cross_site_resource_handler.cc b/content/browser/loader/cross_site_resource_handler.cc
index ad6397a..f8a5e37 100644
--- a/content/browser/loader/cross_site_resource_handler.cc
+++ b/content/browser/loader/cross_site_resource_handler.cc
@@ -134,7 +134,7 @@ bool CrossSiteResourceHandler::OnRequestRedirected(
bool* defer) {
// Top-level requests change their cookie first-party URL on redirects, while
// subframes retain the parent's value.
- if (GetRequestInfo()->GetResourceType() == ResourceType::MAIN_FRAME)
+ if (GetRequestInfo()->GetResourceType() == RESOURCE_TYPE_MAIN_FRAME)
request()->set_first_party_for_cookies(new_url);
// We should not have started the transition before being redirected.
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc
index b132d95..b72e96a2 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;
diff --git a/content/browser/loader/resource_dispatcher_host_unittest.cc b/content/browser/loader/resource_dispatcher_host_unittest.cc
index 32ef5ed..c798b19 100644
--- a/content/browser/loader/resource_dispatcher_host_unittest.cc
+++ b/content/browser/loader/resource_dispatcher_host_unittest.cc
@@ -125,10 +125,9 @@ static int RequestIDForMessage(const IPC::Message& msg) {
return request_id;
}
-static ResourceHostMsg_Request CreateResourceRequest(
- const char* method,
- ResourceType::Type type,
- const GURL& url) {
+static ResourceHostMsg_Request CreateResourceRequest(const char* method,
+ ResourceType type,
+ const GURL& url) {
ResourceHostMsg_Request request;
request.method = std::string(method);
request.url = url;
@@ -662,7 +661,7 @@ class TestResourceDispatcherHostDelegate
net::URLRequest* request,
ResourceContext* resource_context,
AppCacheService* appcache_service,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
int child_id,
int route_id,
ScopedVector<ResourceThrottle>* throttles) OVERRIDE {
@@ -798,9 +797,10 @@ class ResourceDispatcherHostTest : public testing::Test,
// Generates a request using the given filter and resource type.
void MakeTestRequestWithResourceType(ResourceMessageFilter* filter,
- int render_view_id, int request_id,
+ int render_view_id,
+ int request_id,
const GURL& url,
- ResourceType::Type type);
+ ResourceType type);
void CancelRequest(int request_id);
void RendererCancelRequest(int request_id) {
@@ -892,7 +892,7 @@ void ResourceDispatcherHostTest::MakeTestRequest(int render_view_id,
int request_id,
const GURL& url) {
MakeTestRequestWithResourceType(filter_.get(), render_view_id, request_id,
- url, ResourceType::SUB_RESOURCE);
+ url, RESOURCE_TYPE_SUB_RESOURCE);
}
void ResourceDispatcherHostTest::MakeTestRequestWithResourceType(
@@ -900,7 +900,7 @@ void ResourceDispatcherHostTest::MakeTestRequestWithResourceType(
int render_view_id,
int request_id,
const GURL& url,
- ResourceType::Type type) {
+ ResourceType type) {
ResourceHostMsg_Request request =
CreateResourceRequest("GET", type, url);
ResourceHostMsg_RequestResource msg(render_view_id, request_id, request);
@@ -1039,7 +1039,7 @@ TEST_F(ResourceDispatcherHostTest, TestMany) {
MakeTestRequest(0, 3, net::URLRequestTestJob::test_url_3());
MakeTestRequestWithResourceType(filter_.get(), 0, 4,
net::URLRequestTestJob::test_url_4(),
- ResourceType::PREFETCH); // detachable type
+ RESOURCE_TYPE_PREFETCH); // detachable type
MakeTestRequest(0, 5, net::URLRequestTestJob::test_url_redirect_to_url_2());
// Finish the redirection
@@ -1073,7 +1073,7 @@ TEST_F(ResourceDispatcherHostTest, Cancel) {
MakeTestRequestWithResourceType(filter_.get(), 0, 4,
net::URLRequestTestJob::test_url_4(),
- ResourceType::PREFETCH); // detachable type
+ RESOURCE_TYPE_PREFETCH); // detachable type
CancelRequest(2);
@@ -1124,7 +1124,7 @@ TEST_F(ResourceDispatcherHostTest, Cancel) {
TEST_F(ResourceDispatcherHostTest, DetachedResourceTimesOut) {
MakeTestRequestWithResourceType(filter_.get(), 0, 1,
net::URLRequestTestJob::test_url_2(),
- ResourceType::PREFETCH); // detachable type
+ RESOURCE_TYPE_PREFETCH); // detachable type
GlobalRequestID global_request_id(filter_->child_id(), 1);
ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(
host_.GetURLRequest(global_request_id));
@@ -1166,9 +1166,9 @@ TEST_F(ResourceDispatcherHostTest, DetachedResourceTimesOut) {
TEST_F(ResourceDispatcherHostTest, DeletedFilterDetached) {
// test_url_1's data is available synchronously, so use 2 and 3.
ResourceHostMsg_Request request_prefetch = CreateResourceRequest(
- "GET", ResourceType::PREFETCH, net::URLRequestTestJob::test_url_2());
+ "GET", RESOURCE_TYPE_PREFETCH, net::URLRequestTestJob::test_url_2());
ResourceHostMsg_Request request_ping = CreateResourceRequest(
- "GET", ResourceType::PING, net::URLRequestTestJob::test_url_3());
+ "GET", RESOURCE_TYPE_PING, net::URLRequestTestJob::test_url_3());
ResourceHostMsg_RequestResource msg_prefetch(0, 1, request_prefetch);
host_.OnMessageReceived(msg_prefetch, filter_);
@@ -1217,7 +1217,7 @@ TEST_F(ResourceDispatcherHostTest, DeletedFilterDetached) {
// resources should continue to load, even when redirected.
TEST_F(ResourceDispatcherHostTest, DeletedFilterDetachedRedirect) {
ResourceHostMsg_Request request = CreateResourceRequest(
- "GET", ResourceType::PREFETCH,
+ "GET", RESOURCE_TYPE_PREFETCH,
net::URLRequestTestJob::test_url_redirect_to_url_2());
ResourceHostMsg_RequestResource msg(0, 1, request);
@@ -1297,7 +1297,7 @@ TEST_F(ResourceDispatcherHostTest, DetachWhileStartIsDeferred) {
MakeTestRequestWithResourceType(filter_.get(), 0, 1,
net::URLRequestTestJob::test_url_1(),
- ResourceType::PREFETCH); // detachable type
+ RESOURCE_TYPE_PREFETCH); // detachable type
// Cancel request must come from the renderer for a detachable resource to
// detach.
RendererCancelRequest(1);
@@ -1463,11 +1463,11 @@ TEST_F(ResourceDispatcherHostTest, TestProcessCancel) {
// request 1 goes to the test delegate
ResourceHostMsg_Request request = CreateResourceRequest(
- "GET", ResourceType::SUB_RESOURCE, net::URLRequestTestJob::test_url_1());
+ "GET", RESOURCE_TYPE_SUB_RESOURCE, net::URLRequestTestJob::test_url_1());
MakeTestRequestWithResourceType(test_filter.get(), 0, 1,
net::URLRequestTestJob::test_url_1(),
- ResourceType::SUB_RESOURCE);
+ RESOURCE_TYPE_SUB_RESOURCE);
// request 2 goes to us
MakeTestRequest(0, 2, net::URLRequestTestJob::test_url_2());
@@ -1475,12 +1475,12 @@ TEST_F(ResourceDispatcherHostTest, TestProcessCancel) {
// request 3 goes to the test delegate
MakeTestRequestWithResourceType(test_filter.get(), 0, 3,
net::URLRequestTestJob::test_url_3(),
- ResourceType::SUB_RESOURCE);
+ RESOURCE_TYPE_SUB_RESOURCE);
// request 4 goes to us
MakeTestRequestWithResourceType(filter_.get(), 0, 4,
net::URLRequestTestJob::test_url_4(),
- ResourceType::PREFETCH); // detachable type
+ RESOURCE_TYPE_PREFETCH); // detachable type
// Make sure all requests have finished stage one. test_url_1 will have
@@ -1537,7 +1537,7 @@ TEST_F(ResourceDispatcherHostTest, TestProcessCancel) {
TEST_F(ResourceDispatcherHostTest, TestProcessCancelDetachedTimesOut) {
MakeTestRequestWithResourceType(filter_.get(), 0, 1,
net::URLRequestTestJob::test_url_4(),
- ResourceType::PREFETCH); // detachable type
+ RESOURCE_TYPE_PREFETCH); // detachable type
GlobalRequestID global_request_id(filter_->child_id(), 1);
ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(
host_.GetURLRequest(global_request_id));
@@ -1648,7 +1648,7 @@ TEST_F(ResourceDispatcherHostTest, TestBlockingCancelingRequests) {
// Blocked detachable resources should not delay cancellation.
MakeTestRequestWithResourceType(filter_.get(), 1, 5,
net::URLRequestTestJob::test_url_4(),
- ResourceType::PREFETCH); // detachable type
+ RESOURCE_TYPE_PREFETCH); // detachable type
// Flush all the pending requests.
while (net::URLRequestTestJob::ProcessOnePendingMessage()) {}
@@ -1682,19 +1682,19 @@ TEST_F(ResourceDispatcherHostTest, TestBlockedRequestsProcessDies) {
MakeTestRequestWithResourceType(filter_.get(), 0, 1,
net::URLRequestTestJob::test_url_1(),
- ResourceType::SUB_RESOURCE);
+ RESOURCE_TYPE_SUB_RESOURCE);
MakeTestRequestWithResourceType(second_filter.get(), 0, 2,
net::URLRequestTestJob::test_url_2(),
- ResourceType::SUB_RESOURCE);
+ RESOURCE_TYPE_SUB_RESOURCE);
MakeTestRequestWithResourceType(filter_.get(), 0, 3,
net::URLRequestTestJob::test_url_3(),
- ResourceType::SUB_RESOURCE);
+ RESOURCE_TYPE_SUB_RESOURCE);
MakeTestRequestWithResourceType(second_filter.get(), 0, 4,
net::URLRequestTestJob::test_url_1(),
- ResourceType::SUB_RESOURCE);
+ RESOURCE_TYPE_SUB_RESOURCE);
MakeTestRequestWithResourceType(second_filter.get(), 0, 5,
net::URLRequestTestJob::test_url_4(),
- ResourceType::PREFETCH); // detachable type
+ RESOURCE_TYPE_PREFETCH); // detachable type
// Simulate process death.
host_.CancelRequestsForProcess(second_filter->child_id());
@@ -1730,28 +1730,28 @@ TEST_F(ResourceDispatcherHostTest, TestBlockedRequestsDontLeak) {
MakeTestRequestWithResourceType(filter_.get(), 0, 1,
net::URLRequestTestJob::test_url_1(),
- ResourceType::SUB_RESOURCE);
+ RESOURCE_TYPE_SUB_RESOURCE);
MakeTestRequestWithResourceType(filter_.get(), 1, 2,
net::URLRequestTestJob::test_url_2(),
- ResourceType::SUB_RESOURCE);
+ RESOURCE_TYPE_SUB_RESOURCE);
MakeTestRequestWithResourceType(filter_.get(), 0, 3,
net::URLRequestTestJob::test_url_3(),
- ResourceType::SUB_RESOURCE);
+ RESOURCE_TYPE_SUB_RESOURCE);
MakeTestRequestWithResourceType(second_filter.get(), 1, 4,
net::URLRequestTestJob::test_url_1(),
- ResourceType::SUB_RESOURCE);
+ RESOURCE_TYPE_SUB_RESOURCE);
MakeTestRequestWithResourceType(filter_.get(), 2, 5,
net::URLRequestTestJob::test_url_2(),
- ResourceType::SUB_RESOURCE);
+ RESOURCE_TYPE_SUB_RESOURCE);
MakeTestRequestWithResourceType(filter_.get(), 2, 6,
net::URLRequestTestJob::test_url_3(),
- ResourceType::SUB_RESOURCE);
+ RESOURCE_TYPE_SUB_RESOURCE);
MakeTestRequestWithResourceType(filter_.get(), 0, 7,
net::URLRequestTestJob::test_url_4(),
- ResourceType::PREFETCH); // detachable type
+ RESOURCE_TYPE_PREFETCH); // detachable type
MakeTestRequestWithResourceType(second_filter.get(), 1, 8,
net::URLRequestTestJob::test_url_4(),
- ResourceType::PREFETCH); // detachable type
+ RESOURCE_TYPE_PREFETCH); // detachable type
host_.CancelRequestsForProcess(filter_->child_id());
host_.CancelRequestsForProcess(second_filter->child_id());
@@ -1812,25 +1812,25 @@ TEST_F(ResourceDispatcherHostTest, TooMuchOutstandingRequestsMemory) {
for (size_t i = 0; i < kMaxRequests; ++i) {
MakeTestRequestWithResourceType(filter_.get(), 0, i + 1,
net::URLRequestTestJob::test_url_2(),
- ResourceType::SUB_RESOURCE);
+ RESOURCE_TYPE_SUB_RESOURCE);
}
// Issue two more requests for our process -- these should fail immediately.
MakeTestRequestWithResourceType(filter_.get(), 0, kMaxRequests + 1,
net::URLRequestTestJob::test_url_2(),
- ResourceType::SUB_RESOURCE);
+ RESOURCE_TYPE_SUB_RESOURCE);
MakeTestRequestWithResourceType(filter_.get(), 0, kMaxRequests + 2,
net::URLRequestTestJob::test_url_2(),
- ResourceType::SUB_RESOURCE);
+ RESOURCE_TYPE_SUB_RESOURCE);
// Issue two requests for the second process -- these should succeed since
// it is just process 0 that is saturated.
MakeTestRequestWithResourceType(second_filter.get(), 0, kMaxRequests + 3,
net::URLRequestTestJob::test_url_2(),
- ResourceType::SUB_RESOURCE);
+ RESOURCE_TYPE_SUB_RESOURCE);
MakeTestRequestWithResourceType(second_filter.get(), 0, kMaxRequests + 4,
net::URLRequestTestJob::test_url_2(),
- ResourceType::SUB_RESOURCE);
+ RESOURCE_TYPE_SUB_RESOURCE);
// Flush all the pending requests.
while (net::URLRequestTestJob::ProcessOnePendingMessage()) {}
@@ -1881,25 +1881,25 @@ TEST_F(ResourceDispatcherHostTest, TooManyOutstandingRequests) {
for (size_t i = 0; i < kMaxRequestsPerProcess; ++i) {
MakeTestRequestWithResourceType(filter_.get(), 0, i + 1,
net::URLRequestTestJob::test_url_2(),
- ResourceType::SUB_RESOURCE);
+ RESOURCE_TYPE_SUB_RESOURCE);
}
// Issue another request for our process -- this should fail immediately.
MakeTestRequestWithResourceType(filter_.get(), 0, kMaxRequestsPerProcess + 1,
net::URLRequestTestJob::test_url_2(),
- ResourceType::SUB_RESOURCE);
+ RESOURCE_TYPE_SUB_RESOURCE);
// Issue a request for the second process -- this should succeed, because it
// is just process 0 that is saturated.
MakeTestRequestWithResourceType(
second_filter.get(), 0, kMaxRequestsPerProcess + 2,
- net::URLRequestTestJob::test_url_2(), ResourceType::SUB_RESOURCE);
+ net::URLRequestTestJob::test_url_2(), RESOURCE_TYPE_SUB_RESOURCE);
// Issue a request for the third process -- this should fail, because the
// global limit has been reached.
MakeTestRequestWithResourceType(
third_filter.get(), 0, kMaxRequestsPerProcess + 3,
- net::URLRequestTestJob::test_url_2(), ResourceType::SUB_RESOURCE);
+ net::URLRequestTestJob::test_url_2(), RESOURCE_TYPE_SUB_RESOURCE);
// Flush all the pending requests.
while (net::URLRequestTestJob::ProcessOnePendingMessage()) {}
@@ -2043,7 +2043,7 @@ TEST_F(ResourceDispatcherHostTest, ForbiddenDownload) {
// Only MAIN_FRAMEs can trigger a download.
MakeTestRequestWithResourceType(filter_.get(), 0, 1, GURL("http:bla"),
- ResourceType::MAIN_FRAME);
+ RESOURCE_TYPE_MAIN_FRAME);
// Flush all pending requests.
while (net::URLRequestTestJob::ProcessOnePendingMessage()) {}
@@ -2089,7 +2089,7 @@ TEST_F(ResourceDispatcherHostTest, IgnoreCancelForDownloads) {
MakeTestRequestWithResourceType(filter_.get(), render_view_id, request_id,
GURL("http://example.com/blah"),
- ResourceType::MAIN_FRAME);
+ RESOURCE_TYPE_MAIN_FRAME);
// Return some data so that the request is identified as a download
// and the proper resource handlers are created.
EXPECT_TRUE(net::URLRequestTestJob::ProcessOnePendingMessage());
@@ -2124,7 +2124,7 @@ TEST_F(ResourceDispatcherHostTest, CancelRequestsForContext) {
MakeTestRequestWithResourceType(filter_.get(), render_view_id, request_id,
GURL("http://example.com/blah"),
- ResourceType::MAIN_FRAME);
+ RESOURCE_TYPE_MAIN_FRAME);
// Return some data so that the request is identified as a download
// and the proper resource handlers are created.
EXPECT_TRUE(net::URLRequestTestJob::ProcessOnePendingMessage());
@@ -2155,7 +2155,7 @@ TEST_F(ResourceDispatcherHostTest, CancelRequestsForContextDetached) {
MakeTestRequestWithResourceType(filter_.get(), render_view_id, request_id,
net::URLRequestTestJob::test_url_4(),
- ResourceType::PREFETCH); // detachable type
+ RESOURCE_TYPE_PREFETCH); // detachable type
// Simulate a cancel coming from the renderer.
RendererCancelRequest(request_id);
@@ -2191,7 +2191,7 @@ TEST_F(ResourceDispatcherHostTest, CancelRequestsForContextTransferred) {
MakeTestRequestWithResourceType(filter_.get(), render_view_id, request_id,
GURL("http://example.com/blah"),
- ResourceType::MAIN_FRAME);
+ RESOURCE_TYPE_MAIN_FRAME);
GlobalRequestID global_request_id(filter_->child_id(), request_id);
@@ -2240,7 +2240,7 @@ TEST_F(ResourceDispatcherHostTest, TransferNavigationHtml) {
MakeTestRequestWithResourceType(filter_.get(), render_view_id, request_id,
GURL("http://example.com/blah"),
- ResourceType::MAIN_FRAME);
+ RESOURCE_TYPE_MAIN_FRAME);
// Now that we're blocked on the redirect, update the response and unblock by
// telling the AsyncResourceHandler to follow the redirect.
@@ -2266,7 +2266,7 @@ TEST_F(ResourceDispatcherHostTest, TransferNavigationHtml) {
int new_request_id = 2;
ResourceHostMsg_Request request =
- CreateResourceRequest("GET", ResourceType::MAIN_FRAME,
+ CreateResourceRequest("GET", RESOURCE_TYPE_MAIN_FRAME,
GURL("http://other.com/blech"));
request.transferred_request_child_id = filter_->child_id();
request.transferred_request_request_id = request_id;
@@ -2311,7 +2311,7 @@ TEST_F(ResourceDispatcherHostTest, TransferNavigationText) {
MakeTestRequestWithResourceType(filter_.get(), render_view_id, request_id,
GURL("http://example.com/blah"),
- ResourceType::MAIN_FRAME);
+ RESOURCE_TYPE_MAIN_FRAME);
// Now that we're blocked on the redirect, update the response and unblock by
// telling the AsyncResourceHandler to follow the redirect. Use a text/plain
@@ -2339,7 +2339,7 @@ TEST_F(ResourceDispatcherHostTest, TransferNavigationText) {
int new_request_id = 2;
ResourceHostMsg_Request request =
- CreateResourceRequest("GET", ResourceType::MAIN_FRAME,
+ CreateResourceRequest("GET", RESOURCE_TYPE_MAIN_FRAME,
GURL("http://other.com/blech"));
request.transferred_request_child_id = filter_->child_id();
request.transferred_request_request_id = request_id;
@@ -2387,7 +2387,7 @@ TEST_F(ResourceDispatcherHostTest, TransferNavigationWithProcessCrash) {
first_child_id = first_filter->child_id();
ResourceHostMsg_Request first_request =
- CreateResourceRequest("GET", ResourceType::MAIN_FRAME,
+ CreateResourceRequest("GET", RESOURCE_TYPE_MAIN_FRAME,
GURL("http://example.com/blah"));
ResourceHostMsg_RequestResource first_request_msg(
@@ -2423,7 +2423,7 @@ TEST_F(ResourceDispatcherHostTest, TransferNavigationWithProcessCrash) {
int new_request_id = 2;
ResourceHostMsg_Request request =
- CreateResourceRequest("GET", ResourceType::MAIN_FRAME,
+ CreateResourceRequest("GET", RESOURCE_TYPE_MAIN_FRAME,
GURL("http://other.com/blech"));
request.transferred_request_child_id = first_child_id;
request.transferred_request_request_id = request_id;
@@ -2467,7 +2467,7 @@ TEST_F(ResourceDispatcherHostTest, TransferNavigationWithTwoRedirects) {
MakeTestRequestWithResourceType(filter_.get(), render_view_id, request_id,
GURL("http://example.com/blah"),
- ResourceType::MAIN_FRAME);
+ RESOURCE_TYPE_MAIN_FRAME);
// Now that we're blocked on the redirect, simulate hitting another redirect.
SetResponse("HTTP/1.1 302 Found\n"
@@ -2502,7 +2502,7 @@ TEST_F(ResourceDispatcherHostTest, TransferNavigationWithTwoRedirects) {
int new_request_id = 2;
ResourceHostMsg_Request request =
- CreateResourceRequest("GET", ResourceType::MAIN_FRAME,
+ CreateResourceRequest("GET", RESOURCE_TYPE_MAIN_FRAME,
GURL("http://other.com/blech"));
request.transferred_request_child_id = filter_->child_id();
request.transferred_request_request_id = request_id;
@@ -2540,7 +2540,7 @@ TEST_F(ResourceDispatcherHostTest, UnknownURLScheme) {
HandleScheme("http");
MakeTestRequestWithResourceType(filter_.get(), 0, 1, GURL("foo://bar"),
- ResourceType::MAIN_FRAME);
+ RESOURCE_TYPE_MAIN_FRAME);
// Flush all pending requests.
while (net::URLRequestTestJob::ProcessOnePendingMessage()) {}
@@ -2602,7 +2602,7 @@ TEST_F(ResourceDispatcherHostTest, DataSentBeforeDetach) {
MakeTestRequestWithResourceType(filter_.get(), render_view_id, request_id,
GURL("http://example.com/blah"),
- ResourceType::PREFETCH);
+ RESOURCE_TYPE_PREFETCH);
// Get a bit of data before cancelling.
EXPECT_TRUE(net::URLRequestTestJob::ProcessOnePendingMessage());
@@ -2816,7 +2816,7 @@ TEST_F(ResourceDispatcherHostTest, ReleaseTemporiesOnProcessExit) {
TEST_F(ResourceDispatcherHostTest, DownloadToFile) {
// Make a request which downloads to file.
ResourceHostMsg_Request request = CreateResourceRequest(
- "GET", ResourceType::SUB_RESOURCE, net::URLRequestTestJob::test_url_1());
+ "GET", RESOURCE_TYPE_SUB_RESOURCE, net::URLRequestTestJob::test_url_1());
request.download_to_file = true;
ResourceHostMsg_RequestResource request_msg(0, 1, request);
host_.OnMessageReceived(request_msg, filter_);
diff --git a/content/browser/loader/resource_loader.cc b/content/browser/loader/resource_loader.cc
index d4cc9d0..d82cf07 100644
--- a/content/browser/loader/resource_loader.cc
+++ b/content/browser/loader/resource_loader.cc
@@ -165,7 +165,7 @@ void ResourceLoader::ReportUploadProgress() {
}
void ResourceLoader::MarkAsTransferring() {
- CHECK(ResourceType::IsFrame(GetRequestInfo()->GetResourceType()))
+ CHECK(IsResourceTypeFrame(GetRequestInfo()->GetResourceType()))
<< "Can only transfer for navigations";
is_transferring_ = true;
}
@@ -679,7 +679,7 @@ void ResourceLoader::CallDidFinishLoading() {
void ResourceLoader::RecordHistograms() {
ResourceRequestInfoImpl* info = GetRequestInfo();
- if (info->GetResourceType() == ResourceType::PREFETCH) {
+ if (info->GetResourceType() == RESOURCE_TYPE_PREFETCH) {
PrefetchStatus status = STATUS_UNDEFINED;
TimeDelta total_time = base::TimeTicks::Now() - request_->creation_time();
diff --git a/content/browser/loader/resource_loader_unittest.cc b/content/browser/loader/resource_loader_unittest.cc
index d2fdd99..047e404 100644
--- a/content/browser/loader/resource_loader_unittest.cc
+++ b/content/browser/loader/resource_loader_unittest.cc
@@ -319,7 +319,7 @@ class ResourceLoaderTest : public testing::Test,
resource_context_.GetRequestContext()));
raw_ptr_to_request_ = request.get();
ResourceRequestInfo::AllocateForTesting(request.get(),
- ResourceType::MAIN_FRAME,
+ RESOURCE_TYPE_MAIN_FRAME,
&resource_context_,
kRenderProcessId,
kRenderViewId,
diff --git a/content/browser/loader/resource_message_filter.h b/content/browser/loader/resource_message_filter.h
index b1baa40..cae7e64 100644
--- a/content/browser/loader/resource_message_filter.h
+++ b/content/browser/loader/resource_message_filter.h
@@ -60,8 +60,7 @@ class CONTENT_EXPORT ResourceMessageFilter : public BrowserMessageFilter {
net::URLRequestContext** request_context);
// Returns the net::URLRequestContext for the given request.
- net::URLRequestContext* GetURLRequestContext(
- ResourceType::Type request_type);
+ net::URLRequestContext* GetURLRequestContext(ResourceType request_type);
ChromeAppCacheService* appcache_service() const {
return appcache_service_.get();
diff --git a/content/browser/loader/resource_request_info_impl.cc b/content/browser/loader/resource_request_info_impl.cc
index 8db5e34..0e5778a 100644
--- a/content/browser/loader/resource_request_info_impl.cc
+++ b/content/browser/loader/resource_request_info_impl.cc
@@ -23,14 +23,13 @@ const ResourceRequestInfo* ResourceRequestInfo::ForRequest(
}
// static
-void ResourceRequestInfo::AllocateForTesting(
- net::URLRequest* request,
- ResourceType::Type resource_type,
- ResourceContext* context,
- int render_process_id,
- int render_view_id,
- int render_frame_id,
- bool is_async) {
+void ResourceRequestInfo::AllocateForTesting(net::URLRequest* request,
+ ResourceType resource_type,
+ ResourceContext* context,
+ int render_process_id,
+ int render_view_id,
+ int render_frame_id,
+ bool is_async) {
ResourceRequestInfoImpl* info =
new ResourceRequestInfoImpl(
PROCESS_TYPE_RENDERER, // process_type
@@ -39,7 +38,7 @@ void ResourceRequestInfo::AllocateForTesting(
0, // origin_pid
0, // request_id
render_frame_id, // render_frame_id
- resource_type == ResourceType::MAIN_FRAME, // is_main_frame
+ resource_type == RESOURCE_TYPE_MAIN_FRAME, // is_main_frame
false, // parent_is_main_frame
0, // parent_render_frame_id
resource_type, // resource_type
@@ -96,7 +95,7 @@ ResourceRequestInfoImpl::ResourceRequestInfoImpl(
bool is_main_frame,
bool parent_is_main_frame,
int parent_render_frame_id,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
PageTransition transition_type,
bool should_replace_current_entry,
bool is_download,
@@ -174,7 +173,7 @@ int ResourceRequestInfoImpl::GetParentRenderFrameID() const {
return parent_render_frame_id_;
}
-ResourceType::Type ResourceRequestInfoImpl::GetResourceType() const {
+ResourceType ResourceRequestInfoImpl::GetResourceType() const {
return resource_type_;
}
diff --git a/content/browser/loader/resource_request_info_impl.h b/content/browser/loader/resource_request_info_impl.h
index 2fe5a8b..70465f7 100644
--- a/content/browser/loader/resource_request_info_impl.h
+++ b/content/browser/loader/resource_request_info_impl.h
@@ -49,7 +49,7 @@ class ResourceRequestInfoImpl : public ResourceRequestInfo,
bool is_main_frame,
bool parent_is_main_frame,
int parent_render_frame_id,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
PageTransition transition_type,
bool should_replace_current_entry,
bool is_download,
@@ -73,7 +73,7 @@ class ResourceRequestInfoImpl : public ResourceRequestInfo,
virtual bool IsMainFrame() const OVERRIDE;
virtual bool ParentIsMainFrame() const OVERRIDE;
virtual int GetParentRenderFrameID() const OVERRIDE;
- virtual ResourceType::Type GetResourceType() const OVERRIDE;
+ virtual ResourceType GetResourceType() const OVERRIDE;
virtual int GetProcessType() const OVERRIDE;
virtual blink::WebReferrerPolicy GetReferrerPolicy() const OVERRIDE;
virtual blink::WebPageVisibilityState GetVisibilityState() const OVERRIDE;
@@ -176,7 +176,7 @@ class ResourceRequestInfoImpl : public ResourceRequestInfo,
bool allow_download_;
bool has_user_gesture_;
bool was_ignored_by_handler_;
- ResourceType::Type resource_type_;
+ ResourceType resource_type_;
PageTransition transition_type_;
int memory_cost_;
blink::WebReferrerPolicy referrer_policy_;
diff --git a/content/browser/loader/resource_scheduler_unittest.cc b/content/browser/loader/resource_scheduler_unittest.cc
index e424c27..ea4fc02 100644
--- a/content/browser/loader/resource_scheduler_unittest.cc
+++ b/content/browser/loader/resource_scheduler_unittest.cc
@@ -175,7 +175,7 @@ class ResourceSchedulerTest : public testing::Test {
false, // is_main_frame
false, // parent_is_main_frame
0, // parent_render_frame_id
- ResourceType::SUB_RESOURCE, // resource_type
+ RESOURCE_TYPE_SUB_RESOURCE, // resource_type
PAGE_TRANSITION_LINK, // transition_type
false, // should_replace_current_entry
false, // is_download
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 75b729f..1b49af5 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -193,11 +193,11 @@ void RemoveShaderInfo(int32 id) {
net::URLRequestContext* GetRequestContext(
scoped_refptr<net::URLRequestContextGetter> request_context,
scoped_refptr<net::URLRequestContextGetter> media_request_context,
- ResourceType::Type resource_type) {
- // If the request has resource type of ResourceType::MEDIA, we use a request
+ ResourceType resource_type) {
+ // If the request has resource type of RESOURCE_TYPE_MEDIA, we use a request
// context specific to media for handling it because these resources have
// specific needs for caching.
- if (resource_type == ResourceType::MEDIA)
+ if (resource_type == RESOURCE_TYPE_MEDIA)
return media_request_context->GetURLRequestContext();
return request_context->GetURLRequestContext();
}
@@ -817,7 +817,7 @@ void RenderProcessHostImpl::CreateMessageFilters() {
WebSocketDispatcherHost::GetRequestContextCallback
websocket_request_context_callback(
base::Bind(&GetRequestContext, request_context,
- media_request_context, ResourceType::SUB_RESOURCE));
+ media_request_context, RESOURCE_TYPE_SUB_RESOURCE));
AddFilter(
new WebSocketDispatcherHost(GetID(), websocket_request_context_callback));
diff --git a/content/browser/renderer_host/socket_stream_dispatcher_host.cc b/content/browser/renderer_host/socket_stream_dispatcher_host.cc
index b08b119..c52023e 100644
--- a/content/browser/renderer_host/socket_stream_dispatcher_host.cc
+++ b/content/browser/renderer_host/socket_stream_dispatcher_host.cc
@@ -144,7 +144,7 @@ void SocketStreamDispatcherHost::OnSSLCertificateError(
DCHECK(socket_stream_host);
GlobalRequestID request_id(-1, socket_id);
SSLManager::OnSSLCertificateError(
- weak_ptr_factory_.GetWeakPtr(), request_id, ResourceType::SUB_RESOURCE,
+ weak_ptr_factory_.GetWeakPtr(), request_id, RESOURCE_TYPE_SUB_RESOURCE,
socket->url(), render_process_id_, socket_stream_host->render_frame_id(),
ssl_info, fatal);
}
@@ -287,7 +287,7 @@ void SocketStreamDispatcherHost::DeleteSocketStreamHost(int socket_id) {
}
net::URLRequestContext* SocketStreamDispatcherHost::GetURLRequestContext() {
- return request_context_callback_.Run(ResourceType::SUB_RESOURCE);
+ return request_context_callback_.Run(RESOURCE_TYPE_SUB_RESOURCE);
}
void SocketStreamDispatcherHost::Shutdown() {
diff --git a/content/browser/renderer_host/socket_stream_dispatcher_host.h b/content/browser/renderer_host/socket_stream_dispatcher_host.h
index c083613..bc0e35f 100644
--- a/content/browser/renderer_host/socket_stream_dispatcher_host.h
+++ b/content/browser/renderer_host/socket_stream_dispatcher_host.h
@@ -32,7 +32,7 @@ class SocketStreamDispatcherHost
public net::SocketStream::Delegate,
public SSLErrorHandler::Delegate {
public:
- typedef base::Callback<net::URLRequestContext*(ResourceType::Type)>
+ typedef base::Callback<net::URLRequestContext*(ResourceType)>
GetRequestContextCallback;
SocketStreamDispatcherHost(
int render_process_id,
diff --git a/content/browser/renderer_host/websocket_host.cc b/content/browser/renderer_host/websocket_host.cc
index f778f06..49cc39b 100644
--- a/content/browser/renderer_host/websocket_host.cc
+++ b/content/browser/renderer_host/websocket_host.cc
@@ -280,7 +280,7 @@ ChannelState WebSocketEventHandler::OnSSLCertificateError(
GlobalRequestID request_id(-1, -1);
SSLManager::OnSSLCertificateError(ssl_error_handler_delegate_->GetWeakPtr(),
request_id,
- ResourceType::SUB_RESOURCE,
+ RESOURCE_TYPE_SUB_RESOURCE,
url,
dispatcher_->render_process_id(),
render_frame_id_,
diff --git a/content/browser/service_worker/service_worker_context_request_handler.cc b/content/browser/service_worker/service_worker_context_request_handler.cc
index cc9b752..4524893 100644
--- a/content/browser/service_worker/service_worker_context_request_handler.cc
+++ b/content/browser/service_worker/service_worker_context_request_handler.cc
@@ -18,7 +18,7 @@ ServiceWorkerContextRequestHandler::ServiceWorkerContextRequestHandler(
base::WeakPtr<ServiceWorkerContextCore> context,
base::WeakPtr<ServiceWorkerProviderHost> provider_host,
base::WeakPtr<webkit_blob::BlobStorageContext> blob_storage_context,
- ResourceType::Type resource_type)
+ ResourceType resource_type)
: ServiceWorkerRequestHandler(context,
provider_host,
blob_storage_context,
@@ -45,8 +45,8 @@ net::URLRequestJob* ServiceWorkerContextRequestHandler::MaybeCreateJob(
// retrieve it from the script cache.
// TODO(michaeln): Get the desired behavior clarified in the spec,
// and make tweak the behavior here to match.
- if (resource_type_ != ResourceType::SERVICE_WORKER &&
- resource_type_ != ResourceType::SCRIPT) {
+ if (resource_type_ != RESOURCE_TYPE_SERVICE_WORKER &&
+ resource_type_ != RESOURCE_TYPE_SCRIPT) {
return NULL;
}
diff --git a/content/browser/service_worker/service_worker_context_request_handler.h b/content/browser/service_worker/service_worker_context_request_handler.h
index 0a9eaf3..0c74927 100644
--- a/content/browser/service_worker/service_worker_context_request_handler.h
+++ b/content/browser/service_worker/service_worker_context_request_handler.h
@@ -20,7 +20,7 @@ class CONTENT_EXPORT ServiceWorkerContextRequestHandler
base::WeakPtr<ServiceWorkerContextCore> context,
base::WeakPtr<ServiceWorkerProviderHost> provider_host,
base::WeakPtr<webkit_blob::BlobStorageContext> blob_storage_context,
- ResourceType::Type resource_type);
+ ResourceType resource_type);
virtual ~ServiceWorkerContextRequestHandler();
// Called via custom URLRequestJobFactory.
diff --git a/content/browser/service_worker/service_worker_controllee_request_handler.cc b/content/browser/service_worker/service_worker_controllee_request_handler.cc
index 14212f2..bdea9e1 100644
--- a/content/browser/service_worker/service_worker_controllee_request_handler.cc
+++ b/content/browser/service_worker/service_worker_controllee_request_handler.cc
@@ -21,7 +21,7 @@ ServiceWorkerControlleeRequestHandler::ServiceWorkerControlleeRequestHandler(
base::WeakPtr<ServiceWorkerContextCore> context,
base::WeakPtr<ServiceWorkerProviderHost> provider_host,
base::WeakPtr<webkit_blob::BlobStorageContext> blob_storage_context,
- ResourceType::Type resource_type)
+ ResourceType resource_type)
: ServiceWorkerRequestHandler(context,
provider_host,
blob_storage_context,
diff --git a/content/browser/service_worker/service_worker_controllee_request_handler.h b/content/browser/service_worker/service_worker_controllee_request_handler.h
index 1829774..64f6555 100644
--- a/content/browser/service_worker/service_worker_controllee_request_handler.h
+++ b/content/browser/service_worker/service_worker_controllee_request_handler.h
@@ -28,7 +28,7 @@ class CONTENT_EXPORT ServiceWorkerControlleeRequestHandler
base::WeakPtr<ServiceWorkerContextCore> context,
base::WeakPtr<ServiceWorkerProviderHost> provider_host,
base::WeakPtr<webkit_blob::BlobStorageContext> blob_storage_context,
- ResourceType::Type resource_type);
+ ResourceType resource_type);
virtual ~ServiceWorkerControlleeRequestHandler();
// Called via custom URLRequestJobFactory.
diff --git a/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc b/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc
index a2e6a05..246dae3 100644
--- a/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc
+++ b/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc
@@ -98,7 +98,7 @@ TEST_F(ServiceWorkerControlleeRequestHandlerTest, ActivateWaitingVersion) {
context()->AsWeakPtr(),
provider_host_,
base::WeakPtr<webkit_blob::BlobStorageContext>(),
- ResourceType::MAIN_FRAME));
+ RESOURCE_TYPE_MAIN_FRAME));
scoped_refptr<net::URLRequestJob> job =
handler->MaybeCreateJob(request.get(), NULL);
ServiceWorkerURLRequestJob* sw_job =
diff --git a/content/browser/service_worker/service_worker_provider_host.cc b/content/browser/service_worker/service_worker_provider_host.cc
index 07e440f..85ea2ca 100644
--- a/content/browser/service_worker/service_worker_provider_host.cc
+++ b/content/browser/service_worker/service_worker_provider_host.cc
@@ -161,7 +161,7 @@ bool ServiceWorkerProviderHost::SetHostedVersionId(int64 version_id) {
scoped_ptr<ServiceWorkerRequestHandler>
ServiceWorkerProviderHost::CreateRequestHandler(
- ResourceType::Type resource_type,
+ ResourceType resource_type,
base::WeakPtr<webkit_blob::BlobStorageContext> blob_storage_context) {
if (IsHostToRunningServiceWorker()) {
return scoped_ptr<ServiceWorkerRequestHandler>(
diff --git a/content/browser/service_worker/service_worker_provider_host.h b/content/browser/service_worker/service_worker_provider_host.h
index e10cdf5..3175ef1 100644
--- a/content/browser/service_worker/service_worker_provider_host.h
+++ b/content/browser/service_worker/service_worker_provider_host.h
@@ -94,7 +94,7 @@ class CONTENT_EXPORT ServiceWorkerProviderHost
// Returns a handler for a request, the handler may return NULL if
// the request doesn't require special handling.
scoped_ptr<ServiceWorkerRequestHandler> CreateRequestHandler(
- ResourceType::Type resource_type,
+ ResourceType resource_type,
base::WeakPtr<webkit_blob::BlobStorageContext> blob_storage_context);
// Returns true if |version| can be associated with this provider.
diff --git a/content/browser/service_worker/service_worker_request_handler.cc b/content/browser/service_worker/service_worker_request_handler.cc
index 0adbd57..7b615b3 100644
--- a/content/browser/service_worker/service_worker_request_handler.cc
+++ b/content/browser/service_worker/service_worker_request_handler.cc
@@ -59,7 +59,7 @@ void ServiceWorkerRequestHandler::InitializeHandler(
webkit_blob::BlobStorageContext* blob_storage_context,
int process_id,
int provider_id,
- ResourceType::Type resource_type) {
+ ResourceType resource_type) {
if (!IsSchemeAndMethodSupportedForAppCache(request)) {
return;
}
@@ -102,7 +102,7 @@ ServiceWorkerRequestHandler::ServiceWorkerRequestHandler(
base::WeakPtr<ServiceWorkerContextCore> context,
base::WeakPtr<ServiceWorkerProviderHost> provider_host,
base::WeakPtr<webkit_blob::BlobStorageContext> blob_storage_context,
- ResourceType::Type resource_type)
+ ResourceType resource_type)
: context_(context),
provider_host_(provider_host),
blob_storage_context_(blob_storage_context),
diff --git a/content/browser/service_worker/service_worker_request_handler.h b/content/browser/service_worker/service_worker_request_handler.h
index 1073f23..e495abe 100644
--- a/content/browser/service_worker/service_worker_request_handler.h
+++ b/content/browser/service_worker/service_worker_request_handler.h
@@ -46,7 +46,7 @@ class CONTENT_EXPORT ServiceWorkerRequestHandler
webkit_blob::BlobStorageContext* blob_storage_context,
int process_id,
int provider_id,
- ResourceType::Type resource_type);
+ ResourceType resource_type);
// Returns the handler attached to |request|. This may return NULL
// if no handler is attached.
@@ -72,12 +72,12 @@ class CONTENT_EXPORT ServiceWorkerRequestHandler
base::WeakPtr<ServiceWorkerContextCore> context,
base::WeakPtr<ServiceWorkerProviderHost> provider_host,
base::WeakPtr<webkit_blob::BlobStorageContext> blob_storage_context,
- ResourceType::Type resource_type);
+ ResourceType resource_type);
base::WeakPtr<ServiceWorkerContextCore> context_;
base::WeakPtr<ServiceWorkerProviderHost> provider_host_;
base::WeakPtr<webkit_blob::BlobStorageContext> blob_storage_context_;
- ResourceType::Type resource_type_;
+ ResourceType resource_type_;
private:
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRequestHandler);
diff --git a/content/browser/service_worker/service_worker_utils.h b/content/browser/service_worker/service_worker_utils.h
index 60ce5ce..81d6c44 100644
--- a/content/browser/service_worker/service_worker_utils.h
+++ b/content/browser/service_worker/service_worker_utils.h
@@ -5,23 +5,18 @@
#ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_UTILS_H_
#define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_UTILS_H_
+#include "base/macros.h"
#include "content/common/content_export.h"
#include "content/common/service_worker/service_worker_status_code.h"
#include "content/public/common/resource_type.h"
-
-class GURL;
+#include "url/gurl.h"
namespace content {
class ServiceWorkerUtils {
public:
- static bool IsMainResourceType(ResourceType::Type type) {
- return ResourceType::IsFrame(type) ||
- ResourceType::IsSharedWorker(type);
- }
-
- static bool IsServiceWorkerResourceType(ResourceType::Type type) {
- return ResourceType::IsServiceWorker(type);
+ static bool IsMainResourceType(ResourceType type) {
+ return IsResourceTypeFrame(type) || type == RESOURCE_TYPE_SHARED_WORKER;
}
// A helper for creating a do-nothing status callback.
diff --git a/content/browser/service_worker/service_worker_write_to_cache_job.cc b/content/browser/service_worker/service_worker_write_to_cache_job.cc
index 71db503..b3e6cad 100644
--- a/content/browser/service_worker/service_worker_write_to_cache_job.cc
+++ b/content/browser/service_worker/service_worker_write_to_cache_job.cc
@@ -21,7 +21,7 @@ namespace content {
ServiceWorkerWriteToCacheJob::ServiceWorkerWriteToCacheJob(
net::URLRequest* request,
net::NetworkDelegate* network_delegate,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
base::WeakPtr<ServiceWorkerContextCore> context,
ServiceWorkerVersion* version,
int64 response_id)
@@ -142,7 +142,7 @@ void ServiceWorkerWriteToCacheJob::InitNetRequest() {
request()->first_party_for_cookies());
net_request_->SetReferrer(request()->referrer());
- if (resource_type_ == ResourceType::SERVICE_WORKER) {
+ if (resource_type_ == RESOURCE_TYPE_SERVICE_WORKER) {
// This will get copied into net_request_ when URLRequest::StartJob calls
// ServiceWorkerWriteToCacheJob::SetExtraRequestHeaders.
request()->SetExtraRequestHeaderByName("Service-Worker", "script", true);
diff --git a/content/browser/service_worker/service_worker_write_to_cache_job.h b/content/browser/service_worker/service_worker_write_to_cache_job.h
index ecc2a6d..6833227 100644
--- a/content/browser/service_worker/service_worker_write_to_cache_job.h
+++ b/content/browser/service_worker/service_worker_write_to_cache_job.h
@@ -37,7 +37,7 @@ class CONTENT_EXPORT ServiceWorkerWriteToCacheJob
ServiceWorkerWriteToCacheJob(
net::URLRequest* request,
net::NetworkDelegate* network_delegate,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
base::WeakPtr<ServiceWorkerContextCore> context,
ServiceWorkerVersion* version,
int64 response_id);
@@ -99,7 +99,7 @@ class CONTENT_EXPORT ServiceWorkerWriteToCacheJob
void AsyncNotifyDoneHelper(const net::URLRequestStatus& status);
- ResourceType::Type resource_type_; // Differentiate main script and imports
+ ResourceType resource_type_; // Differentiate main script and imports
scoped_refptr<net::IOBuffer> io_buffer_;
scoped_refptr<HttpResponseInfoIOBuffer> info_buffer_;
base::WeakPtr<ServiceWorkerContextCore> context_;
diff --git a/content/browser/ssl/ssl_cert_error_handler.cc b/content/browser/ssl/ssl_cert_error_handler.cc
index a69e993..a3e6a26 100644
--- a/content/browser/ssl/ssl_cert_error_handler.cc
+++ b/content/browser/ssl/ssl_cert_error_handler.cc
@@ -14,13 +14,17 @@ namespace content {
SSLCertErrorHandler::SSLCertErrorHandler(
const base::WeakPtr<Delegate>& delegate,
const GlobalRequestID& id,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
const GURL& url,
int render_process_id,
int render_frame_id,
const net::SSLInfo& ssl_info,
bool fatal)
- : SSLErrorHandler(delegate, id, resource_type, url, render_process_id,
+ : SSLErrorHandler(delegate,
+ id,
+ resource_type,
+ url,
+ render_process_id,
render_frame_id),
ssl_info_(ssl_info),
cert_error_(net::MapCertStatusToNetError(ssl_info.cert_status)),
diff --git a/content/browser/ssl/ssl_cert_error_handler.h b/content/browser/ssl/ssl_cert_error_handler.h
index 6946f42..4e14690 100644
--- a/content/browser/ssl/ssl_cert_error_handler.h
+++ b/content/browser/ssl/ssl_cert_error_handler.h
@@ -21,7 +21,7 @@ class SSLCertErrorHandler : public SSLErrorHandler {
// Construct on the IO thread.
SSLCertErrorHandler(const base::WeakPtr<Delegate>& delegate,
const GlobalRequestID& id,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
const GURL& url,
int render_process_id,
int render_frame_id,
diff --git a/content/browser/ssl/ssl_error_handler.cc b/content/browser/ssl/ssl_error_handler.cc
index 6d120a9..8c2c37b 100644
--- a/content/browser/ssl/ssl_error_handler.cc
+++ b/content/browser/ssl/ssl_error_handler.cc
@@ -20,7 +20,7 @@ namespace content {
SSLErrorHandler::SSLErrorHandler(const base::WeakPtr<Delegate>& delegate,
const GlobalRequestID& id,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
const GURL& url,
int render_process_id,
int render_frame_id)
diff --git a/content/browser/ssl/ssl_error_handler.h b/content/browser/ssl/ssl_error_handler.h
index 6b0834b..4a1b3f3 100644
--- a/content/browser/ssl/ssl_error_handler.h
+++ b/content/browser/ssl/ssl_error_handler.h
@@ -75,7 +75,7 @@ class SSLErrorHandler : public base::RefCountedThreadSafe<SSLErrorHandler> {
const GURL& request_url() const { return request_url_; }
// Available on either thread.
- ResourceType::Type resource_type() const { return resource_type_; }
+ ResourceType resource_type() const { return resource_type_; }
// Cancels the associated net::URLRequest.
// This method can be called from OnDispatchFailed and OnDispatched.
@@ -109,7 +109,7 @@ class SSLErrorHandler : public base::RefCountedThreadSafe<SSLErrorHandler> {
// Construct on the IO thread.
SSLErrorHandler(const base::WeakPtr<Delegate>& delegate,
const GlobalRequestID& id,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
const GURL& url,
int render_process_id,
int render_frame_id);
@@ -158,7 +158,7 @@ class SSLErrorHandler : public base::RefCountedThreadSafe<SSLErrorHandler> {
// What kind of resource is associated with the requested that generated
// that error.
// This read-only member can be accessed on any thread.
- const ResourceType::Type resource_type_;
+ const ResourceType resource_type_;
// A flag to make sure we notify the net::URLRequest exactly once.
// Should only be accessed on the IO thread
diff --git a/content/browser/ssl/ssl_manager.cc b/content/browser/ssl/ssl_manager.cc
index 68906ce..dcae75e 100644
--- a/content/browser/ssl/ssl_manager.cc
+++ b/content/browser/ssl/ssl_manager.cc
@@ -50,7 +50,7 @@ class SSLManagerSet : public base::SupportsUserData::Data {
void SSLManager::OnSSLCertificateError(
const base::WeakPtr<SSLErrorHandler::Delegate>& delegate,
const GlobalRequestID& id,
- const ResourceType::Type resource_type,
+ const ResourceType resource_type,
const GURL& url,
int render_process_id,
int render_frame_id,
@@ -171,7 +171,7 @@ void SSLManager::DidLoadFromMemoryCache(
// resouces aren't cachable.
scoped_refptr<SSLRequestInfo> info(new SSLRequestInfo(
details.url,
- ResourceType::SUB_RESOURCE,
+ RESOURCE_TYPE_SUB_RESOURCE,
details.pid,
details.cert_id,
details.cert_status));
diff --git a/content/browser/ssl/ssl_manager.h b/content/browser/ssl/ssl_manager.h
index c195e98..1bc81da 100644
--- a/content/browser/ssl/ssl_manager.h
+++ b/content/browser/ssl/ssl_manager.h
@@ -51,7 +51,7 @@ class SSLManager {
static void OnSSLCertificateError(
const base::WeakPtr<SSLErrorHandler::Delegate>& delegate,
const GlobalRequestID& id,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
const GURL& url,
int render_process_id,
int render_frame_id,
diff --git a/content/browser/ssl/ssl_request_info.cc b/content/browser/ssl/ssl_request_info.cc
index 0c23f83..f22376ac 100644
--- a/content/browser/ssl/ssl_request_info.cc
+++ b/content/browser/ssl/ssl_request_info.cc
@@ -7,7 +7,7 @@
namespace content {
SSLRequestInfo::SSLRequestInfo(const GURL& url,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
int child_id,
int ssl_cert_id,
net::CertStatus ssl_cert_status)
diff --git a/content/browser/ssl/ssl_request_info.h b/content/browser/ssl/ssl_request_info.h
index 9498c89..9f50448 100644
--- a/content/browser/ssl/ssl_request_info.h
+++ b/content/browser/ssl/ssl_request_info.h
@@ -20,13 +20,13 @@ namespace content {
class SSLRequestInfo : public base::RefCounted<SSLRequestInfo> {
public:
SSLRequestInfo(const GURL& url,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
int child_id,
int ssl_cert_id,
net::CertStatus ssl_cert_status);
const GURL& url() const { return url_; }
- ResourceType::Type resource_type() const { return resource_type_; }
+ ResourceType resource_type() const { return resource_type_; }
int child_id() const { return child_id_; }
int ssl_cert_id() const { return ssl_cert_id_; }
net::CertStatus ssl_cert_status() const { return ssl_cert_status_; }
@@ -37,7 +37,7 @@ class SSLRequestInfo : public base::RefCounted<SSLRequestInfo> {
virtual ~SSLRequestInfo();
GURL url_;
- ResourceType::Type resource_type_;
+ ResourceType resource_type_;
int child_id_;
int ssl_cert_id_;
net::CertStatus ssl_cert_status_;
diff --git a/content/browser/transition_browsertest.cc b/content/browser/transition_browsertest.cc
index 5cc07e6..3ffaadb 100644
--- a/content/browser/transition_browsertest.cc
+++ b/content/browser/transition_browsertest.cc
@@ -42,7 +42,7 @@ class TransitionBrowserTestObserver
net::URLRequest* request,
ResourceContext* resource_context,
AppCacheService* appcache_service,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
int child_id,
int route_id,
ScopedVector<ResourceThrottle>* throttles) OVERRIDE {
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 5e8942b..b7634a4 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -2612,7 +2612,7 @@ void WebContentsImpl::OnDidLoadResourceFromMemoryCache(
const std::string& security_info,
const std::string& http_method,
const std::string& mime_type,
- ResourceType::Type resource_type) {
+ ResourceType resource_type) {
base::StatsCounter cache("WebKit.CacheHit");
cache.Increment();
@@ -2637,7 +2637,7 @@ void WebContentsImpl::OnDidLoadResourceFromMemoryCache(
if (url.is_valid() && url.SchemeIsHTTPOrHTTPS()) {
scoped_refptr<net::URLRequestContextGetter> request_context(
- resource_type == ResourceType::MEDIA ?
+ resource_type == RESOURCE_TYPE_MEDIA ?
GetBrowserContext()->GetMediaRequestContextForRenderProcess(
GetRenderProcessHost()->GetID()) :
GetBrowserContext()->GetRequestContextForRenderProcess(
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index 765ac46..a8455ef 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -734,7 +734,7 @@ class CONTENT_EXPORT WebContentsImpl
const std::string& security_info,
const std::string& http_request,
const std::string& mime_type,
- ResourceType::Type resource_type);
+ ResourceType resource_type);
void OnDidDisplayInsecureContent();
void OnDidRunInsecureContent(const std::string& security_origin,
const GURL& target_url);
diff --git a/content/child/npapi/plugin_url_fetcher.cc b/content/child/npapi/plugin_url_fetcher.cc
index 39825fd..48c685e 100644
--- a/content/child/npapi/plugin_url_fetcher.cc
+++ b/content/child/npapi/plugin_url_fetcher.cc
@@ -113,7 +113,7 @@ PluginURLFetcher::PluginURLFetcher(PluginStreamUrl* plugin_stream,
request_info.referrer = referrer;
request_info.load_flags = net::LOAD_NORMAL;
request_info.requestor_pid = origin_pid;
- request_info.request_type = ResourceType::OBJECT;
+ request_info.request_type = RESOURCE_TYPE_OBJECT;
request_info.routing_id = render_view_id;
RequestExtraData extra_data;
diff --git a/content/child/request_info.cc b/content/child/request_info.cc
index e75c54a..860b944 100644
--- a/content/child/request_info.cc
+++ b/content/child/request_info.cc
@@ -10,7 +10,7 @@ RequestInfo::RequestInfo()
: referrer_policy(blink::WebReferrerPolicyDefault),
load_flags(0),
requestor_pid(0),
- request_type(ResourceType::MAIN_FRAME),
+ request_type(RESOURCE_TYPE_MAIN_FRAME),
priority(net::LOW),
request_context(0),
appcache_host_id(0),
diff --git a/content/child/request_info.h b/content/child/request_info.h
index ce5ab7a..f1bfa97 100644
--- a/content/child/request_info.h
+++ b/content/child/request_info.h
@@ -54,7 +54,7 @@ struct CONTENT_EXPORT RequestInfo {
// Indicates if the current request is the main frame load, a sub-frame
// load, or a sub objects load.
- ResourceType::Type request_type;
+ ResourceType request_type;
// Indicates the priority of this request, as determined by WebKit.
net::RequestPriority priority;
diff --git a/content/child/resource_dispatcher.cc b/content/child/resource_dispatcher.cc
index ab42176..59dafe1 100644
--- a/content/child/resource_dispatcher.cc
+++ b/content/child/resource_dispatcher.cc
@@ -574,7 +574,7 @@ void ResourceDispatcher::OnRequestComplete(
}
int ResourceDispatcher::AddPendingRequest(RequestPeer* callback,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
int origin_pid,
const GURL& frame_origin,
const GURL& request_url,
@@ -672,7 +672,7 @@ bool ResourceDispatcher::AttachThreadedDataReceiver(
ResourceDispatcher::PendingRequestInfo::PendingRequestInfo()
: peer(NULL),
threaded_data_provider(NULL),
- resource_type(ResourceType::SUB_RESOURCE),
+ resource_type(RESOURCE_TYPE_SUB_RESOURCE),
is_deferred(false),
download_to_file(false),
blocked_response(false),
@@ -681,7 +681,7 @@ ResourceDispatcher::PendingRequestInfo::PendingRequestInfo()
ResourceDispatcher::PendingRequestInfo::PendingRequestInfo(
RequestPeer* peer,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
int origin_pid,
const GURL& frame_origin,
const GURL& request_url,
diff --git a/content/child/resource_dispatcher.h b/content/child/resource_dispatcher.h
index f7f62ff..5fa68e9 100644
--- a/content/child/resource_dispatcher.h
+++ b/content/child/resource_dispatcher.h
@@ -20,6 +20,7 @@
#include "ipc/ipc_listener.h"
#include "ipc/ipc_sender.h"
#include "net/base/request_priority.h"
+#include "url/gurl.h"
struct ResourceMsg_RequestCompleteData;
@@ -60,7 +61,7 @@ class CONTENT_EXPORT ResourceDispatcher : public IPC::Listener {
// Adds a request from the |pending_requests_| list, returning the new
// requests' ID.
int AddPendingRequest(RequestPeer* callback,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
int origin_pid,
const GURL& frame_origin,
const GURL& request_url,
@@ -108,7 +109,7 @@ class CONTENT_EXPORT ResourceDispatcher : public IPC::Listener {
PendingRequestInfo();
PendingRequestInfo(RequestPeer* peer,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
int origin_pid,
const GURL& frame_origin,
const GURL& request_url,
@@ -118,7 +119,7 @@ class CONTENT_EXPORT ResourceDispatcher : public IPC::Listener {
RequestPeer* peer;
ThreadedDataProvider* threaded_data_provider;
- ResourceType::Type resource_type;
+ ResourceType resource_type;
// The PID of the original process which issued this request. This gets
// non-zero only for a request proxied by another renderer, particularly
// requests from plugins.
diff --git a/content/child/resource_dispatcher_unittest.cc b/content/child/resource_dispatcher_unittest.cc
index 3e427ca..4e95428 100644
--- a/content/child/resource_dispatcher_unittest.cc
+++ b/content/child/resource_dispatcher_unittest.cc
@@ -330,7 +330,7 @@ class ResourceDispatcherTest : public testing::Test, public IPC::Sender {
request_info.headers = std::string();
request_info.load_flags = 0;
request_info.requestor_pid = 0;
- request_info.request_type = ResourceType::SUB_RESOURCE;
+ request_info.request_type = RESOURCE_TYPE_SUB_RESOURCE;
request_info.appcache_host_id = kAppCacheNoHostId;
request_info.routing_id = 0;
request_info.download_to_file = download_to_file;
diff --git a/content/child/site_isolation_policy.cc b/content/child/site_isolation_policy.cc
index 026f625..9b982b6 100644
--- a/content/child/site_isolation_policy.cc
+++ b/content/child/site_isolation_policy.cc
@@ -117,7 +117,7 @@ void HistogramCountBlockedResponse(
IncrementHistogramEnum(
bucket_prefix + block_label + ".RenderableStatusCode",
resp_data->resource_type,
- ResourceType::LAST_TYPE);
+ RESOURCE_TYPE_LAST_TYPE);
} else {
IncrementHistogramCount(bucket_prefix + block_label +
".NonRenderableStatusCode");
@@ -142,7 +142,7 @@ void SiteIsolationPolicy::SetPolicyEnabled(bool enabled) {
linked_ptr<SiteIsolationResponseMetaData>
SiteIsolationPolicy::OnReceivedResponse(const GURL& frame_origin,
const GURL& response_url,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
int origin_pid,
const ResourceResponseInfo& info) {
if (!g_policy_enabled)
@@ -160,7 +160,7 @@ SiteIsolationPolicy::OnReceivedResponse(const GURL& frame_origin,
// See if this is for navigation. If it is, don't block it, under the
// assumption that we will put it in an appropriate process.
- if (ResourceType::IsFrame(resource_type))
+ if (IsResourceTypeFrame(resource_type))
return linked_ptr<SiteIsolationResponseMetaData>();
if (!IsBlockableScheme(response_url))
diff --git a/content/child/site_isolation_policy.h b/content/child/site_isolation_policy.h
index 9e594b7..f084288 100644
--- a/content/child/site_isolation_policy.h
+++ b/content/child/site_isolation_policy.h
@@ -13,8 +13,7 @@
#include "base/strings/string_piece.h"
#include "content/common/content_export.h"
#include "content/public/common/resource_type.h"
-
-class GURL;
+#include "url/gurl.h"
namespace content {
@@ -55,7 +54,6 @@ struct ResourceResponseInfo;
// # of responses that are plausibly sniffed to be JavaScript.
struct SiteIsolationResponseMetaData {
-
enum CanonicalMimeType {
HTML = 0,
XML = 1,
@@ -69,7 +67,7 @@ struct SiteIsolationResponseMetaData {
std::string frame_origin;
GURL response_url;
- ResourceType::Type resource_type;
+ ResourceType resource_type;
CanonicalMimeType canonical_mime_type;
int http_status_code;
bool no_sniff;
@@ -86,7 +84,7 @@ class CONTENT_EXPORT SiteIsolationPolicy {
static linked_ptr<SiteIsolationResponseMetaData> OnReceivedResponse(
const GURL& frame_origin,
const GURL& response_url,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
int origin_pid,
const ResourceResponseInfo& info);
diff --git a/content/child/web_url_loader_impl.cc b/content/child/web_url_loader_impl.cc
index 45b0d6d..32b4467 100644
--- a/content/child/web_url_loader_impl.cc
+++ b/content/child/web_url_loader_impl.cc
@@ -18,6 +18,7 @@
#include "content/child/request_info.h"
#include "content/child/resource_dispatcher.h"
#include "content/child/sync_load_response.h"
+#include "content/child/web_url_request_util.h"
#include "content/child/weburlresponse_extradata_impl.h"
#include "content/common/resource_request_body.h"
#include "content/public/child/request_peer.h"
@@ -387,7 +388,7 @@ void WebURLLoaderImpl::Context::Start(const WebURLRequest& request,
// the render process, so we can use requestorProcessID even for requests
// from in-process plugins.
request_info.requestor_pid = request.requestorProcessID();
- request_info.request_type = ResourceType::FromWebURLRequest(request);
+ request_info.request_type = WebURLRequestToResourceType(request);
request_info.priority =
ConvertWebKitPriorityToNetPriority(request.priority());
request_info.appcache_host_id = request.appCacheHostID();
diff --git a/content/child/web_url_request_util.cc b/content/child/web_url_request_util.cc
new file mode 100644
index 0000000..be5ee32
--- /dev/null
+++ b/content/child/web_url_request_util.cc
@@ -0,0 +1,120 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/child/web_url_request_util.h"
+
+#include "base/logging.h"
+#include "third_party/WebKit/public/platform/WebURLRequest.h"
+
+using blink::WebURLRequest;
+
+namespace content {
+
+ResourceType WebURLRequestToResourceType(const WebURLRequest& request) {
+ WebURLRequest::RequestContext requestContext = request.requestContext();
+ if (request.frameType() != WebURLRequest::FrameTypeNone) {
+ DCHECK(requestContext == WebURLRequest::RequestContextForm ||
+ requestContext == WebURLRequest::RequestContextFrame ||
+ requestContext == WebURLRequest::RequestContextHyperlink ||
+ requestContext == WebURLRequest::RequestContextIframe ||
+ requestContext == WebURLRequest::RequestContextInternal ||
+ requestContext == WebURLRequest::RequestContextLocation);
+ if (request.frameType() == WebURLRequest::FrameTypeTopLevel ||
+ request.frameType() == WebURLRequest::FrameTypeAuxiliary) {
+ return RESOURCE_TYPE_MAIN_FRAME;
+ }
+ if (request.frameType() == WebURLRequest::FrameTypeNested)
+ return RESOURCE_TYPE_SUB_FRAME;
+ NOTREACHED();
+ return RESOURCE_TYPE_SUB_RESOURCE;
+ }
+
+ switch (requestContext) {
+ // Favicon
+ case WebURLRequest::RequestContextFavicon:
+ return RESOURCE_TYPE_FAVICON;
+
+ // Font
+ case WebURLRequest::RequestContextFont:
+ return RESOURCE_TYPE_FONT_RESOURCE;
+
+ // Image
+ case WebURLRequest::RequestContextImage:
+ return RESOURCE_TYPE_IMAGE;
+
+ // Media
+ case WebURLRequest::RequestContextAudio:
+ case WebURLRequest::RequestContextVideo:
+ return RESOURCE_TYPE_MEDIA;
+
+ // Object
+ case WebURLRequest::RequestContextEmbed:
+ case WebURLRequest::RequestContextObject:
+ return RESOURCE_TYPE_OBJECT;
+
+ // Ping
+ case WebURLRequest::RequestContextBeacon:
+ case WebURLRequest::RequestContextCSPReport:
+ case WebURLRequest::RequestContextPing:
+ return RESOURCE_TYPE_PING;
+
+ // Prefetch
+ case WebURLRequest::RequestContextPrefetch:
+ return RESOURCE_TYPE_PREFETCH;
+
+ // Script
+ case WebURLRequest::RequestContextScript:
+ return RESOURCE_TYPE_SCRIPT;
+
+ // Style
+ case WebURLRequest::RequestContextXSLT:
+ case WebURLRequest::RequestContextStyle:
+ return RESOURCE_TYPE_STYLESHEET;
+
+ // Subresource
+ case WebURLRequest::RequestContextDownload:
+ case WebURLRequest::RequestContextManifest:
+ case WebURLRequest::RequestContextSubresource:
+ case WebURLRequest::RequestContextPlugin:
+ return RESOURCE_TYPE_SUB_RESOURCE;
+
+ // TextTrack
+ case WebURLRequest::RequestContextTrack:
+ return RESOURCE_TYPE_MEDIA;
+
+ // Workers
+ case WebURLRequest::RequestContextServiceWorker:
+ return RESOURCE_TYPE_SERVICE_WORKER;
+ case WebURLRequest::RequestContextSharedWorker:
+ return RESOURCE_TYPE_SHARED_WORKER;
+ case WebURLRequest::RequestContextWorker:
+ return RESOURCE_TYPE_WORKER;
+
+ // Unspecified
+ case WebURLRequest::RequestContextInternal:
+ case WebURLRequest::RequestContextUnspecified:
+ return RESOURCE_TYPE_SUB_RESOURCE;
+
+ // XHR
+ case WebURLRequest::RequestContextEventSource:
+ case WebURLRequest::RequestContextFetch:
+ case WebURLRequest::RequestContextXMLHttpRequest:
+ return RESOURCE_TYPE_XHR;
+
+ // These should be handled by the FrameType checks at the top of the
+ // function.
+ // Main Frame
+ case WebURLRequest::RequestContextForm:
+ case WebURLRequest::RequestContextHyperlink:
+ case WebURLRequest::RequestContextLocation:
+ case WebURLRequest::RequestContextFrame:
+ case WebURLRequest::RequestContextIframe:
+ NOTREACHED();
+ return RESOURCE_TYPE_SUB_RESOURCE;
+ }
+ NOTREACHED();
+ return RESOURCE_TYPE_SUB_RESOURCE;
+}
+
+} // namespace content
diff --git a/content/child/web_url_request_util.h b/content/child/web_url_request_util.h
new file mode 100644
index 0000000..0238ff0
--- /dev/null
+++ b/content/child/web_url_request_util.h
@@ -0,0 +1,22 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_CHILD_TARGET_TYPE_CONVERSION_H_
+#define CONTENT_CHILD_TARGET_TYPE_CONVERSION_H_
+
+#include "content/common/content_export.h"
+#include "content/public/common/resource_type.h"
+
+namespace blink {
+class WebURLRequest;
+}
+
+namespace content {
+
+CONTENT_EXPORT ResourceType WebURLRequestToResourceType(
+ const blink::WebURLRequest& request);
+
+} // namespace content
+
+#endif // CONTENT_CHILD_TARGET_TYPE_CONVERSION_H_
diff --git a/content/common/content_param_traits_macros.h b/content/common/content_param_traits_macros.h
index c3e31703..52732b0 100644
--- a/content/common/content_param_traits_macros.h
+++ b/content/common/content_param_traits_macros.h
@@ -19,8 +19,8 @@
#undef IPC_MESSAGE_EXPORT
#define IPC_MESSAGE_EXPORT CONTENT_EXPORT
-IPC_ENUM_TRAITS_MAX_VALUE(content::ResourceType::Type,
- content::ResourceType::LAST_TYPE - 1)
+IPC_ENUM_TRAITS_MAX_VALUE(content::ResourceType,
+ content::RESOURCE_TYPE_LAST_TYPE - 1)
IPC_ENUM_TRAITS_MAX_VALUE(blink::WebContentSecurityPolicyType,
blink::WebContentSecurityPolicyTypeLast)
IPC_ENUM_TRAITS_MIN_MAX_VALUE(blink::WebInputEvent::Type,
diff --git a/content/common/resource_messages.h b/content/common/resource_messages.h
index f9f3432..345d2fd 100644
--- a/content/common/resource_messages.h
+++ b/content/common/resource_messages.h
@@ -160,7 +160,7 @@ IPC_STRUCT_BEGIN(ResourceHostMsg_Request)
// What this resource load is for (main frame, sub-frame, sub-resource,
// object).
- IPC_STRUCT_MEMBER(content::ResourceType::Type, resource_type)
+ IPC_STRUCT_MEMBER(content::ResourceType, resource_type)
// The priority of this request.
IPC_STRUCT_MEMBER(net::RequestPriority, priority)
diff --git a/content/common/view_messages.h b/content/common/view_messages.h
index da3aee3..17bde5b 100644
--- a/content/common/view_messages.h
+++ b/content/common/view_messages.h
@@ -1136,7 +1136,7 @@ IPC_MESSAGE_ROUTED5(ViewHostMsg_DidLoadResourceFromMemoryCache,
std::string /* security info */,
std::string /* http method */,
std::string /* mime type */,
- content::ResourceType::Type /* resource type */)
+ content::ResourceType /* resource type */)
// Sent when the renderer displays insecure content in a secure page.
IPC_MESSAGE_ROUTED0(ViewHostMsg_DidDisplayInsecureContent)
diff --git a/content/content_child.gypi b/content/content_child.gypi
index 16289e7..30d2c2d 100644
--- a/content/content_child.gypi
+++ b/content/content_child.gypi
@@ -197,6 +197,8 @@
'child/web_socket_stream_handle_impl.h',
'child/web_url_loader_impl.cc',
'child/web_url_loader_impl.h',
+ 'child/web_url_request_util.cc',
+ 'child/web_url_request_util.h',
'child/webblobregistry_impl.cc',
'child/webblobregistry_impl.h',
'child/webcrypto/algorithm_dispatch.cc',
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
index 42811e6..1885fe2 100644
--- a/content/public/browser/content_browser_client.h
+++ b/content/public/browser/content_browser_client.h
@@ -383,17 +383,16 @@ class CONTENT_EXPORT ContentBrowserClient {
// asynchronously. If |result| is not set to
// CERTIFICATE_REQUEST_RESULT_TYPE_CONTINUE, the request will be cancelled
// or denied immediately, and the callback won't be run.
- virtual void AllowCertificateError(
- int render_process_id,
- int render_frame_id,
- int cert_error,
- const net::SSLInfo& ssl_info,
- const GURL& request_url,
- ResourceType::Type resource_type,
- bool overridable,
- bool strict_enforcement,
- const base::Callback<void(bool)>& callback,
- CertificateRequestResultType* result) {}
+ virtual void AllowCertificateError(int render_process_id,
+ int render_frame_id,
+ int cert_error,
+ const net::SSLInfo& ssl_info,
+ const GURL& request_url,
+ ResourceType resource_type,
+ bool overridable,
+ bool strict_enforcement,
+ const base::Callback<void(bool)>& callback,
+ CertificateRequestResultType* result) {}
// Selects a SSL client certificate and returns it to the |callback|. If no
// certificate was selected NULL is returned to the |callback|.
diff --git a/content/public/browser/load_from_memory_cache_details.cc b/content/public/browser/load_from_memory_cache_details.cc
index a6ce4e5..547d546 100644
--- a/content/public/browser/load_from_memory_cache_details.cc
+++ b/content/public/browser/load_from_memory_cache_details.cc
@@ -13,7 +13,7 @@ LoadFromMemoryCacheDetails::LoadFromMemoryCacheDetails(
net::CertStatus cert_status,
const std::string& http_method,
const std::string& mime_type,
- ResourceType::Type resource_type)
+ ResourceType resource_type)
: url(url),
pid(pid),
cert_id(cert_id),
diff --git a/content/public/browser/load_from_memory_cache_details.h b/content/public/browser/load_from_memory_cache_details.h
index 93fc555..dfd1740 100644
--- a/content/public/browser/load_from_memory_cache_details.h
+++ b/content/public/browser/load_from_memory_cache_details.h
@@ -20,7 +20,7 @@ struct LoadFromMemoryCacheDetails {
net::CertStatus cert_status,
const std::string& http_method,
const std::string& mime_type,
- ResourceType::Type resource_type);
+ ResourceType resource_type);
~LoadFromMemoryCacheDetails();
GURL url;
@@ -29,7 +29,7 @@ struct LoadFromMemoryCacheDetails {
net::CertStatus cert_status;
std::string http_method;
std::string mime_type;
- ResourceType::Type resource_type;
+ ResourceType resource_type;
};
} // namespace content
diff --git a/content/public/browser/resource_dispatcher_host_delegate.cc b/content/public/browser/resource_dispatcher_host_delegate.cc
index 84e0bd1..cb6d91e 100644
--- a/content/public/browser/resource_dispatcher_host_delegate.cc
+++ b/content/public/browser/resource_dispatcher_host_delegate.cc
@@ -13,7 +13,7 @@ bool ResourceDispatcherHostDelegate::ShouldBeginRequest(
int route_id,
const std::string& method,
const GURL& url,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
ResourceContext* resource_context) {
return true;
}
@@ -22,7 +22,7 @@ void ResourceDispatcherHostDelegate::RequestBeginning(
net::URLRequest* request,
ResourceContext* resource_context,
AppCacheService* appcache_service,
- ResourceType::Type resource_type,
+ ResourceType resource_type,
int child_id,
int route_id,
ScopedVector<ResourceThrottle>* throttles) {
diff --git a/content/public/browser/resource_dispatcher_host_delegate.h b/content/public/browser/resource_dispatcher_host_delegate.h
index 15e4152f..433da86 100644
--- a/content/public/browser/resource_dispatcher_host_delegate.h
+++ b/content/public/browser/resource_dispatcher_host_delegate.h
@@ -39,41 +39,39 @@ struct ResourceResponse;
class CONTENT_EXPORT ResourceDispatcherHostDelegate {
public:
// Called when a request begins. Return false to abort the request.
- virtual bool ShouldBeginRequest(
- int child_id,
- int route_id,
- const std::string& method,
- const GURL& url,
- ResourceType::Type resource_type,
- ResourceContext* resource_context);
+ virtual bool ShouldBeginRequest(int child_id,
+ int route_id,
+ const std::string& method,
+ const GURL& url,
+ ResourceType resource_type,
+ ResourceContext* resource_context);
// Called after ShouldBeginRequest to allow the embedder to add resource
// throttles.
- virtual void RequestBeginning(
- net::URLRequest* request,
- ResourceContext* resource_context,
- AppCacheService* appcache_service,
- ResourceType::Type resource_type,
- int child_id,
- int route_id,
- ScopedVector<ResourceThrottle>* throttles);
+ virtual void RequestBeginning(net::URLRequest* request,
+ ResourceContext* resource_context,
+ AppCacheService* appcache_service,
+ ResourceType resource_type,
+ int child_id,
+ int route_id,
+ ScopedVector<ResourceThrottle>* throttles);
// Allows an embedder to add additional resource handlers for a download.
// |must_download| is set if the request must be handled as a download.
- virtual void DownloadStarting(
- net::URLRequest* request,
- ResourceContext* resource_context,
- int child_id,
- int route_id,
- int request_id,
- bool is_content_initiated,
- bool must_download,
- ScopedVector<ResourceThrottle>* throttles);
+ virtual void DownloadStarting(net::URLRequest* request,
+ ResourceContext* resource_context,
+ int child_id,
+ int route_id,
+ int request_id,
+ bool is_content_initiated,
+ bool must_download,
+ ScopedVector<ResourceThrottle>* throttles);
// Creates a ResourceDispatcherHostLoginDelegate that asks the user for a
// username and password.
virtual ResourceDispatcherHostLoginDelegate* CreateLoginDelegate(
- net::AuthChallengeInfo* auth_info, net::URLRequest* request);
+ net::AuthChallengeInfo* auth_info,
+ net::URLRequest* request);
// Launches the url for the given tab. Returns true if an attempt to handle
// the url was made, e.g. by launching an app. Note that this does not
@@ -84,8 +82,8 @@ class CONTENT_EXPORT ResourceDispatcherHostDelegate {
// Returns true if we should force the given resource to be downloaded.
// Otherwise, the content layer decides.
- virtual bool ShouldForceDownloadResource(
- const GURL& url, const std::string& mime_type);
+ virtual bool ShouldForceDownloadResource(const GURL& url,
+ const std::string& mime_type);
// Returns true and sets |origin| if a Stream should be created for the
// resource.
@@ -98,31 +96,27 @@ class CONTENT_EXPORT ResourceDispatcherHostDelegate {
// If the stream will be rendered in a BrowserPlugin, |payload| will contain
// the data that should be given to the old ResourceHandler to forward to the
// renderer process.
- virtual bool ShouldInterceptResourceAsStream(
- net::URLRequest* request,
- const std::string& mime_type,
- GURL* origin,
- std::string* payload);
+ virtual bool ShouldInterceptResourceAsStream(net::URLRequest* request,
+ const std::string& mime_type,
+ GURL* origin,
+ std::string* payload);
// Informs the delegate that a Stream was created. The Stream can be read from
// the blob URL of the Stream, but can only be read once.
- virtual void OnStreamCreated(
- net::URLRequest* request,
- scoped_ptr<content::StreamHandle> stream);
+ virtual void OnStreamCreated(net::URLRequest* request,
+ scoped_ptr<content::StreamHandle> stream);
// Informs the delegate that a response has started.
- virtual void OnResponseStarted(
- net::URLRequest* request,
- ResourceContext* resource_context,
- ResourceResponse* response,
- IPC::Sender* sender);
+ virtual void OnResponseStarted(net::URLRequest* request,
+ ResourceContext* resource_context,
+ ResourceResponse* response,
+ IPC::Sender* sender);
// Informs the delegate that a request has been redirected.
- virtual void OnRequestRedirected(
- const GURL& redirect_url,
- net::URLRequest* request,
- ResourceContext* resource_context,
- ResourceResponse* response);
+ virtual void OnRequestRedirected(const GURL& redirect_url,
+ net::URLRequest* request,
+ ResourceContext* resource_context,
+ ResourceResponse* response);
// Notification that a request has completed.
virtual void RequestComplete(net::URLRequest* url_request);
diff --git a/content/public/browser/resource_request_details.h b/content/public/browser/resource_request_details.h
index 4afb197..48845c6 100644
--- a/content/public/browser/resource_request_details.h
+++ b/content/public/browser/resource_request_details.h
@@ -37,7 +37,7 @@ struct ResourceRequestDetails {
net::URLRequestStatus status;
int ssl_cert_id;
net::CertStatus ssl_cert_status;
- ResourceType::Type resource_type;
+ ResourceType resource_type;
net::HostPortPair socket_address;
int render_frame_id;
// HTTP response code. See HttpResponseHeaders::response_code().
diff --git a/content/public/browser/resource_request_info.h b/content/public/browser/resource_request_info.h
index 91cd1e8..7683d23 100644
--- a/content/public/browser/resource_request_info.h
+++ b/content/public/browser/resource_request_info.h
@@ -30,14 +30,13 @@ class ResourceRequestInfo {
// Allocates a new, dummy ResourceRequestInfo and associates it with the
// given URLRequest.
// NOTE: Add more parameters if you need to initialize other fields.
- CONTENT_EXPORT static void AllocateForTesting(
- net::URLRequest* request,
- ResourceType::Type resource_type,
- ResourceContext* context,
- int render_process_id,
- int render_view_id,
- int render_frame_id,
- bool is_async);
+ CONTENT_EXPORT static void AllocateForTesting(net::URLRequest* request,
+ ResourceType resource_type,
+ ResourceContext* context,
+ int render_process_id,
+ int render_view_id,
+ int render_frame_id,
+ bool is_async);
// Returns the associated RenderFrame for a given process. Returns false, if
// there is no associated RenderFrame. This method does not rely on the
@@ -82,7 +81,7 @@ class ResourceRequestInfo {
virtual int GetParentRenderFrameID() const = 0;
// Returns the associated resource type.
- virtual ResourceType::Type GetResourceType() const = 0;
+ virtual ResourceType GetResourceType() const = 0;
// Returns the process type that initiated this request.
virtual int GetProcessType() const = 0;
diff --git a/content/public/child/resource_dispatcher_delegate.h b/content/public/child/resource_dispatcher_delegate.h
index 31c5b90..6a5da1c 100644
--- a/content/public/child/resource_dispatcher_delegate.h
+++ b/content/public/child/resource_dispatcher_delegate.h
@@ -22,15 +22,13 @@ class CONTENT_EXPORT ResourceDispatcherDelegate {
public:
virtual ~ResourceDispatcherDelegate() {}
- virtual RequestPeer* OnRequestComplete(
- RequestPeer* current_peer,
- ResourceType::Type resource_type,
- int error_code) = 0;
-
- virtual RequestPeer* OnReceivedResponse(
- RequestPeer* current_peer,
- const std::string& mime_type,
- const GURL& url) = 0;
+ virtual RequestPeer* OnRequestComplete(RequestPeer* current_peer,
+ ResourceType resource_type,
+ int error_code) = 0;
+
+ virtual RequestPeer* OnReceivedResponse(RequestPeer* current_peer,
+ const std::string& mime_type,
+ const GURL& url) = 0;
};
} // namespace content
diff --git a/content/public/common/resource_type.cc b/content/public/common/resource_type.cc
index 0921eb5..6ff7fb6 100644
--- a/content/public/common/resource_type.cc
+++ b/content/public/common/resource_type.cc
@@ -4,118 +4,10 @@
#include "content/public/common/resource_type.h"
-#include "base/logging.h"
-
-using blink::WebURLRequest;
-
namespace content {
-// static
-ResourceType::Type ResourceType::FromWebURLRequest(
- const WebURLRequest& request) {
- WebURLRequest::RequestContext requestContext = request.requestContext();
- if (request.frameType() != WebURLRequest::FrameTypeNone) {
- DCHECK(requestContext == WebURLRequest::RequestContextForm ||
- requestContext == WebURLRequest::RequestContextFrame ||
- requestContext == WebURLRequest::RequestContextHyperlink ||
- requestContext == WebURLRequest::RequestContextIframe ||
- requestContext == WebURLRequest::RequestContextInternal ||
- requestContext == WebURLRequest::RequestContextLocation);
- if (request.frameType() == WebURLRequest::FrameTypeTopLevel ||
- request.frameType() == WebURLRequest::FrameTypeAuxiliary) {
- return ResourceType::MAIN_FRAME;
- }
- if (request.frameType() == WebURLRequest::FrameTypeNested)
- return ResourceType::SUB_FRAME;
- NOTREACHED();
- return ResourceType::SUB_RESOURCE;
- }
-
- switch (requestContext) {
- // Favicon
- case WebURLRequest::RequestContextFavicon:
- return ResourceType::FAVICON;
-
- // Font
- case WebURLRequest::RequestContextFont:
- return ResourceType::FONT_RESOURCE;
-
- // Image
- case WebURLRequest::RequestContextImage:
- return ResourceType::IMAGE;
-
- // Media
- case WebURLRequest::RequestContextAudio:
- case WebURLRequest::RequestContextVideo:
- return ResourceType::MEDIA;
-
- // Object
- case WebURLRequest::RequestContextEmbed:
- case WebURLRequest::RequestContextObject:
- return ResourceType::OBJECT;
-
- // Ping
- case WebURLRequest::RequestContextBeacon:
- case WebURLRequest::RequestContextCSPReport:
- case WebURLRequest::RequestContextPing:
- return ResourceType::PING;
-
- // Prefetch
- case WebURLRequest::RequestContextPrefetch:
- return ResourceType::PREFETCH;
-
- // Script
- case WebURLRequest::RequestContextScript:
- return ResourceType::SCRIPT;
-
- // Style
- case WebURLRequest::RequestContextXSLT:
- case WebURLRequest::RequestContextStyle:
- return ResourceType::STYLESHEET;
-
- // Subresource
- case WebURLRequest::RequestContextDownload:
- case WebURLRequest::RequestContextManifest:
- case WebURLRequest::RequestContextSubresource:
- case WebURLRequest::RequestContextPlugin:
- return ResourceType::SUB_RESOURCE;
-
- // TextTrack
- case WebURLRequest::RequestContextTrack:
- return ResourceType::MEDIA;
-
- // Workers
- case WebURLRequest::RequestContextServiceWorker:
- return ResourceType::SERVICE_WORKER;
- case WebURLRequest::RequestContextSharedWorker:
- return ResourceType::SHARED_WORKER;
- case WebURLRequest::RequestContextWorker:
- return ResourceType::WORKER;
-
- // Unspecified
- case WebURLRequest::RequestContextInternal:
- case WebURLRequest::RequestContextUnspecified:
- return ResourceType::SUB_RESOURCE;
-
- // XHR
- case WebURLRequest::RequestContextEventSource:
- case WebURLRequest::RequestContextFetch:
- case WebURLRequest::RequestContextXMLHttpRequest:
- return ResourceType::XHR;
-
- // These should be handled by the FrameType checks at the top of the
- // function.
- // Main Frame
- case WebURLRequest::RequestContextForm:
- case WebURLRequest::RequestContextHyperlink:
- case WebURLRequest::RequestContextLocation:
- case WebURLRequest::RequestContextFrame:
- case WebURLRequest::RequestContextIframe:
- NOTREACHED();
- return ResourceType::SUB_RESOURCE;
- }
- NOTREACHED();
- return ResourceType::SUB_RESOURCE;
+bool IsResourceTypeFrame(ResourceType type) {
+ return type == RESOURCE_TYPE_MAIN_FRAME || type == RESOURCE_TYPE_SUB_FRAME;
}
} // namespace content
diff --git a/content/public/common/resource_type.h b/content/public/common/resource_type.h
index 92d17eb..f71d953 100644
--- a/content/public/common/resource_type.h
+++ b/content/public/common/resource_type.h
@@ -5,74 +5,35 @@
#ifndef CONTENT_PUBLIC_COMMON_RESOURCE_TYPE_H_
#define CONTENT_PUBLIC_COMMON_RESOURCE_TYPE_H_
-#include "base/macros.h"
#include "content/common/content_export.h"
-#include "third_party/WebKit/public/platform/WebURLRequest.h"
namespace content {
-class CONTENT_EXPORT ResourceType {
- public:
- // Used in histograms, so please add new types at the end, and rename unused
- // entries to RESOURCETYPE_UNUSED_0, etc...
- enum Type {
- MAIN_FRAME = 0, // top level page
- SUB_FRAME, // frame or iframe
- STYLESHEET, // a CSS stylesheet
- SCRIPT, // an external script
- IMAGE, // an image (jpg/gif/png/etc)
- FONT_RESOURCE, // a font
- SUB_RESOURCE, // an "other" subresource.
- OBJECT, // an object (or embed) tag for a plugin,
- // or a resource that a plugin requested.
- MEDIA, // a media resource.
- WORKER, // the main resource of a dedicated worker.
- SHARED_WORKER, // the main resource of a shared worker.
- PREFETCH, // an explicitly requested prefetch
- FAVICON, // a favicon
- XHR, // a XMLHttpRequest
- PING, // a ping request for <a ping>
- SERVICE_WORKER, // the main resource of a service worker.
- LAST_TYPE // Place holder so we don't need to change ValidType
- // everytime.
- };
-
- static Type FromWebURLRequest(const blink::WebURLRequest& request);
-
- static bool ValidType(int32 type) {
- return type >= MAIN_FRAME && type < LAST_TYPE;
- }
-
- static Type FromInt(int32 type) {
- return static_cast<Type>(type);
- }
-
- static bool IsFrame(ResourceType::Type type) {
- return type == MAIN_FRAME || type == SUB_FRAME;
- }
-
- static bool IsSharedWorker(ResourceType::Type type) {
- return type == SHARED_WORKER;
- }
-
- static bool IsServiceWorker(ResourceType::Type type) {
- return type == SERVICE_WORKER;
- }
-
- static bool IsSubresource(ResourceType::Type type) {
- return type == STYLESHEET ||
- type == SCRIPT ||
- type == IMAGE ||
- type == FONT_RESOURCE ||
- type == SUB_RESOURCE ||
- type == WORKER ||
- type == XHR;
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(ResourceType);
+// Used in histograms, so please add new types at the end, and rename unused
+// entries to RESOURCETYPE_UNUSED_0, etc...
+enum ResourceType {
+ RESOURCE_TYPE_MAIN_FRAME = 0, // top level page
+ RESOURCE_TYPE_SUB_FRAME, // frame or iframe
+ RESOURCE_TYPE_STYLESHEET, // a CSS stylesheet
+ RESOURCE_TYPE_SCRIPT, // an external script
+ RESOURCE_TYPE_IMAGE, // an image (jpg/gif/png/etc)
+ RESOURCE_TYPE_FONT_RESOURCE, // a font
+ RESOURCE_TYPE_SUB_RESOURCE, // an "other" subresource.
+ RESOURCE_TYPE_OBJECT, // an object (or embed) tag for a plugin,
+ // or a resource that a plugin requested.
+ RESOURCE_TYPE_MEDIA, // a media resource.
+ RESOURCE_TYPE_WORKER, // the main resource of a dedicated worker.
+ RESOURCE_TYPE_SHARED_WORKER, // the main resource of a shared worker.
+ RESOURCE_TYPE_PREFETCH, // an explicitly requested prefetch
+ RESOURCE_TYPE_FAVICON, // a favicon
+ RESOURCE_TYPE_XHR, // a XMLHttpRequest
+ RESOURCE_TYPE_PING, // a ping request for <a ping>
+ RESOURCE_TYPE_SERVICE_WORKER, // the main resource of a service worker.
+ RESOURCE_TYPE_LAST_TYPE
};
+CONTENT_EXPORT bool IsResourceTypeFrame(ResourceType type);
+
} // namespace content
#endif // CONTENT_PUBLIC_COMMON_RESOURCE_TYPE_H_
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 831e624..d547262 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -26,6 +26,7 @@
#include "content/child/service_worker/service_worker_network_provider.h"
#include "content/child/service_worker/web_service_worker_provider_impl.h"
#include "content/child/web_socket_stream_handle_impl.h"
+#include "content/child/web_url_request_util.h"
#include "content/child/webmessageportchannel_impl.h"
#include "content/child/websocket_bridge.h"
#include "content/child/weburlresponse_extradata_impl.h"
@@ -2664,7 +2665,7 @@ void RenderFrameImpl::didLoadResourceFromMemoryCache(
response.securityInfo(),
request.httpMethod().utf8(),
response.mimeType().utf8(),
- ResourceType::FromWebURLRequest(request)));
+ WebURLRequestToResourceType(request)));
}
void RenderFrameImpl::didDisplayInsecureContent(blink::WebLocalFrame* frame) {
diff --git a/extensions/browser/extension_protocols.cc b/extensions/browser/extension_protocols.cc
index e4cd193..87a9e0e 100644
--- a/extensions/browser/extension_protocols.cc
+++ b/extensions/browser/extension_protocols.cc
@@ -296,7 +296,7 @@ bool ExtensionCanLoadInIncognito(const ResourceRequestInfo* info,
// Only allow incognito toplevel navigations to extension resources in
// split mode. In spanning mode, the extension must run in a single process,
// and an incognito tab prevents that.
- if (info->GetResourceType() == ResourceType::MAIN_FRAME) {
+ if (info->GetResourceType() == content::RESOURCE_TYPE_MAIN_FRAME) {
const Extension* extension =
extension_info_map->extensions().GetByID(extension_id);
return extension && extensions::IncognitoInfo::IsSplitMode(extension);
diff --git a/extensions/browser/extension_protocols_unittest.cc b/extensions/browser/extension_protocols_unittest.cc
index 02d9fdf..e2f0607 100644
--- a/extensions/browser/extension_protocols_unittest.cc
+++ b/extensions/browser/extension_protocols_unittest.cc
@@ -120,7 +120,7 @@ class ExtensionProtocolTest : public testing::Test {
}
void StartRequest(net::URLRequest* request,
- ResourceType::Type resource_type) {
+ ResourceType resource_type) {
content::ResourceRequestInfo::AllocateForTesting(request,
resource_type,
&resource_context_,
@@ -181,7 +181,7 @@ TEST_F(ExtensionProtocolTest, IncognitoRequest) {
net::DEFAULT_PRIORITY,
&test_delegate_,
resource_context_.GetRequestContext());
- StartRequest(&request, ResourceType::MAIN_FRAME);
+ StartRequest(&request, content::RESOURCE_TYPE_MAIN_FRAME);
EXPECT_EQ(net::URLRequestStatus::FAILED, request.status().status());
if (cases[i].should_allow_main_frame_load) {
@@ -199,7 +199,7 @@ TEST_F(ExtensionProtocolTest, IncognitoRequest) {
net::DEFAULT_PRIORITY,
&test_delegate_,
resource_context_.GetRequestContext());
- StartRequest(&request, ResourceType::SUB_FRAME);
+ StartRequest(&request, content::RESOURCE_TYPE_SUB_FRAME);
EXPECT_EQ(net::URLRequestStatus::FAILED, request.status().status());
if (cases[i].should_allow_sub_frame_load) {
@@ -241,7 +241,7 @@ TEST_F(ExtensionProtocolTest, ComponentResourceRequest) {
net::DEFAULT_PRIORITY,
&test_delegate_,
resource_context_.GetRequestContext());
- StartRequest(&request, ResourceType::MEDIA);
+ StartRequest(&request, content::RESOURCE_TYPE_MEDIA);
EXPECT_EQ(net::URLRequestStatus::SUCCESS, request.status().status());
CheckForContentLengthHeader(&request);
}
@@ -254,7 +254,7 @@ TEST_F(ExtensionProtocolTest, ComponentResourceRequest) {
net::DEFAULT_PRIORITY,
&test_delegate_,
resource_context_.GetRequestContext());
- StartRequest(&request, ResourceType::MEDIA);
+ StartRequest(&request, content::RESOURCE_TYPE_MEDIA);
EXPECT_EQ(net::URLRequestStatus::SUCCESS, request.status().status());
CheckForContentLengthHeader(&request);
}
@@ -277,7 +277,7 @@ TEST_F(ExtensionProtocolTest, ResourceRequestResponseHeaders) {
net::DEFAULT_PRIORITY,
&test_delegate_,
resource_context_.GetRequestContext());
- StartRequest(&request, ResourceType::MEDIA);
+ StartRequest(&request, content::RESOURCE_TYPE_MEDIA);
EXPECT_EQ(net::URLRequestStatus::SUCCESS, request.status().status());
// Check that cache-related headers are set.
@@ -316,7 +316,7 @@ TEST_F(ExtensionProtocolTest, AllowFrameRequests) {
net::DEFAULT_PRIORITY,
&test_delegate_,
resource_context_.GetRequestContext());
- StartRequest(&request, ResourceType::MAIN_FRAME);
+ StartRequest(&request, content::RESOURCE_TYPE_MAIN_FRAME);
EXPECT_EQ(net::URLRequestStatus::SUCCESS, request.status().status());
}
{
@@ -324,7 +324,7 @@ TEST_F(ExtensionProtocolTest, AllowFrameRequests) {
net::DEFAULT_PRIORITY,
&test_delegate_,
resource_context_.GetRequestContext());
- StartRequest(&request, ResourceType::SUB_FRAME);
+ StartRequest(&request, content::RESOURCE_TYPE_SUB_FRAME);
EXPECT_EQ(net::URLRequestStatus::SUCCESS, request.status().status());
}
@@ -334,7 +334,7 @@ TEST_F(ExtensionProtocolTest, AllowFrameRequests) {
net::DEFAULT_PRIORITY,
&test_delegate_,
resource_context_.GetRequestContext());
- StartRequest(&request, ResourceType::MEDIA);
+ StartRequest(&request, content::RESOURCE_TYPE_MEDIA);
EXPECT_EQ(net::URLRequestStatus::FAILED, request.status().status());
}
}