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

Unified Diff: content/browser/content_resource_dispatcher_host_delegate.cc

Issue 1960743002: Remove dependency of AsyncResourceLoader on content/browser/host_zoom_map_impl.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@devtoolsnetlog-loader
Patch Set: missed override Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/content_resource_dispatcher_host_delegate.h ('k') | content/browser/loader/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/content_resource_dispatcher_host_delegate.cc
diff --git a/content/browser/content_resource_dispatcher_host_delegate.cc b/content/browser/content_resource_dispatcher_host_delegate.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2d3b3e197a7710ca58c6558a3e4d599192c7f862
--- /dev/null
+++ b/content/browser/content_resource_dispatcher_host_delegate.cc
@@ -0,0 +1,144 @@
+// Copyright 2016 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/browser/content_resource_dispatcher_host_delegate.h"
+
+#include "content/browser/host_zoom_map_impl.h"
+#include "content/browser/loader/resource_message_filter.h"
+#include "content/browser/loader/resource_request_info_impl.h"
+#include "content/common/view_messages.h"
+#include "content/public/browser/stream_info.h"
+#include "net/url_request/url_request.h"
+
+namespace content {
+
+ContentResourceDispatcherHostDelegate::ContentResourceDispatcherHostDelegate() {
+}
+
+ContentResourceDispatcherHostDelegate::
+ ~ContentResourceDispatcherHostDelegate() {}
+
+void ContentResourceDispatcherHostDelegate::SetChild(
+ ResourceDispatcherHostDelegate* child) {
+ child_ = child;
+}
+
+bool ContentResourceDispatcherHostDelegate::ShouldBeginRequest(
+ const std::string& method,
+ const GURL& url,
+ content::ResourceType resource_type,
+ content::ResourceContext* resource_context) {
+ return child_->ShouldBeginRequest(method, url, resource_type,
+ resource_context);
+}
+
+void ContentResourceDispatcherHostDelegate::RequestBeginning(
+ net::URLRequest* request,
+ content::ResourceContext* resource_context,
+ content::AppCacheService* appcache_service,
+ content::ResourceType resource_type,
+ ScopedVector<content::ResourceThrottle>* throttles) {
+ child_->RequestBeginning(request, resource_context, appcache_service,
+ resource_type, throttles);
+}
+
+void ContentResourceDispatcherHostDelegate::DownloadStarting(
+ net::URLRequest* request,
+ content::ResourceContext* resource_context,
+ int child_id,
+ int route_id,
+ int request_id,
+ bool is_content_initiated,
+ bool must_download,
+ ScopedVector<content::ResourceThrottle>* throttles) {
+ child_->DownloadStarting(request, resource_context, child_id, route_id,
+ request_id, is_content_initiated, must_download,
+ throttles);
+}
+
+content::ResourceDispatcherHostLoginDelegate*
+ContentResourceDispatcherHostDelegate::CreateLoginDelegate(
+ net::AuthChallengeInfo* auth_info,
+ net::URLRequest* request) {
+ return child_->CreateLoginDelegate(auth_info, request);
+}
+
+bool ContentResourceDispatcherHostDelegate::HandleExternalProtocol(
+ const GURL& url,
+ int child_id,
+ const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter,
+ bool is_main_frame,
+ ui::PageTransition page_transition,
+ bool has_user_gesture) {
+ return child_->HandleExternalProtocol(url, child_id, web_contents_getter,
+ is_main_frame, page_transition,
+ has_user_gesture);
+}
+
+bool ContentResourceDispatcherHostDelegate::ShouldForceDownloadResource(
+ const GURL& url,
+ const std::string& mime_type) {
+ return child_->ShouldForceDownloadResource(url, mime_type);
+}
+
+bool ContentResourceDispatcherHostDelegate::ShouldInterceptResourceAsStream(
+ net::URLRequest* request,
+ const base::FilePath& plugin_path,
+ const std::string& mime_type,
+ GURL* origin,
+ std::string* payload) {
+ return child_->ShouldInterceptResourceAsStream(request, plugin_path,
+ mime_type, origin, payload);
+}
+
+void ContentResourceDispatcherHostDelegate::OnStreamCreated(
+ net::URLRequest* request,
+ std::unique_ptr<content::StreamInfo> stream) {
+ child_->OnStreamCreated(request, std::move(stream));
+}
+
+void ContentResourceDispatcherHostDelegate::OnResponseStarted(
+ net::URLRequest* request,
+ content::ResourceContext* resource_context,
+ content::ResourceResponse* response,
+ IPC::Sender* sender) {
+ child_->OnResponseStarted(request, resource_context, response, sender);
+
+ const ResourceRequestInfoImpl* info =
+ ResourceRequestInfoImpl::ForRequest(request);
+ const HostZoomMapImpl* host_zoom_map =
+ static_cast<const HostZoomMapImpl*>(info->filter()->GetHostZoomMap());
+
+ if (info->GetResourceType() == RESOURCE_TYPE_MAIN_FRAME && host_zoom_map) {
+ const GURL& request_url = request->url();
+ int render_process_id = info->GetChildID();
+ int render_view_id = info->GetRouteID();
+
+ double zoom_level = host_zoom_map->GetZoomLevelForView(
+ request_url, render_process_id, render_view_id);
+
+ info->filter()->Send(new ViewMsg_SetZoomLevelForLoadingURL(
+ render_view_id, request_url, zoom_level));
+ }
+}
+
+void ContentResourceDispatcherHostDelegate::OnRequestRedirected(
+ const GURL& redirect_url,
+ net::URLRequest* request,
+ content::ResourceContext* resource_context,
+ content::ResourceResponse* response) {
+ child_->OnRequestRedirected(redirect_url, request, resource_context,
+ response);
+}
+
+void ContentResourceDispatcherHostDelegate::RequestComplete(
+ net::URLRequest* url_request) {}
+
+bool ContentResourceDispatcherHostDelegate::ShouldEnableLoFiMode(
+ const net::URLRequest& url_request,
+ content::ResourceContext* resource_context) {
+ return child_->ShouldEnableLoFiMode(url_request, resource_context);
+}
+
+} // namespace content
« no previous file with comments | « content/browser/content_resource_dispatcher_host_delegate.h ('k') | content/browser/loader/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698