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

Side by Side Diff: chrome/browser/plugin_process_host.cc

Issue 28349: Make sure the scoped_ptr is set before checking if the file is open. Fixes a ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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 | « no previous file | no next file » | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "chrome/browser/plugin_process_host.h" 7 #include "chrome/browser/plugin_process_host.h"
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <windows.h> 10 #include <windows.h>
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 download_file_buffer_(new net::IOBuffer(kDownloadFileBufferSize)), 110 download_file_buffer_(new net::IOBuffer(kDownloadFileBufferSize)),
111 download_file_caller_window_(caller_window), 111 download_file_caller_window_(caller_window),
112 download_url_(download_url), 112 download_url_(download_url),
113 download_source_pid_(source_pid) { 113 download_source_pid_(source_pid) {
114 #if defined(OS_WIN) 114 #if defined(OS_WIN)
115 DCHECK(::IsWindow(caller_window)); 115 DCHECK(::IsWindow(caller_window));
116 #else 116 #else
117 // TODO(port): Some window verification for mac and linux. 117 // TODO(port): Some window verification for mac and linux.
118 #endif 118 #endif
119 memset(download_file_buffer_->data(), 0, kDownloadFileBufferSize); 119 memset(download_file_buffer_->data(), 0, kDownloadFileBufferSize);
120 download_file_.reset(new net::FileStream());
120 } 121 }
121 122
122 PluginDownloadUrlHelper::~PluginDownloadUrlHelper() { 123 PluginDownloadUrlHelper::~PluginDownloadUrlHelper() {
123 if (download_file_request_) { 124 if (download_file_request_) {
124 delete download_file_request_; 125 delete download_file_request_;
125 download_file_request_ = NULL; 126 download_file_request_ = NULL;
126 } 127 }
127 } 128 }
128 129
129 void PluginDownloadUrlHelper::InitiateDownload() { 130 void PluginDownloadUrlHelper::InitiateDownload() {
(...skipping 20 matching lines...) Expand all
150 URLRequest::Delegate::OnSSLCertificateError(request, cert_error, cert); 151 URLRequest::Delegate::OnSSLCertificateError(request, cert_error, cert);
151 DownloadCompletedHelper(false); 152 DownloadCompletedHelper(false);
152 } 153 }
153 154
154 void PluginDownloadUrlHelper::OnResponseStarted(URLRequest* request) { 155 void PluginDownloadUrlHelper::OnResponseStarted(URLRequest* request) {
155 if (!download_file_->IsOpen()) { 156 if (!download_file_->IsOpen()) {
156 file_util::GetTempDir(&download_file_path_); 157 file_util::GetTempDir(&download_file_path_);
157 158
158 GURL request_url = request->url(); 159 GURL request_url = request->url();
159 #if defined(OS_WIN) 160 #if defined(OS_WIN)
160 download_file_path_.Append(UTF8ToWide(request_url.ExtractFileName())); 161 download_file_path_ = download_file_path_.Append(
162 UTF8ToWide(request_url.ExtractFileName()));
161 #else 163 #else
162 download_file_path_.Append(request_url.ExtractFileName()); 164 download_file_path_ = download_file_path_.Append(
165 request_url.ExtractFileName());
163 #endif 166 #endif
164 167
165 download_file_->Open(download_file_path_, 168 download_file_->Open(download_file_path_,
166 base::PLATFORM_FILE_CREATE_ALWAYS | 169 base::PLATFORM_FILE_CREATE_ALWAYS |
167 base::PLATFORM_FILE_READ | base::PLATFORM_FILE_WRITE); 170 base::PLATFORM_FILE_READ | base::PLATFORM_FILE_WRITE);
168 if (!download_file_->IsOpen()) { 171 if (!download_file_->IsOpen()) {
169 NOTREACHED(); 172 NOTREACHED();
170 OnDownloadCompleted(request); 173 OnDownloadCompleted(request);
171 return; 174 return;
172 } 175 }
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 } 791 }
789 792
790 void PluginProcessHost::Shutdown() { 793 void PluginProcessHost::Shutdown() {
791 #if defined(OS_WIN) 794 #if defined(OS_WIN)
792 Send(new PluginProcessMsg_BrowserShutdown); 795 Send(new PluginProcessMsg_BrowserShutdown);
793 #else 796 #else
794 // TODO(port): Port plugin_messages_internal.h. 797 // TODO(port): Port plugin_messages_internal.h.
795 NOTIMPLEMENTED(); 798 NOTIMPLEMENTED();
796 #endif 799 #endif
797 } 800 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698