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

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

Issue 159074: CPAPI (0.11) for gears drag drop.... (Closed) Base URL: http://src.chromium.org/svn/trunk/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')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-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_descriptors.h" 38 #include "chrome/common/chrome_descriptors.h"
38 #include "chrome/common/chrome_paths.h" 39 #include "chrome/common/chrome_paths.h"
39 #include "chrome/common/chrome_plugin_lib.h" 40 #include "chrome/common/chrome_plugin_lib.h"
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 return true; 438 return true;
438 } 439 }
439 440
440 void PluginProcessHost::OnMessageReceived(const IPC::Message& msg) { 441 void PluginProcessHost::OnMessageReceived(const IPC::Message& msg) {
441 IPC_BEGIN_MESSAGE_MAP(PluginProcessHost, msg) 442 IPC_BEGIN_MESSAGE_MAP(PluginProcessHost, msg)
442 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelCreated, OnChannelCreated) 443 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelCreated, OnChannelCreated)
443 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_GetPluginFinderUrl, 444 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_GetPluginFinderUrl,
444 OnGetPluginFinderUrl) 445 OnGetPluginFinderUrl)
445 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginMessage, OnPluginMessage) 446 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginMessage, OnPluginMessage)
446 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_GetCookies, OnGetCookies) 447 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_GetCookies, OnGetCookies)
448 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_AccessFiles, OnAccessFiles)
447 IPC_MESSAGE_HANDLER_DELAY_REPLY(PluginProcessHostMsg_ResolveProxy, 449 IPC_MESSAGE_HANDLER_DELAY_REPLY(PluginProcessHostMsg_ResolveProxy,
448 OnResolveProxy) 450 OnResolveProxy)
449 #if defined(OS_WIN) 451 #if defined(OS_WIN)
450 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginWindowDestroyed, 452 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginWindowDestroyed,
451 OnPluginWindowDestroyed) 453 OnPluginWindowDestroyed)
452 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_DownloadUrl, OnDownloadUrl) 454 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_DownloadUrl, OnDownloadUrl)
453 #endif 455 #endif
454 #if defined(OS_LINUX) 456 #if defined(OS_LINUX)
455 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_MapNativeViewId, 457 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_MapNativeViewId,
456 OnMapNativeViewId) 458 OnMapNativeViewId)
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 ToURLRequestContext(request_context); 507 ToURLRequestContext(request_context);
506 // TODO(mpcomplete): remove fallback case when Gears support is prevalent. 508 // TODO(mpcomplete): remove fallback case when Gears support is prevalent.
507 if (!context) 509 if (!context)
508 context = Profile::GetDefaultRequestContext(); 510 context = Profile::GetDefaultRequestContext();
509 511
510 // Note: We don't have a first_party_for_cookies check because plugins bypass 512 // Note: We don't have a first_party_for_cookies check because plugins bypass
511 // third-party cookie blocking. 513 // third-party cookie blocking.
512 *cookies = context->cookie_store()->GetCookies(url); 514 *cookies = context->cookie_store()->GetCookies(url);
513 } 515 }
514 516
517 void PluginProcessHost::OnAccessFiles(int process_id,
518 const std::vector<std::string>& files,
519 bool* allowed) {
520 ChildProcessSecurityPolicy* policy =
521 ChildProcessSecurityPolicy::GetInstance();
522
523 for (size_t i = 0; i < files.size(); ++i) {
524 const FilePath path = FilePath::FromWStringHack(UTF8ToWide(files[i]));
525 if (!policy->CanUploadFile(process_id, path)) {
526 LOG(INFO) << "Denied unauthorized request for file " << files[i];
527 *allowed = false;
528 return;
529 }
530 }
531
532 *allowed = true;
533 }
534
515 void PluginProcessHost::OnResolveProxy(const GURL& url, 535 void PluginProcessHost::OnResolveProxy(const GURL& url,
516 IPC::Message* reply_msg) { 536 IPC::Message* reply_msg) {
517 resolve_proxy_msg_helper_.Start(url, reply_msg); 537 resolve_proxy_msg_helper_.Start(url, reply_msg);
518 } 538 }
519 539
520 void PluginProcessHost::OnResolveProxyCompleted(IPC::Message* reply_msg, 540 void PluginProcessHost::OnResolveProxyCompleted(IPC::Message* reply_msg,
521 int result, 541 int result,
522 const std::string& proxy_list) { 542 const std::string& proxy_list) {
523 PluginProcessHostMsg_ResolveProxy::WriteReplyParams( 543 PluginProcessHostMsg_ResolveProxy::WriteReplyParams(
524 reply_msg, result, proxy_list); 544 reply_msg, result, proxy_list);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 DCHECK(MessageLoop::current() == 609 DCHECK(MessageLoop::current() ==
590 ChromeThread::GetMessageLoop(ChromeThread::IO)); 610 ChromeThread::GetMessageLoop(ChromeThread::IO));
591 611
592 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); 612 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path);
593 if (chrome_plugin) { 613 if (chrome_plugin) {
594 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); 614 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0]));
595 uint32 data_len = static_cast<uint32>(data.size()); 615 uint32 data_len = static_cast<uint32>(data.size());
596 chrome_plugin->functions().on_message(data_ptr, data_len); 616 chrome_plugin->functions().on_message(data_ptr, data_len);
597 } 617 }
598 } 618 }
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