Skip to content

Commit

Permalink
Revert 171080
Browse files Browse the repository at this point in the history
> The refactors PPB_Flash_File_ModuleLocal/FileRef to the new resource model. Calls for both these interfaces are now made directly to the browser. This removes the in-process implementation for these interfaces also (as they are flash-only). Tests are added for PPB_Flash_File_ModuleLocal.
>
> Review URL: https://codereview.chromium.org/11359097

TBR=raymes@chromium.org

Review URL: https://codereview.chromium.org/11437038

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171389 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
raymes@chromium.org committed Dec 6, 2012
1 parent f121ad6 commit d146b8b
Show file tree
Hide file tree
Showing 68 changed files with 1,676 additions and 1,270 deletions.
5 changes: 5 additions & 0 deletions chrome/browser/chrome_content_browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1826,6 +1826,11 @@ bool ChromeContentBrowserClient::AllowPepperSocketAPI(
return false;
}

bool ChromeContentBrowserClient::AllowPepperPrivateFileAPI() {
return CommandLine::ForCurrentProcess()->HasSwitch(
switches::kPpapiFlashInProcess);
}

FilePath ChromeContentBrowserClient::GetHyphenDictionaryDirectory() {
FilePath directory;
PathService::Get(chrome::DIR_APP_DICTIONARIES, &directory);
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/chrome_content_browser_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient {
content::BrowserContext* browser_context,
const GURL& url,
const content::SocketPermissionRequest& params) OVERRIDE;
virtual bool AllowPepperPrivateFileAPI() OVERRIDE;
virtual FilePath GetHyphenDictionaryDirectory() OVERRIDE;

#if defined(OS_POSIX) && !defined(OS_MACOSX)
Expand Down
1 change: 0 additions & 1 deletion chrome/browser/nacl_host/nacl_process_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,6 @@ void NaClProcessHost::OnPpapiChannelCreated(
ipc_proxy_channel_.get(), //process_.get(), // sender
permissions_,
process_->GetData().handle,
process_->GetData().id,
ipc_proxy_channel_.get(),
chrome_render_message_filter_->GetHostResolver(),
chrome_render_message_filter_->render_process_id(),
Expand Down
4 changes: 0 additions & 4 deletions chrome/nacl/nacl_ipc_adapter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -546,10 +546,6 @@ bool NaClIPCAdapter::OnMessageReceived(const IPC::Message& msg) {
base::Passed(&response)));
break;
}
case ppapi::proxy::SerializedHandle::FILE:
// TODO(raymes): Handle file handles for NaCl.
NOTIMPLEMENTED();
break;
case ppapi::proxy::SerializedHandle::INVALID: {
// Nothing to do. TODO(dmichael): Should we log this? Or is it
// sometimes okay to pass an INVALID handle?
Expand Down
5 changes: 3 additions & 2 deletions chrome/test/ppapi/ppapi_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,8 @@ TEST_PPAPI_OUT_OF_PROCESS(Flash_SetInstanceAlwaysOnTop)
TEST_PPAPI_OUT_OF_PROCESS(Flash_GetLocalTimeZoneOffset)
TEST_PPAPI_OUT_OF_PROCESS(Flash_GetCommandLineArgs)
TEST_PPAPI_OUT_OF_PROCESS(Flash_GetSetting)
// No in-process test for SetCrashData.
TEST_PPAPI_OUT_OF_PROCESS(Flash_SetCrashData)

// NaCl based PPAPI tests with WebSocket server
TEST_PPAPI_IN_PROCESS(WebSocket_IsWebSocket)
Expand Down Expand Up @@ -884,9 +886,8 @@ TEST_PPAPI_OUT_OF_PROCESS(MessageLoop_Post)

// Going forward, Flash APIs will only work out-of-process.
TEST_PPAPI_OUT_OF_PROCESS(Flash_GetProxyForURL)
TEST_PPAPI_OUT_OF_PROCESS(Flash_SetCrashData)
TEST_PPAPI_OUT_OF_PROCESS(FlashClipboard)
TEST_PPAPI_OUT_OF_PROCESS(FlashFile)
TEST_PPAPI_OUT_OF_PROCESS(FlashFile_CreateTemporaryFile)
// Mac/Aura reach NOTIMPLEMENTED/time out.
// mac: http://crbug.com/96767
// aura: http://crbug.com/104384
Expand Down
4 changes: 2 additions & 2 deletions content/browser/plugin_data_remover_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "base/version.h"
#include "content/browser/plugin_process_host.h"
#include "content/browser/plugin_service_impl.h"
#include "content/browser/renderer_host/pepper/pepper_flash_file_host.h"
#include "content/browser/renderer_host/pepper/pepper_file_message_filter.h"
#include "content/common/child_process_host_impl.h"
#include "content/common/plugin_messages.h"
#include "content/public/browser/browser_context.h"
Expand Down Expand Up @@ -208,7 +208,7 @@ class PluginDataRemoverImpl::Context
#if defined(ENABLE_PLUGINS)
IPC::Message* CreatePpapiClearSiteDataMsg(uint64 max_age) {
FilePath profile_path =
PepperFlashFileHost::GetDataDirName(browser_context_path_);
PepperFileMessageFilter::GetDataDirName(browser_context_path_);
// TODO(vtl): This "duplicates" logic in webkit/plugins/ppapi/file_path.cc
// (which prepends the plugin name to the relative part of the path
// instead, with the absolute, profile-dependent part being enforced by
Expand Down
14 changes: 6 additions & 8 deletions content/browser/ppapi_plugin_process_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,13 @@ PpapiPluginProcessHost::PpapiPluginProcessHost(
permissions_,
host_resolver);

host_impl_.reset(new BrowserPpapiHostImpl(this, permissions_, info.name,
profile_data_directory, process_->GetData().id));
host_impl_.reset(new BrowserPpapiHostImpl(this, permissions_));

file_filter_ = new PepperTrustedFileMessageFilter(
process_->GetData().id, info.name, profile_data_directory);

process_->GetHost()->AddFilter(filter_.get());
process_->GetHost()->AddFilter(file_filter_.get());
process_->GetHost()->AddFilter(host_impl_->message_filter());

GetContentClient()->browser()->DidCreatePpapiPlugin(host_impl_.get());
Expand All @@ -187,12 +190,7 @@ PpapiPluginProcessHost::PpapiPluginProcessHost()
PROCESS_TYPE_PPAPI_BROKER, this));

ppapi::PpapiPermissions permissions; // No permissions.
// The plugin name and profile data directory shouldn't be needed for the
// broker.
std::string plugin_name;
FilePath profile_data_directory;
host_impl_.reset(new BrowserPpapiHostImpl(this, permissions, plugin_name,
profile_data_directory, process_->GetData().id));
host_impl_.reset(new BrowserPpapiHostImpl(this, permissions));
}

bool PpapiPluginProcessHost::Init(const PepperPluginInfo& info) {
Expand Down
4 changes: 4 additions & 0 deletions content/browser/ppapi_plugin_process_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h"
#include "content/browser/renderer_host/pepper/pepper_file_message_filter.h"
#include "content/browser/renderer_host/pepper/pepper_message_filter.h"
#include "content/public/browser/browser_child_process_host_delegate.h"
#include "content/public/browser/browser_child_process_host_iterator.h"
Expand Down Expand Up @@ -139,6 +140,9 @@ class PpapiPluginProcessHost : public BrowserChildProcessHostDelegate,
ppapi::PpapiPermissions permissions_;
scoped_ptr<BrowserPpapiHostImpl> host_impl_;

// Handles filesystem requests from flash plugins. May be NULL.
scoped_refptr<PepperFileMessageFilter> file_filter_;

// Observes network changes. May be NULL.
scoped_ptr<PluginNetworkObserver> network_observer_;

Expand Down
33 changes: 4 additions & 29 deletions content/browser/renderer_host/pepper/browser_ppapi_host_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// found in the LICENSE file.

#include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h"

#include "content/browser/renderer_host/pepper/pepper_message_filter.h"

#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_view_host.h"
#include "ipc/ipc_message_macros.h"
Expand All @@ -16,19 +16,12 @@ BrowserPpapiHost* BrowserPpapiHost::CreateExternalPluginProcess(
IPC::Sender* sender,
ppapi::PpapiPermissions permissions,
base::ProcessHandle plugin_child_process,
int plugin_child_process_id,
IPC::ChannelProxy* channel,
net::HostResolver* host_resolver,
int render_process_id,
int render_view_id) {
// TODO(raymes): Figure out how to plumb plugin_name and
// profile_data_directory through for NaCl. They are currently only needed for
// PPB_Flash_File interfaces so it doesn't matter.
std::string plugin_name;
FilePath profile_data_directory;
BrowserPpapiHostImpl* browser_ppapi_host =
new BrowserPpapiHostImpl(sender, permissions, plugin_name,
profile_data_directory, plugin_child_process_id);
new BrowserPpapiHostImpl(sender, permissions);
browser_ppapi_host->set_plugin_process_handle(plugin_child_process);

channel->AddFilter(
Expand All @@ -44,15 +37,9 @@ BrowserPpapiHost* BrowserPpapiHost::CreateExternalPluginProcess(

BrowserPpapiHostImpl::BrowserPpapiHostImpl(
IPC::Sender* sender,
const ppapi::PpapiPermissions& permissions,
const std::string& plugin_name,
const FilePath& profile_data_directory,
int plugin_process_id)
const ppapi::PpapiPermissions& permissions)
: ppapi_host_(sender, permissions),
plugin_process_handle_(base::kNullProcessHandle),
plugin_name_(plugin_name),
profile_data_directory_(profile_data_directory),
plugin_process_id_(plugin_process_id) {
plugin_process_handle_(base::kNullProcessHandle) {
message_filter_ = new HostMessageFilter(&ppapi_host_);
ppapi_host_.AddHostFactoryFilter(scoped_ptr<ppapi::host::HostFactory>(
new ContentBrowserPepperHostFactory(this)));
Expand Down Expand Up @@ -93,18 +80,6 @@ bool BrowserPpapiHostImpl::GetRenderViewIDsForInstance(
return true;
}

const std::string& BrowserPpapiHostImpl::GetPluginName() {
return plugin_name_;
}

const FilePath& BrowserPpapiHostImpl::GetProfileDataDirectory() {
return profile_data_directory_;
}

int BrowserPpapiHostImpl::GetPluginProcessID() {
return plugin_process_id_;
}

void BrowserPpapiHostImpl::AddInstanceForView(PP_Instance instance,
int render_process_id,
int render_view_id) {
Expand Down
13 changes: 1 addition & 12 deletions content/browser/renderer_host/pepper/browser_ppapi_host_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@
#define CONTENT_BROWSER_RENDERER_HOST_PEPPER_BROWSER_PPAPI_HOST_IMPL_H_

#include <map>
#include <string>

#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/file_path.h"
#include "content/browser/renderer_host/pepper/content_browser_pepper_host_factory.h"
#include "content/common/content_export.h"
#include "content/public/browser/browser_ppapi_host.h"
Expand All @@ -25,10 +23,7 @@ class CONTENT_EXPORT BrowserPpapiHostImpl : public BrowserPpapiHost {
// as it is known (we start the process asynchronously so it won't be known
// when this object is created).
BrowserPpapiHostImpl(IPC::Sender* sender,
const ppapi::PpapiPermissions& permissions,
const std::string& plugin_name,
const FilePath& profile_data_directory,
int plugin_process_id);
const ppapi::PpapiPermissions& permissions);
virtual ~BrowserPpapiHostImpl();

// BrowserPpapiHost.
Expand All @@ -38,9 +33,6 @@ class CONTENT_EXPORT BrowserPpapiHostImpl : public BrowserPpapiHost {
virtual bool GetRenderViewIDsForInstance(PP_Instance instance,
int* render_process_id,
int* render_view_id) const OVERRIDE;
virtual const std::string& GetPluginName() OVERRIDE;
virtual const FilePath& GetProfileDataDirectory() OVERRIDE;
virtual int GetPluginProcessID() OVERRIDE;

void set_plugin_process_handle(base::ProcessHandle handle) {
plugin_process_handle_ = handle;
Expand Down Expand Up @@ -87,9 +79,6 @@ class CONTENT_EXPORT BrowserPpapiHostImpl : public BrowserPpapiHost {

ppapi::host::PpapiHost ppapi_host_;
base::ProcessHandle plugin_process_handle_;
std::string plugin_name_;
FilePath profile_data_directory_;
int plugin_process_id_;

// Tracks all PP_Instances in this plugin and maps them to
// RenderProcess/RenderView IDs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ BrowserPpapiHostTest::BrowserPpapiHostTest()
: sink_() {
ppapi_host_.reset(new BrowserPpapiHostImpl(
&sink_,
ppapi::PpapiPermissions::AllPermissions(),
std::string(),
FilePath(),
0));
ppapi::PpapiPermissions::AllPermissions()));
ppapi_host_->set_plugin_process_handle(base::GetCurrentProcessHandle());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h"
#include "content/browser/renderer_host/pepper/pepper_flash_browser_host.h"
#include "content/browser/renderer_host/pepper/pepper_flash_file_host.h"
#include "content/browser/renderer_host/pepper/pepper_gamepad_host.h"
#include "content/browser/renderer_host/pepper/pepper_print_settings_manager.h"
#include "content/browser/renderer_host/pepper/pepper_printing_host.h"
Expand Down Expand Up @@ -63,9 +62,6 @@ scoped_ptr<ResourceHost> ContentBrowserPepperHostFactory::CreateResourceHost(
case PpapiHostMsg_Flash_Create::ID:
return scoped_ptr<ResourceHost>(new PepperFlashBrowserHost(
host_, instance, params.pp_resource()));
case PpapiHostMsg_FlashFile_Create::ID:
return scoped_ptr<ResourceHost>(new PepperFlashFileHost(
host_, instance, params.pp_resource()));
}
}

Expand Down
Loading

0 comments on commit d146b8b

Please sign in to comment.