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

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

Issue 3431032: Change ChildProcessSecurityPolicy to store a list of allowed flags for... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' 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
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/redirect_to_file_resource_handler.h" 5 #include "chrome/browser/renderer_host/redirect_to_file_resource_handler.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/file_util_proxy.h" 8 #include "base/file_util_proxy.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/platform_file.h" 10 #include "base/platform_file.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 } 156 }
157 157
158 void RedirectToFileResourceHandler::DidCreateTemporaryFile( 158 void RedirectToFileResourceHandler::DidCreateTemporaryFile(
159 base::PlatformFileError /*error_code*/, 159 base::PlatformFileError /*error_code*/,
160 base::PassPlatformFile file_handle, 160 base::PassPlatformFile file_handle,
161 FilePath file_path) { 161 FilePath file_path) {
162 file_path_ = file_path; 162 file_path_ = file_path;
163 file_stream_.reset(new net::FileStream(file_handle.ReleaseValue(), 163 file_stream_.reset(new net::FileStream(file_handle.ReleaseValue(),
164 base::PLATFORM_FILE_WRITE | 164 base::PLATFORM_FILE_WRITE |
165 base::PLATFORM_FILE_ASYNC)); 165 base::PLATFORM_FILE_ASYNC));
166 ChildProcessSecurityPolicy::GetInstance()->GrantUploadFile( 166 ChildProcessSecurityPolicy::GetInstance()->GrantReadFile(
167 process_id_, file_path); 167 process_id_, file_path);
168 host_->StartDeferredRequest(process_id_, request_id_); 168 host_->StartDeferredRequest(process_id_, request_id_);
169 } 169 }
170 170
171 void RedirectToFileResourceHandler::DidWriteToFile(int result) { 171 void RedirectToFileResourceHandler::DidWriteToFile(int result) {
172 write_callback_pending_ = false; 172 write_callback_pending_ = false;
173 173
174 bool failed = false; 174 bool failed = false;
175 if (result > 0) { 175 if (result > 0) {
176 write_cursor_ += result; 176 write_cursor_ += result;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 } 213 }
214 } 214 }
215 215
216 bool RedirectToFileResourceHandler::BufIsFull() const { 216 bool RedirectToFileResourceHandler::BufIsFull() const {
217 // This is a hack to workaround BufferedResourceHandler's inability to 217 // This is a hack to workaround BufferedResourceHandler's inability to
218 // deal with a ResourceHandler that returns a buffer size of less than 218 // deal with a ResourceHandler that returns a buffer size of less than
219 // 2 * net::kMaxBytesToSniff from its OnWillRead method. 219 // 2 * net::kMaxBytesToSniff from its OnWillRead method.
220 // TODO(darin): Fix this retardation! 220 // TODO(darin): Fix this retardation!
221 return buf_->RemainingCapacity() <= (2 * net::kMaxBytesToSniff); 221 return buf_->RemainingCapacity() <= (2 * net::kMaxBytesToSniff);
222 } 222 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698