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

Side by Side Diff: chrome/browser/download/download_throttling_resource_handler.cc

Issue 8680036: Move ResourceResponse struct into the Content API, since it's used in Chrome. While at it, I also... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: add gypi changes Created 9 years, 1 month 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/download/download_throttling_resource_handler.h" 5 #include "chrome/browser/download/download_throttling_resource_handler.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/browser/download/download_id.h" 8 #include "content/browser/download/download_id.h"
9 #include "content/browser/download/download_resource_handler.h" 9 #include "content/browser/download/download_resource_handler.h"
10 #include "content/browser/download/download_stats.h" 10 #include "content/browser/download/download_stats.h"
11 #include "content/browser/renderer_host/resource_dispatcher_host.h" 11 #include "content/browser/renderer_host/resource_dispatcher_host.h"
12 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" 12 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
13 #include "content/browser/resource_context.h" 13 #include "content/browser/resource_context.h"
14 #include "content/common/resource_response.h" 14 #include "content/public/common/resource_response.h"
15 #include "net/base/io_buffer.h" 15 #include "net/base/io_buffer.h"
16 #include "net/base/mime_sniffer.h" 16 #include "net/base/mime_sniffer.h"
17 17
18 DownloadThrottlingResourceHandler::DownloadThrottlingResourceHandler( 18 DownloadThrottlingResourceHandler::DownloadThrottlingResourceHandler(
19 ResourceHandler* next_handler, 19 ResourceHandler* next_handler,
20 ResourceDispatcherHost* host, 20 ResourceDispatcherHost* host,
21 DownloadRequestLimiter* limiter, 21 DownloadRequestLimiter* limiter,
22 net::URLRequest* request, 22 net::URLRequest* request,
23 const GURL& url, 23 const GURL& url,
24 int render_process_host_id, 24 int render_process_host_id,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 uint64 size) { 58 uint64 size) {
59 DCHECK(!request_closed_); 59 DCHECK(!request_closed_);
60 if (request_allowed_) 60 if (request_allowed_)
61 return next_handler_->OnUploadProgress(request_id, position, size); 61 return next_handler_->OnUploadProgress(request_id, position, size);
62 return true; 62 return true;
63 } 63 }
64 64
65 bool DownloadThrottlingResourceHandler::OnRequestRedirected( 65 bool DownloadThrottlingResourceHandler::OnRequestRedirected(
66 int request_id, 66 int request_id,
67 const GURL& url, 67 const GURL& url,
68 ResourceResponse* response, 68 content::ResourceResponse* response,
69 bool* defer) { 69 bool* defer) {
70 DCHECK(!request_closed_); 70 DCHECK(!request_closed_);
71 if (request_allowed_) { 71 if (request_allowed_) {
72 return next_handler_->OnRequestRedirected(request_id, url, response, defer); 72 return next_handler_->OnRequestRedirected(request_id, url, response, defer);
73 } 73 }
74 url_ = url; 74 url_ = url;
75 return true; 75 return true;
76 } 76 }
77 77
78 bool DownloadThrottlingResourceHandler::OnResponseStarted( 78 bool DownloadThrottlingResourceHandler::OnResponseStarted(
79 int request_id, 79 int request_id,
80 ResourceResponse* response) { 80 content::ResourceResponse* response) {
81 DCHECK(!request_closed_); 81 DCHECK(!request_closed_);
82 if (request_allowed_) 82 if (request_allowed_)
83 return next_handler_->OnResponseStarted(request_id, response); 83 return next_handler_->OnResponseStarted(request_id, response);
84 response_ = response; 84 response_ = response;
85 return true; 85 return true;
86 } 86 }
87 87
88 bool DownloadThrottlingResourceHandler::OnWillStart(int request_id, 88 bool DownloadThrottlingResourceHandler::OnWillStart(int request_id,
89 const GURL& url, 89 const GURL& url,
90 bool* defer) { 90 bool* defer) {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 int buf_size; 187 int buf_size;
188 if (next_handler_->OnWillRead(request_id_, &buffer, &buf_size, 188 if (next_handler_->OnWillRead(request_id_, &buffer, &buf_size,
189 tmp_buffer_length_)) { 189 tmp_buffer_length_)) {
190 CHECK(buf_size >= tmp_buffer_length_); 190 CHECK(buf_size >= tmp_buffer_length_);
191 memcpy(buffer->data(), tmp_buffer_->data(), tmp_buffer_length_); 191 memcpy(buffer->data(), tmp_buffer_->data(), tmp_buffer_length_);
192 next_handler_->OnReadCompleted(request_id_, &tmp_buffer_length_); 192 next_handler_->OnReadCompleted(request_id_, &tmp_buffer_length_);
193 } 193 }
194 tmp_buffer_length_ = 0; 194 tmp_buffer_length_ = 0;
195 tmp_buffer_ = NULL; 195 tmp_buffer_ = NULL;
196 } 196 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_throttling_resource_handler.h ('k') | chrome/browser/net/load_timing_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698