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

Side by Side Diff: chrome/browser/plugin_process_host.cc

Issue 160211: Merge 21437 - CPAPI (0.11) for gears drag drop.... (Closed) Base URL: svn://chrome-svn/chrome/branches/195/src/
Patch Set: Created 11 years, 5 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 | « chrome/browser/plugin_process_host.h ('k') | chrome/common/chrome_plugin_api.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Modified: svn:mergeinfo
Merged /trunk/src/chrome/browser/plugin_process_host.cc:r21437
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "chrome/browser/plugin_process_host.h" 7 #include "chrome/browser/plugin_process_host.h"
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <windows.h> 10 #include <windows.h>
11 #endif 11 #endif
12 12
13 #include <vector> 13 #include <vector>
14 14
15 #include "app/app_switches.h" 15 #include "app/app_switches.h"
16 #include "base/command_line.h" 16 #include "base/command_line.h"
17 #if defined(OS_POSIX) 17 #if defined(OS_POSIX)
18 #include "base/global_descriptors_posix.h" 18 #include "base/global_descriptors_posix.h"
19 #endif 19 #endif
20 #include "base/file_path.h" 20 #include "base/file_path.h"
21 #include "base/file_util.h" 21 #include "base/file_util.h"
22 #include "base/file_version_info.h" 22 #include "base/file_version_info.h"
23 #include "base/gfx/native_widget_types.h" 23 #include "base/gfx/native_widget_types.h"
24 #include "base/logging.h" 24 #include "base/logging.h"
25 #include "base/path_service.h" 25 #include "base/path_service.h"
26 #include "base/process_util.h" 26 #include "base/process_util.h"
27 #include "base/scoped_ptr.h" 27 #include "base/scoped_ptr.h"
28 #include "base/thread.h" 28 #include "base/thread.h"
29 #include "chrome/browser/browser_process.h" 29 #include "chrome/browser/browser_process.h"
30 #include "chrome/browser/child_process_security_policy.h"
30 #include "chrome/browser/chrome_plugin_browsing_context.h" 31 #include "chrome/browser/chrome_plugin_browsing_context.h"
31 #include "chrome/browser/chrome_thread.h" 32 #include "chrome/browser/chrome_thread.h"
32 #include "chrome/browser/plugin_service.h" 33 #include "chrome/browser/plugin_service.h"
33 #include "chrome/browser/profile.h" 34 #include "chrome/browser/profile.h"
34 #include "chrome/browser/renderer_host/browser_render_process_host.h" 35 #include "chrome/browser/renderer_host/browser_render_process_host.h"
35 #include "chrome/browser/renderer_host/render_process_host.h" 36 #include "chrome/browser/renderer_host/render_process_host.h"
36 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" 37 #include "chrome/browser/renderer_host/resource_dispatcher_host.h"
37 #include "chrome/common/chrome_paths.h" 38 #include "chrome/common/chrome_paths.h"
38 #include "chrome/common/chrome_plugin_lib.h" 39 #include "chrome/common/chrome_plugin_lib.h"
39 #include "chrome/common/chrome_switches.h" 40 #include "chrome/common/chrome_switches.h"
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 return true; 432 return true;
432 } 433 }
433 434
434 void PluginProcessHost::OnMessageReceived(const IPC::Message& msg) { 435 void PluginProcessHost::OnMessageReceived(const IPC::Message& msg) {
435 IPC_BEGIN_MESSAGE_MAP(PluginProcessHost, msg) 436 IPC_BEGIN_MESSAGE_MAP(PluginProcessHost, msg)
436 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelCreated, OnChannelCreated) 437 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelCreated, OnChannelCreated)
437 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_GetPluginFinderUrl, 438 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_GetPluginFinderUrl,
438 OnGetPluginFinderUrl) 439 OnGetPluginFinderUrl)
439 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginMessage, OnPluginMessage) 440 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginMessage, OnPluginMessage)
440 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_GetCookies, OnGetCookies) 441 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_GetCookies, OnGetCookies)
442 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_AccessFiles, OnAccessFiles)
441 IPC_MESSAGE_HANDLER_DELAY_REPLY(PluginProcessHostMsg_ResolveProxy, 443 IPC_MESSAGE_HANDLER_DELAY_REPLY(PluginProcessHostMsg_ResolveProxy,
442 OnResolveProxy) 444 OnResolveProxy)
443 #if defined(OS_WIN) 445 #if defined(OS_WIN)
444 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginWindowDestroyed, 446 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginWindowDestroyed,
445 OnPluginWindowDestroyed) 447 OnPluginWindowDestroyed)
446 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_DownloadUrl, OnDownloadUrl) 448 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_DownloadUrl, OnDownloadUrl)
447 #endif 449 #endif
448 #if defined(OS_LINUX) 450 #if defined(OS_LINUX)
449 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_MapNativeViewId, 451 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_MapNativeViewId,
450 OnMapNativeViewId) 452 OnMapNativeViewId)
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 ToURLRequestContext(request_context); 501 ToURLRequestContext(request_context);
500 // TODO(mpcomplete): remove fallback case when Gears support is prevalent. 502 // TODO(mpcomplete): remove fallback case when Gears support is prevalent.
501 if (!context) 503 if (!context)
502 context = Profile::GetDefaultRequestContext(); 504 context = Profile::GetDefaultRequestContext();
503 505
504 // Note: We don't have a first_party_for_cookies check because plugins bypass 506 // Note: We don't have a first_party_for_cookies check because plugins bypass
505 // third-party cookie blocking. 507 // third-party cookie blocking.
506 *cookies = context->cookie_store()->GetCookies(url); 508 *cookies = context->cookie_store()->GetCookies(url);
507 } 509 }
508 510
511 void PluginProcessHost::OnAccessFiles(int process_id,
512 const std::vector<std::string>& files,
513 bool* allowed) {
514 ChildProcessSecurityPolicy* policy =
515 ChildProcessSecurityPolicy::GetInstance();
516
517 for (size_t i = 0; i < files.size(); ++i) {
518 const FilePath path = FilePath::FromWStringHack(UTF8ToWide(files[i]));
519 if (!policy->CanUploadFile(process_id, path)) {
520 LOG(INFO) << "Denied unauthorized request for file " << files[i];
521 *allowed = false;
522 return;
523 }
524 }
525
526 *allowed = true;
527 }
528
509 void PluginProcessHost::OnResolveProxy(const GURL& url, 529 void PluginProcessHost::OnResolveProxy(const GURL& url,
510 IPC::Message* reply_msg) { 530 IPC::Message* reply_msg) {
511 resolve_proxy_msg_helper_.Start(url, reply_msg); 531 resolve_proxy_msg_helper_.Start(url, reply_msg);
512 } 532 }
513 533
514 void PluginProcessHost::OnResolveProxyCompleted(IPC::Message* reply_msg, 534 void PluginProcessHost::OnResolveProxyCompleted(IPC::Message* reply_msg,
515 int result, 535 int result,
516 const std::string& proxy_list) { 536 const std::string& proxy_list) {
517 PluginProcessHostMsg_ResolveProxy::WriteReplyParams( 537 PluginProcessHostMsg_ResolveProxy::WriteReplyParams(
518 reply_msg, result, proxy_list); 538 reply_msg, result, proxy_list);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 DCHECK(MessageLoop::current() == 603 DCHECK(MessageLoop::current() ==
584 ChromeThread::GetMessageLoop(ChromeThread::IO)); 604 ChromeThread::GetMessageLoop(ChromeThread::IO));
585 605
586 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); 606 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path);
587 if (chrome_plugin) { 607 if (chrome_plugin) {
588 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); 608 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0]));
589 uint32 data_len = static_cast<uint32>(data.size()); 609 uint32 data_len = static_cast<uint32>(data.size());
590 chrome_plugin->functions().on_message(data_ptr, data_len); 610 chrome_plugin->functions().on_message(data_ptr, data_len);
591 } 611 }
592 } 612 }
OLDNEW
« no previous file with comments | « chrome/browser/plugin_process_host.h ('k') | chrome/common/chrome_plugin_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698