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

Side by Side Diff: content/browser/renderer_host/pepper/pepper_file_system_browser_host.cc

Issue 105553005: Make PepperWebPlugin not use RenderViews. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: review comments Created 7 years 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/renderer_host/pepper/pepper_file_system_browser_host.h " 5 #include "content/browser/renderer_host/pepper/pepper_file_system_browser_host.h "
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "content/browser/renderer_host/pepper/pepper_file_io_host.h" 9 #include "content/browser/renderer_host/pepper/pepper_file_io_host.h"
10 #include "content/browser/renderer_host/pepper/quota_reservation.h" 10 #include "content/browser/renderer_host/pepper/quota_reservation.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 // all pending file system operations. 78 // all pending file system operations.
79 if (file_system_operation_runner_) 79 if (file_system_operation_runner_)
80 file_system_operation_runner_->Shutdown(); 80 file_system_operation_runner_->Shutdown();
81 } 81 }
82 82
83 void PepperFileSystemBrowserHost::OpenExisting(const GURL& root_url, 83 void PepperFileSystemBrowserHost::OpenExisting(const GURL& root_url,
84 const base::Closure& callback) { 84 const base::Closure& callback) {
85 root_url_ = root_url; 85 root_url_ = root_url;
86 int render_process_id = 0; 86 int render_process_id = 0;
87 int unused; 87 int unused;
88 if (!browser_ppapi_host_->GetRenderViewIDsForInstance( 88 if (!browser_ppapi_host_->GetRenderFrameIDsForInstance(
89 pp_instance(), &render_process_id, &unused)) { 89 pp_instance(), &render_process_id, &unused)) {
90 NOTREACHED(); 90 NOTREACHED();
91 } 91 }
92 called_open_ = true; 92 called_open_ = true;
93 // Get the file system context asynchronously, and then complete the Open 93 // Get the file system context asynchronously, and then complete the Open
94 // operation by calling |callback|. 94 // operation by calling |callback|.
95 BrowserThread::PostTaskAndReplyWithResult( 95 BrowserThread::PostTaskAndReplyWithResult(
96 BrowserThread::UI, 96 BrowserThread::UI,
97 FROM_HERE, 97 FROM_HERE,
98 base::Bind(&GetFileSystemContextFromRenderId, render_process_id), 98 base::Bind(&GetFileSystemContextFromRenderId, render_process_id),
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 return PP_ERROR_INPROGRESS; 190 return PP_ERROR_INPROGRESS;
191 called_open_ = true; 191 called_open_ = true;
192 192
193 fileapi::FileSystemType file_system_type = 193 fileapi::FileSystemType file_system_type =
194 ppapi::PepperFileSystemTypeToFileSystemType(type_); 194 ppapi::PepperFileSystemTypeToFileSystemType(type_);
195 if (file_system_type == fileapi::kFileSystemTypeUnknown) 195 if (file_system_type == fileapi::kFileSystemTypeUnknown)
196 return PP_ERROR_FAILED; 196 return PP_ERROR_FAILED;
197 197
198 int render_process_id = 0; 198 int render_process_id = 0;
199 int unused; 199 int unused;
200 if (!browser_ppapi_host_->GetRenderViewIDsForInstance(pp_instance(), 200 if (!browser_ppapi_host_->GetRenderFrameIDsForInstance(pp_instance(),
201 &render_process_id, 201 &render_process_id,
202 &unused)) { 202 &unused)) {
203 return PP_ERROR_FAILED; 203 return PP_ERROR_FAILED;
204 } 204 }
205 205
206 BrowserThread::PostTaskAndReplyWithResult( 206 BrowserThread::PostTaskAndReplyWithResult(
207 BrowserThread::UI, 207 BrowserThread::UI,
208 FROM_HERE, 208 FROM_HERE,
209 base::Bind(&GetFileSystemContextFromRenderId, render_process_id), 209 base::Bind(&GetFileSystemContextFromRenderId, render_process_id),
210 base::Bind(&PepperFileSystemBrowserHost::OpenFileSystem, 210 base::Bind(&PepperFileSystemBrowserHost::OpenFileSystem,
211 weak_factory_.GetWeakPtr(), 211 weak_factory_.GetWeakPtr(),
212 context->MakeReplyMessageContext(), 212 context->MakeReplyMessageContext(),
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 if (called_open_) 353 if (called_open_)
354 return PP_ERROR_INPROGRESS; 354 return PP_ERROR_INPROGRESS;
355 called_open_ = true; 355 called_open_ = true;
356 356
357 // Do a sanity check. 357 // Do a sanity check.
358 if (!fileapi::ValidateIsolatedFileSystemId(fsid)) 358 if (!fileapi::ValidateIsolatedFileSystemId(fsid))
359 return PP_ERROR_BADARGUMENT; 359 return PP_ERROR_BADARGUMENT;
360 360
361 int render_process_id = 0; 361 int render_process_id = 0;
362 int unused; 362 int unused;
363 if (!browser_ppapi_host_->GetRenderViewIDsForInstance(pp_instance(), 363 if (!browser_ppapi_host_->GetRenderFrameIDsForInstance(pp_instance(),
364 &render_process_id, 364 &render_process_id,
365 &unused)) { 365 &unused)) {
366 fileapi::IsolatedContext::GetInstance()->RevokeFileSystem(fsid); 366 fileapi::IsolatedContext::GetInstance()->RevokeFileSystem(fsid);
367 return PP_ERROR_FAILED; 367 return PP_ERROR_FAILED;
368 } 368 }
369 369
370 root_url_ = GURL(fileapi::GetIsolatedFileSystemRootURIString( 370 root_url_ = GURL(fileapi::GetIsolatedFileSystemRootURIString(
371 browser_ppapi_host_->GetDocumentURLForInstance(pp_instance()).GetOrigin(), 371 browser_ppapi_host_->GetDocumentURLForInstance(pp_instance()).GetOrigin(),
372 fsid, ppapi::IsolatedFileSystemTypeToRootName(type))); 372 fsid, ppapi::IsolatedFileSystemTypeToRootName(type)));
373 373
374 BrowserThread::PostTaskAndReplyWithResult( 374 BrowserThread::PostTaskAndReplyWithResult(
375 BrowserThread::UI, 375 BrowserThread::UI,
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 if (!IsAsciiAlpha(*it) && !IsAsciiDigit(*it) && 540 if (!IsAsciiAlpha(*it) && !IsAsciiDigit(*it) &&
541 *it != '.' && *it != '_' && *it != '-') { 541 *it != '.' && *it != '_' && *it != '-') {
542 LOG(WARNING) << "Failed to generate a plugin id."; 542 LOG(WARNING) << "Failed to generate a plugin id.";
543 return std::string(); 543 return std::string();
544 } 544 }
545 } 545 }
546 return output; 546 return output;
547 } 547 }
548 548
549 } // namespace content 549 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698