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

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

Issue 2660723002: ResourceHandler::OnWillStart: Remove min_size argument. (Closed)
Patch Set: Merge Created 3 years, 10 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 const GURL& url, 64 const GURL& url,
65 std::unique_ptr<ResourceController> controller) { 65 std::unique_ptr<ResourceController> controller) {
66 if (authorization_state_ == AuthorizationState::AUTHORIZED) { 66 if (authorization_state_ == AuthorizationState::AUTHORIZED) {
67 controller->Resume(); 67 controller->Resume();
68 } else { 68 } else {
69 controller->Cancel(); 69 controller->Cancel();
70 } 70 }
71 } 71 }
72 72
73 bool SaveFileResourceHandler::OnWillRead(scoped_refptr<net::IOBuffer>* buf, 73 bool SaveFileResourceHandler::OnWillRead(scoped_refptr<net::IOBuffer>* buf,
74 int* buf_size, 74 int* buf_size) {
75 int min_size) {
76 DCHECK_EQ(AuthorizationState::AUTHORIZED, authorization_state_); 75 DCHECK_EQ(AuthorizationState::AUTHORIZED, authorization_state_);
77 DCHECK(buf && buf_size); 76 DCHECK(buf && buf_size);
78 if (!read_buffer_.get()) { 77 if (!read_buffer_.get()) {
79 *buf_size = min_size < 0 ? kReadBufSize : min_size; 78 *buf_size = kReadBufSize;
80 read_buffer_ = new net::IOBuffer(*buf_size); 79 read_buffer_ = new net::IOBuffer(*buf_size);
81 } 80 }
82 *buf = read_buffer_.get(); 81 *buf = read_buffer_.get();
83 return true; 82 return true;
84 } 83 }
85 84
86 void SaveFileResourceHandler::OnReadCompleted( 85 void SaveFileResourceHandler::OnReadCompleted(
87 int bytes_read, 86 int bytes_read,
88 std::unique_ptr<ResourceController> controller) { 87 std::unique_ptr<ResourceController> controller) {
89 DCHECK_EQ(AuthorizationState::AUTHORIZED, authorization_state_); 88 DCHECK_EQ(AuthorizationState::AUTHORIZED, authorization_state_);
(...skipping 26 matching lines...) Expand all
116 void SaveFileResourceHandler::OnDataDownloaded(int bytes_downloaded) { 115 void SaveFileResourceHandler::OnDataDownloaded(int bytes_downloaded) {
117 NOTREACHED(); 116 NOTREACHED();
118 } 117 }
119 118
120 void SaveFileResourceHandler::set_content_length( 119 void SaveFileResourceHandler::set_content_length(
121 const std::string& content_length) { 120 const std::string& content_length) {
122 base::StringToInt64(content_length, &content_length_); 121 base::StringToInt64(content_length, &content_length_);
123 } 122 }
124 123
125 } // namespace content 124 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/save_file_resource_handler.h ('k') | content/browser/download/url_downloader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698