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

Side by Side Diff: content/browser/loader/sync_resource_handler.cc

Issue 1953593002: Move DevToolsNetLogObserver to c/b/loader and create stub of network service interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix comment 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 unified diff | Download patch
« no previous file with comments | « content/browser/loader/netlog_observer.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/loader/sync_resource_handler.h" 5 #include "content/browser/loader/sync_resource_handler.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/browser/devtools/devtools_netlog_observer.h" 8 #include "content/browser/loader/netlog_observer.h"
9 #include "content/browser/loader/resource_dispatcher_host_impl.h" 9 #include "content/browser/loader/resource_dispatcher_host_impl.h"
10 #include "content/browser/loader/resource_message_filter.h" 10 #include "content/browser/loader/resource_message_filter.h"
11 #include "content/browser/loader/resource_request_info_impl.h" 11 #include "content/browser/loader/resource_request_info_impl.h"
12 #include "content/common/resource_messages.h" 12 #include "content/common/resource_messages.h"
13 #include "content/public/browser/resource_dispatcher_host_delegate.h" 13 #include "content/public/browser/resource_dispatcher_host_delegate.h"
14 #include "content/public/browser/resource_request_info.h" 14 #include "content/public/browser/resource_request_info.h"
15 #include "net/base/io_buffer.h" 15 #include "net/base/io_buffer.h"
16 #include "net/http/http_response_headers.h" 16 #include "net/http/http_response_headers.h"
17 #include "net/url_request/redirect_info.h" 17 #include "net/url_request/redirect_info.h"
18 18
(...skipping 25 matching lines...) Expand all
44 bool SyncResourceHandler::OnRequestRedirected( 44 bool SyncResourceHandler::OnRequestRedirected(
45 const net::RedirectInfo& redirect_info, 45 const net::RedirectInfo& redirect_info,
46 ResourceResponse* response, 46 ResourceResponse* response,
47 bool* defer) { 47 bool* defer) {
48 if (rdh_->delegate()) { 48 if (rdh_->delegate()) {
49 rdh_->delegate()->OnRequestRedirected( 49 rdh_->delegate()->OnRequestRedirected(
50 redirect_info.new_url, request(), GetRequestInfo()->GetContext(), 50 redirect_info.new_url, request(), GetRequestInfo()->GetContext(),
51 response); 51 response);
52 } 52 }
53 53
54 DevToolsNetLogObserver::PopulateResponseInfo(request(), response); 54 NetLogObserver::PopulateResponseInfo(request(), response);
55 // TODO(darin): It would be much better if this could live in WebCore, but 55 // TODO(darin): It would be much better if this could live in WebCore, but
56 // doing so requires API changes at all levels. Similar code exists in 56 // doing so requires API changes at all levels. Similar code exists in
57 // WebCore/platform/network/cf/ResourceHandleCFNet.cpp :-( 57 // WebCore/platform/network/cf/ResourceHandleCFNet.cpp :-(
58 if (redirect_info.new_url.GetOrigin() != result_.final_url.GetOrigin()) { 58 if (redirect_info.new_url.GetOrigin() != result_.final_url.GetOrigin()) {
59 LOG(ERROR) << "Cross origin redirect denied"; 59 LOG(ERROR) << "Cross origin redirect denied";
60 return false; 60 return false;
61 } 61 }
62 result_.final_url = redirect_info.new_url; 62 result_.final_url = redirect_info.new_url;
63 63
64 total_transfer_size_ += request()->GetTotalReceivedBytes(); 64 total_transfer_size_ += request()->GetTotalReceivedBytes();
65 return true; 65 return true;
66 } 66 }
67 67
68 bool SyncResourceHandler::OnResponseStarted( 68 bool SyncResourceHandler::OnResponseStarted(
69 ResourceResponse* response, 69 ResourceResponse* response,
70 bool* defer) { 70 bool* defer) {
71 const ResourceRequestInfoImpl* info = GetRequestInfo(); 71 const ResourceRequestInfoImpl* info = GetRequestInfo();
72 if (!info->filter()) 72 if (!info->filter())
73 return false; 73 return false;
74 74
75 if (rdh_->delegate()) { 75 if (rdh_->delegate()) {
76 rdh_->delegate()->OnResponseStarted( 76 rdh_->delegate()->OnResponseStarted(
77 request(), info->GetContext(), response, info->filter()); 77 request(), info->GetContext(), response, info->filter());
78 } 78 }
79 79
80 DevToolsNetLogObserver::PopulateResponseInfo(request(), response); 80 NetLogObserver::PopulateResponseInfo(request(), response);
81 81
82 // We don't care about copying the status here. 82 // We don't care about copying the status here.
83 result_.headers = response->head.headers; 83 result_.headers = response->head.headers;
84 result_.mime_type = response->head.mime_type; 84 result_.mime_type = response->head.mime_type;
85 result_.charset = response->head.charset; 85 result_.charset = response->head.charset;
86 result_.download_file_path = response->head.download_file_path; 86 result_.download_file_path = response->head.download_file_path;
87 result_.request_time = response->head.request_time; 87 result_.request_time = response->head.request_time;
88 result_.response_time = response->head.response_time; 88 result_.response_time = response->head.response_time;
89 result_.load_timing = response->head.load_timing; 89 result_.load_timing = response->head.load_timing;
90 result_.devtools_info = response->head.devtools_info; 90 result_.devtools_info = response->head.devtools_info;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 result_message_ = NULL; 133 result_message_ = NULL;
134 return; 134 return;
135 } 135 }
136 136
137 void SyncResourceHandler::OnDataDownloaded(int bytes_downloaded) { 137 void SyncResourceHandler::OnDataDownloaded(int bytes_downloaded) {
138 // Sync requests don't involve ResourceMsg_DataDownloaded messages 138 // Sync requests don't involve ResourceMsg_DataDownloaded messages
139 // being sent back to renderers as progress is made. 139 // being sent back to renderers as progress is made.
140 } 140 }
141 141
142 } // namespace content 142 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/netlog_observer.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698