Chromium Code Reviews| Index: content/browser/plugin_process_host.cc |
| diff --git a/content/browser/plugin_process_host.cc b/content/browser/plugin_process_host.cc |
| index 6c42164c72b22501d88588598a7aade8cdf033c0..f8f1f99be1c4b5605ea859e581128733002cc8ab 100644 |
| --- a/content/browser/plugin_process_host.cc |
| +++ b/content/browser/plugin_process_host.cc |
| @@ -21,13 +21,12 @@ |
| #include "base/string_util.h" |
| #include "base/utf_string_conversions.h" |
| #include "chrome/browser/browser_process.h" |
| -#include "chrome/browser/chrome_plugin_browsing_context.h" |
| +#include "chrome/browser/browser_thread.h" |
| #include "chrome/browser/net/url_request_tracking.h" |
| #include "chrome/browser/plugin_download_helper.h" |
| #include "chrome/browser/plugin_service.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/common/chrome_paths.h" |
| -#include "chrome/common/chrome_plugin_lib.h" |
| #include "chrome/common/chrome_switches.h" |
| #include "chrome/common/logging_chrome.h" |
| #include "chrome/common/net/url_request_context_getter.h" |
| @@ -35,11 +34,9 @@ |
| #include "chrome/common/render_messages.h" |
| #include "chrome/common/render_messages_params.h" |
| #include "content/browser/browser_thread.h" |
| -#include "content/browser/child_process_security_policy.h" |
| #include "content/browser/renderer_host/resource_dispatcher_host.h" |
| #include "content/browser/renderer_host/resource_message_filter.h" |
| #include "ipc/ipc_switches.h" |
| -#include "net/base/cookie_store.h" |
| #include "net/base/io_buffer.h" |
| #include "net/url_request/url_request.h" |
| #include "net/url_request/url_request_context.h" |
| @@ -59,28 +56,6 @@ |
| static const char kDefaultPluginFinderURL[] = |
| "https://dl-ssl.google.com/edgedl/chrome/plugins/plugins2.xml"; |
| -namespace { |
| - |
| -// Helper class that we pass to ResourceMessageFilter so that it can find the |
| -// right net::URLRequestContext for a request. |
| -class PluginURLRequestContextOverride |
| - : public ResourceMessageFilter::URLRequestContextOverride { |
| - public: |
| - PluginURLRequestContextOverride() { |
| - } |
| - |
| - virtual net::URLRequestContext* GetRequestContext( |
| - const ViewHostMsg_Resource_Request& resource_request) { |
|
jam
2011/02/25 22:19:33
one minor change that could be done now: GetReques
Aaron Boodman
2011/02/25 22:48:28
You mean "resource type"? If so, done.
|
| - return CPBrowsingContextManager::GetInstance()->ToURLRequestContext( |
| - resource_request.request_context); |
| - } |
| - |
| - private: |
| - virtual ~PluginURLRequestContextOverride() {} |
| -}; |
| - |
| -} // namespace |
| - |
| #if defined(OS_WIN) |
| void PluginProcessHost::OnPluginWindowDestroyed(HWND window, HWND parent) { |
| // The window is destroyed at this point, we just care about its parent, which |
| @@ -120,8 +95,7 @@ void PluginProcessHost::OnMapNativeViewId(gfx::NativeViewId id, |
| PluginProcessHost::PluginProcessHost() |
| : BrowserChildProcessHost( |
| PLUGIN_PROCESS, |
| - PluginService::GetInstance()->resource_dispatcher_host(), |
| - new PluginURLRequestContextOverride()), |
| + PluginService::GetInstance()->resource_dispatcher_host()), |
| ALLOW_THIS_IN_INITIALIZER_LIST(resolve_proxy_msg_helper_(this, NULL)) |
| #if defined(OS_MACOSX) |
| , plugin_cursor_visible_(true) |
| @@ -242,12 +216,6 @@ bool PluginProcessHost::Init(const webkit::npapi::WebPluginInfo& info, |
| cmd_line->AppendSwitchASCII(switches::kLang, locale); |
| } |
| - // Gears requires the data dir to be available on startup. |
| - FilePath data_dir = |
| - PluginService::GetInstance()->GetChromePluginDataDir(); |
| - DCHECK(!data_dir.empty()); |
| - cmd_line->AppendSwitchPath(switches::kPluginDataDir, data_dir); |
| - |
| cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id()); |
| SetCrashReporterCommandLine(cmd_line); |
| @@ -288,28 +256,12 @@ void PluginProcessHost::ForceShutdown() { |
| BrowserChildProcessHost::ForceShutdown(); |
| } |
| -void PluginProcessHost::OnProcessLaunched() { |
| - FilePath gears_path; |
| - if (PathService::Get(chrome::FILE_GEARS_PLUGIN, &gears_path)) { |
| - FilePath::StringType gears_path_lc = StringToLowerASCII(gears_path.value()); |
| - FilePath::StringType plugin_path_lc = |
| - StringToLowerASCII(info_.path.value()); |
| - if (plugin_path_lc == gears_path_lc) { |
| - // Give Gears plugins "background" priority. See http://b/1280317. |
| - SetProcessBackgrounded(); |
| - } |
| - } |
| -} |
| - |
| bool PluginProcessHost::OnMessageReceived(const IPC::Message& msg) { |
| bool handled = true; |
| IPC_BEGIN_MESSAGE_MAP(PluginProcessHost, msg) |
| IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelCreated, OnChannelCreated) |
| IPC_MESSAGE_HANDLER(PluginProcessHostMsg_GetPluginFinderUrl, |
| OnGetPluginFinderUrl) |
| - IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginMessage, OnPluginMessage) |
| - IPC_MESSAGE_HANDLER(PluginProcessHostMsg_GetCookies, OnGetCookies) |
| - IPC_MESSAGE_HANDLER(PluginProcessHostMsg_AccessFiles, OnAccessFiles) |
| IPC_MESSAGE_HANDLER_DELAY_REPLY(PluginProcessHostMsg_ResolveProxy, |
| OnResolveProxy) |
| #if defined(OS_WIN) |
| @@ -380,43 +332,6 @@ void PluginProcessHost::OpenChannelToPlugin(Client* client) { |
| RequestPluginChannel(client); |
| } |
| -void PluginProcessHost::OnGetCookies(uint32 request_context, |
| - const GURL& url, |
| - std::string* cookies) { |
| - net::URLRequestContext* context = CPBrowsingContextManager::GetInstance()-> |
| - ToURLRequestContext(request_context); |
| - // TODO(mpcomplete): remove fallback case when Gears support is prevalent. |
| - if (!context) |
| - context = Profile::GetDefaultRequestContext()->GetURLRequestContext(); |
| - |
| - // Note: We don't have a first_party_for_cookies check because plugins bypass |
| - // third-party cookie blocking. |
| - if (context && context->cookie_store()) { |
| - *cookies = context->cookie_store()->GetCookies(url); |
| - } else { |
| - DLOG(ERROR) << "Could not serve plugin cookies request."; |
| - cookies->clear(); |
| - } |
| -} |
| - |
| -void PluginProcessHost::OnAccessFiles(int renderer_id, |
| - const std::vector<std::string>& files, |
| - bool* allowed) { |
| - ChildProcessSecurityPolicy* policy = |
| - ChildProcessSecurityPolicy::GetInstance(); |
| - |
| - for (size_t i = 0; i < files.size(); ++i) { |
| - const FilePath path = FilePath::FromWStringHack(UTF8ToWide(files[i])); |
| - if (!policy->CanReadFile(renderer_id, path)) { |
| - VLOG(1) << "Denied unauthorized request for file " << files[i]; |
| - *allowed = false; |
| - return; |
| - } |
| - } |
| - |
| - *allowed = true; |
| -} |
| - |
| void PluginProcessHost::OnResolveProxy(const GURL& url, |
| IPC::Message* reply_msg) { |
| resolve_proxy_msg_helper_.Start(url, reply_msg); |
| @@ -470,15 +385,3 @@ void PluginProcessHost::OnGetPluginFinderUrl(std::string* plugin_finder_url) { |
| plugin_finder_url->clear(); |
| } |
| } |
| - |
| -void PluginProcessHost::OnPluginMessage( |
| - const std::vector<uint8>& data) { |
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| - |
| - ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); |
| - if (chrome_plugin) { |
| - void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); |
| - uint32 data_len = static_cast<uint32>(data.size()); |
| - chrome_plugin->functions().on_message(data_ptr, data_len); |
| - } |
| -} |