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

Side by Side Diff: chrome/browser/renderer_host/sync_resource_handler.cc

Issue 3133016: Support retrieval of raw headers from network stack (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: nits picked Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/renderer_host/resource_dispatcher_host.cc ('k') | chrome/chrome.gyp » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/renderer_host/sync_resource_handler.h" 5 #include "chrome/browser/renderer_host/sync_resource_handler.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/debugger/devtools_netlog_observer.h"
8 #include "chrome/browser/net/load_timing_observer.h" 9 #include "chrome/browser/net/load_timing_observer.h"
9 #include "chrome/browser/renderer_host/global_request_id.h" 10 #include "chrome/browser/renderer_host/global_request_id.h"
10 #include "chrome/common/render_messages.h" 11 #include "chrome/common/render_messages.h"
11 #include "net/base/io_buffer.h" 12 #include "net/base/io_buffer.h"
12 #include "net/http/http_response_headers.h" 13 #include "net/http/http_response_headers.h"
13 14
14 SyncResourceHandler::SyncResourceHandler( 15 SyncResourceHandler::SyncResourceHandler(
15 ResourceDispatcherHost::Receiver* receiver, 16 ResourceDispatcherHost::Receiver* receiver,
16 int process_id, 17 int process_id,
17 const GURL& url, 18 const GURL& url,
(...skipping 16 matching lines...) Expand all
34 return true; 35 return true;
35 } 36 }
36 37
37 bool SyncResourceHandler::OnRequestRedirected(int request_id, 38 bool SyncResourceHandler::OnRequestRedirected(int request_id,
38 const GURL& new_url, 39 const GURL& new_url,
39 ResourceResponse* response, 40 ResourceResponse* response,
40 bool* defer) { 41 bool* defer) {
41 URLRequest* request = rdh_->GetURLRequest( 42 URLRequest* request = rdh_->GetURLRequest(
42 GlobalRequestID(process_id_, request_id)); 43 GlobalRequestID(process_id_, request_id));
43 LoadTimingObserver::PopulateTimingInfo(request, response); 44 LoadTimingObserver::PopulateTimingInfo(request, response);
44 45 DevToolsNetLogObserver::PopulateResponseInfo(request, response);
45 // TODO(darin): It would be much better if this could live in WebCore, but 46 // TODO(darin): It would be much better if this could live in WebCore, but
46 // doing so requires API changes at all levels. Similar code exists in 47 // doing so requires API changes at all levels. Similar code exists in
47 // WebCore/platform/network/cf/ResourceHandleCFNet.cpp :-( 48 // WebCore/platform/network/cf/ResourceHandleCFNet.cpp :-(
48 if (new_url.GetOrigin() != result_.final_url.GetOrigin()) { 49 if (new_url.GetOrigin() != result_.final_url.GetOrigin()) {
49 LOG(ERROR) << "Cross origin redirect denied"; 50 LOG(ERROR) << "Cross origin redirect denied";
50 return false; 51 return false;
51 } 52 }
52 result_.final_url = new_url; 53 result_.final_url = new_url;
53 return true; 54 return true;
54 } 55 }
55 56
56 bool SyncResourceHandler::OnResponseStarted(int request_id, 57 bool SyncResourceHandler::OnResponseStarted(int request_id,
57 ResourceResponse* response) { 58 ResourceResponse* response) {
58 URLRequest* request = rdh_->GetURLRequest( 59 URLRequest* request = rdh_->GetURLRequest(
59 GlobalRequestID(process_id_, request_id)); 60 GlobalRequestID(process_id_, request_id));
60 LoadTimingObserver::PopulateTimingInfo(request, response); 61 LoadTimingObserver::PopulateTimingInfo(request, response);
62 DevToolsNetLogObserver::PopulateResponseInfo(request, response);
61 63
62 // We don't care about copying the status here. 64 // We don't care about copying the status here.
63 result_.headers = response->response_head.headers; 65 result_.headers = response->response_head.headers;
64 result_.mime_type = response->response_head.mime_type; 66 result_.mime_type = response->response_head.mime_type;
65 result_.charset = response->response_head.charset; 67 result_.charset = response->response_head.charset;
66 result_.download_file_path = response->response_head.download_file_path; 68 result_.download_file_path = response->response_head.download_file_path;
67 result_.request_time = response->response_head.request_time; 69 result_.request_time = response->response_head.request_time;
68 result_.response_time = response->response_head.response_time; 70 result_.response_time = response->response_head.response_time;
69 result_.connection_id = response->response_head.connection_id; 71 result_.connection_id = response->response_head.connection_id;
70 result_.connection_reused = response->response_head.connection_reused; 72 result_.connection_reused = response->response_head.connection_reused;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 } 108 }
107 109
108 void SyncResourceHandler::OnRequestClosed() { 110 void SyncResourceHandler::OnRequestClosed() {
109 if (!result_message_) 111 if (!result_message_)
110 return; 112 return;
111 113
112 result_message_->set_reply_error(); 114 result_message_->set_reply_error();
113 receiver_->Send(result_message_); 115 receiver_->Send(result_message_);
114 receiver_ = NULL; // URLRequest is gone, and perhaps also the receiver. 116 receiver_ = NULL; // URLRequest is gone, and perhaps also the receiver.
115 } 117 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/resource_dispatcher_host.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698