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

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

Issue 424213006: Extract PepperFileSystemTypeToFileSystemType() from ppapi. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: looks like CONTENT_EXPORT is not needed? Created 6 years, 4 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 | content/common/pepper_file_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "content/common/pepper_file_util.h"
11 #include "content/public/browser/browser_ppapi_host.h" 12 #include "content/public/browser/browser_ppapi_host.h"
12 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
13 #include "content/public/browser/plugin_service.h" 14 #include "content/public/browser/plugin_service.h"
14 #include "content/public/browser/render_process_host.h" 15 #include "content/public/browser/render_process_host.h"
15 #include "content/public/browser/storage_partition.h" 16 #include "content/public/browser/storage_partition.h"
16 #include "content/public/common/pepper_plugin_info.h" 17 #include "content/public/common/pepper_plugin_info.h"
17 #include "net/base/mime_util.h" 18 #include "net/base/mime_util.h"
18 #include "ppapi/c/pp_errors.h" 19 #include "ppapi/c/pp_errors.h"
19 #include "ppapi/host/dispatch_host_message.h" 20 #include "ppapi/host/dispatch_host_message.h"
20 #include "ppapi/host/ppapi_host.h" 21 #include "ppapi/host/ppapi_host.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 int64_t /* unused */) { 157 int64_t /* unused */) {
157 // TODO(raymes): The file system size is now unused by FileSystemDispatcher. 158 // TODO(raymes): The file system size is now unused by FileSystemDispatcher.
158 // Figure out why. Why is the file system size signed? 159 // Figure out why. Why is the file system size signed?
159 160
160 // Not allow multiple opens. 161 // Not allow multiple opens.
161 if (called_open_) 162 if (called_open_)
162 return PP_ERROR_INPROGRESS; 163 return PP_ERROR_INPROGRESS;
163 called_open_ = true; 164 called_open_ = true;
164 165
165 fileapi::FileSystemType file_system_type = 166 fileapi::FileSystemType file_system_type =
166 ppapi::PepperFileSystemTypeToFileSystemType(type_); 167 PepperFileSystemTypeToFileSystemType(type_);
167 if (file_system_type == fileapi::kFileSystemTypeUnknown) 168 if (file_system_type == fileapi::kFileSystemTypeUnknown)
168 return PP_ERROR_FAILED; 169 return PP_ERROR_FAILED;
169 170
170 int render_process_id = 0; 171 int render_process_id = 0;
171 int unused; 172 int unused;
172 if (!browser_ppapi_host_->GetRenderFrameIDsForInstance( 173 if (!browser_ppapi_host_->GetRenderFrameIDsForInstance(
173 pp_instance(), &render_process_id, &unused)) { 174 pp_instance(), &render_process_id, &unused)) {
174 return PP_ERROR_FAILED; 175 return PP_ERROR_FAILED;
175 } 176 }
176 177
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 // Some file system types don't have quota. 420 // Some file system types don't have quota.
420 if (!ppapi::FileSystemTypeHasQuota(type_)) 421 if (!ppapi::FileSystemTypeHasQuota(type_))
421 return false; 422 return false;
422 423
423 // For file system types with quota, some origins have unlimited storage. 424 // For file system types with quota, some origins have unlimited storage.
424 quota::QuotaManagerProxy* quota_manager_proxy = 425 quota::QuotaManagerProxy* quota_manager_proxy =
425 file_system_context_->quota_manager_proxy(); 426 file_system_context_->quota_manager_proxy();
426 CHECK(quota_manager_proxy); 427 CHECK(quota_manager_proxy);
427 CHECK(quota_manager_proxy->quota_manager()); 428 CHECK(quota_manager_proxy->quota_manager());
428 fileapi::FileSystemType file_system_type = 429 fileapi::FileSystemType file_system_type =
429 ppapi::PepperFileSystemTypeToFileSystemType(type_); 430 PepperFileSystemTypeToFileSystemType(type_);
430 return !quota_manager_proxy->quota_manager()->IsStorageUnlimited( 431 return !quota_manager_proxy->quota_manager()->IsStorageUnlimited(
431 root_url_.GetOrigin(), 432 root_url_.GetOrigin(),
432 fileapi::FileSystemTypeToQuotaStorageType(file_system_type)); 433 fileapi::FileSystemTypeToQuotaStorageType(file_system_type));
433 } 434 }
434 435
435 void PepperFileSystemBrowserHost::CreateQuotaReservation( 436 void PepperFileSystemBrowserHost::CreateQuotaReservation(
436 const base::Closure& callback) { 437 const base::Closure& callback) {
437 DCHECK(root_url_.is_valid()); 438 DCHECK(root_url_.is_valid());
438 base::PostTaskAndReplyWithResult( 439 base::PostTaskAndReplyWithResult(
439 file_system_context_->default_file_task_runner(), 440 file_system_context_->default_file_task_runner(),
440 FROM_HERE, 441 FROM_HERE,
441 base::Bind(&QuotaReservation::Create, 442 base::Bind(&QuotaReservation::Create,
442 file_system_context_, 443 file_system_context_,
443 root_url_.GetOrigin(), 444 root_url_.GetOrigin(),
444 ppapi::PepperFileSystemTypeToFileSystemType(type_)), 445 PepperFileSystemTypeToFileSystemType(type_)),
445 base::Bind(&PepperFileSystemBrowserHost::GotQuotaReservation, 446 base::Bind(&PepperFileSystemBrowserHost::GotQuotaReservation,
446 weak_factory_.GetWeakPtr(), 447 weak_factory_.GetWeakPtr(),
447 callback)); 448 callback));
448 } 449 }
449 450
450 void PepperFileSystemBrowserHost::GotQuotaReservation( 451 void PepperFileSystemBrowserHost::GotQuotaReservation(
451 const base::Closure& callback, 452 const base::Closure& callback,
452 scoped_refptr<QuotaReservation> quota_reservation) { 453 scoped_refptr<QuotaReservation> quota_reservation) {
453 quota_reservation_ = quota_reservation; 454 quota_reservation_ = quota_reservation;
454 callback.Run(); 455 callback.Run();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 if (!IsAsciiAlpha(*it) && !IsAsciiDigit(*it) && *it != '.' && *it != '_' && 501 if (!IsAsciiAlpha(*it) && !IsAsciiDigit(*it) && *it != '.' && *it != '_' &&
501 *it != '-') { 502 *it != '-') {
502 LOG(WARNING) << "Failed to generate a plugin id."; 503 LOG(WARNING) << "Failed to generate a plugin id.";
503 return std::string(); 504 return std::string();
504 } 505 }
505 } 506 }
506 return output; 507 return output;
507 } 508 }
508 509
509 } // namespace content 510 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/common/pepper_file_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698