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

Side by Side Diff: content/browser/download/save_file_resource_handler.cc

Issue 129173002: Adds the new URLRequest::OnBeforeNetworkStart hook to the (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@defer_1_net
Patch Set: Created 6 years, 11 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
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/download/save_file_resource_handler.h" 5 #include "content/browser/download/save_file_resource_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 base::Bind(&SaveFileManager::StartSave, save_manager_, info)); 67 base::Bind(&SaveFileManager::StartSave, save_manager_, info));
68 return true; 68 return true;
69 } 69 }
70 70
71 bool SaveFileResourceHandler::OnWillStart(int request_id, 71 bool SaveFileResourceHandler::OnWillStart(int request_id,
72 const GURL& url, 72 const GURL& url,
73 bool* defer) { 73 bool* defer) {
74 return true; 74 return true;
75 } 75 }
76 76
77 bool SaveFileResourceHandler::OnBeforeNetworkStart(int request_id,
78 const GURL& url,
79 bool* defer) {
80 return true;
81 }
82
77 bool SaveFileResourceHandler::OnWillRead(int request_id, 83 bool SaveFileResourceHandler::OnWillRead(int request_id,
78 scoped_refptr<net::IOBuffer>* buf, 84 scoped_refptr<net::IOBuffer>* buf,
79 int* buf_size, 85 int* buf_size,
80 int min_size) { 86 int min_size) {
81 DCHECK(buf && buf_size); 87 DCHECK(buf && buf_size);
82 if (!read_buffer_.get()) { 88 if (!read_buffer_.get()) {
83 *buf_size = min_size < 0 ? kReadBufSize : min_size; 89 *buf_size = min_size < 0 ? kReadBufSize : min_size;
84 read_buffer_ = new net::IOBuffer(*buf_size); 90 read_buffer_ = new net::IOBuffer(*buf_size);
85 } 91 }
86 *buf = read_buffer_.get(); 92 *buf = read_buffer_.get();
(...skipping 30 matching lines...) Expand all
117 int bytes_downloaded) { 123 int bytes_downloaded) {
118 NOTREACHED(); 124 NOTREACHED();
119 } 125 }
120 126
121 void SaveFileResourceHandler::set_content_length( 127 void SaveFileResourceHandler::set_content_length(
122 const std::string& content_length) { 128 const std::string& content_length) {
123 base::StringToInt64(content_length, &content_length_); 129 base::StringToInt64(content_length, &content_length_);
124 } 130 }
125 131
126 } // namespace content 132 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698