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

Unified Diff: content/browser/renderer_host/pepper_file_message_filter.cc

Issue 10387195: Open pepper files directly in browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/pepper_file_message_filter.cc
===================================================================
--- content/browser/renderer_host/pepper_file_message_filter.cc (revision 138610)
+++ content/browser/renderer_host/pepper_file_message_filter.cc (working copy)
@@ -12,7 +12,6 @@
#include "content/browser/child_process_security_policy_impl.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/common/pepper_file_messages.h"
-#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "ipc/ipc_platform_file.h"
#include "webkit/plugins/ppapi/file_path.h"
@@ -37,11 +36,9 @@
base::PLATFORM_FILE_EXCLUSIVE_WRITE |
base::PLATFORM_FILE_WRITE_ATTRIBUTES;
-PepperFileMessageFilter::PepperFileMessageFilter(
- int child_id, content::BrowserContext* browser_context)
+PepperFileMessageFilter::PepperFileMessageFilter(int child_id)
: child_id_(child_id),
channel_(NULL) {
- pepper_path_ = GetDataDirName(browser_context->GetPath());
}
void PepperFileMessageFilter::OverrideThreadForMessage(
@@ -225,6 +222,30 @@
FilePath PepperFileMessageFilter::ValidateAndConvertPepperFilePath(
const webkit::ppapi::PepperFilePath& pepper_path, int flags) {
FilePath file_path; // Empty path returned on error.
+ if (pepper_path.domain() == webkit::ppapi::PepperFilePath::DOMAIN_ABSOLUTE) {
+ if (pepper_path.path().IsAbsolute() &&
brettw 2012/05/29 18:14:15 Indent 2 less spaces.
+ ChildProcessSecurityPolicyImpl::GetInstance()->HasPermissionsForFile(
+ child_id(), pepper_path.path(), flags))
+ file_path = pepper_path.path();
+ }
+ return file_path;
+}
+
+PepperTrustedFileMessageFilter::PepperTrustedFileMessageFilter(
+ int child_id,
+ const std::string& plugin_name,
+ const FilePath& profile_data_directory)
+ : PepperFileMessageFilter(child_id) {
brettw 2012/05/29 18:14:15 Colon should be indented 4 spaces total.
+ plugin_data_directory_ =
+ GetDataDirName(profile_data_directory).Append(plugin_name);
+}
+
+PepperTrustedFileMessageFilter::~PepperTrustedFileMessageFilter() {
+}
+
+FilePath PepperTrustedFileMessageFilter::ValidateAndConvertPepperFilePath(
+ const webkit::ppapi::PepperFilePath& pepper_path, int flags) {
+ FilePath file_path; // Empty path returned on error.
switch(pepper_path.domain()) {
case webkit::ppapi::PepperFilePath::DOMAIN_ABSOLUTE:
if (pepper_path.path().IsAbsolute() &&
@@ -235,7 +256,7 @@
case webkit::ppapi::PepperFilePath::DOMAIN_MODULE_LOCAL:
if (!pepper_path.path().IsAbsolute() &&
!pepper_path.path().ReferencesParent())
- file_path = pepper_path_.Append(pepper_path.path());
+ file_path = plugin_data_directory_.Append(pepper_path.path());
break;
default:
NOTREACHED();

Powered by Google App Engine
This is Rietveld 408576698