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

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

Issue 164100: Set up a interposing library for Carbon calls made by plugins. (Closed)
Patch Set: Review comments and files that were lost in the move Created 11 years, 4 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
« no previous file with comments | « chrome/browser/plugin_carbon_interpose_mac.cc ('k') | chrome/chrome.gyp » ('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) 2009 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>
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 #endif 57 #endif
58 58
59 #if defined(OS_POSIX) 59 #if defined(OS_POSIX)
60 #include "ipc/ipc_channel_posix.h" 60 #include "ipc/ipc_channel_posix.h"
61 #endif 61 #endif
62 62
63 #if defined(OS_LINUX) 63 #if defined(OS_LINUX)
64 #include "base/gfx/gtk_native_view_id_manager.h" 64 #include "base/gfx/gtk_native_view_id_manager.h"
65 #endif 65 #endif
66 66
67 #if defined(OS_MACOSX)
68 #include "chrome/common/plugin_carbon_interpose_constants_mac.h"
69 #endif
70
67 static const char kDefaultPluginFinderURL[] = 71 static const char kDefaultPluginFinderURL[] =
68 "http://dl.google.com/chrome/plugins/plugins2.xml"; 72 "http://dl.google.com/chrome/plugins/plugins2.xml";
69 73
70 #if defined(OS_WIN) 74 #if defined(OS_WIN)
71 75
72 // The PluginDownloadUrlHelper is used to handle one download URL request 76 // The PluginDownloadUrlHelper is used to handle one download URL request
73 // from the plugin. Each download request is handled by a new instance 77 // from the plugin. Each download request is handled by a new instance
74 // of this class. 78 // of this class.
75 class PluginDownloadUrlHelper : public URLRequest::Delegate { 79 class PluginDownloadUrlHelper : public URLRequest::Delegate {
76 static const int kDownloadFileBufferSize = 32768; 80 static const int kDownloadFileBufferSize = 32768;
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 #if defined(OS_WIN) 407 #if defined(OS_WIN)
404 process = sandbox::StartProcess(&cmd_line); 408 process = sandbox::StartProcess(&cmd_line);
405 #else 409 #else
406 // This code is duplicated with browser_render_process_host.cc, but 410 // This code is duplicated with browser_render_process_host.cc, but
407 // there's not a good place to de-duplicate it. 411 // there's not a good place to de-duplicate it.
408 base::file_handle_mapping_vector fds_to_map; 412 base::file_handle_mapping_vector fds_to_map;
409 const int ipcfd = channel().GetClientFileDescriptor(); 413 const int ipcfd = channel().GetClientFileDescriptor();
410 if (ipcfd > -1) 414 if (ipcfd > -1)
411 fds_to_map.push_back(std::pair<int, int>( 415 fds_to_map.push_back(std::pair<int, int>(
412 ipcfd, kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor)); 416 ipcfd, kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor));
413 base::LaunchApp(cmd_line.argv(), fds_to_map, false, &process); 417 base::environment_vector env;
418 #if defined(OS_MACOSX)
419 // Add our interposing library for Carbon. This is stripped back out in
420 // plugin_main.cc, so changes here should be reflected there.
421 std::string interpose_list(plugin_interpose_strings::kInterposeLibraryPath);
422 const char* existing_list =
423 getenv(plugin_interpose_strings::kDYLDInsertLibrariesKey);
424 if (existing_list) {
425 interpose_list.insert(0, ":");
426 interpose_list.insert(0, existing_list);
427 }
428 env.push_back(std::pair<const char*, const char*>(
429 plugin_interpose_strings::kDYLDInsertLibrariesKey,
430 interpose_list.c_str()));
431 #endif
432 base::LaunchApp(cmd_line.argv(), env, fds_to_map, false, &process);
414 #endif 433 #endif
415 434
416 if (!process) 435 if (!process)
417 return false; 436 return false;
418 SetHandle(process); 437 SetHandle(process);
419 438
420 FilePath gears_path; 439 FilePath gears_path;
421 if (PathService::Get(chrome::FILE_GEARS_PLUGIN, &gears_path)) { 440 if (PathService::Get(chrome::FILE_GEARS_PLUGIN, &gears_path)) {
422 FilePath::StringType gears_path_lc = StringToLowerASCII(gears_path.value()); 441 FilePath::StringType gears_path_lc = StringToLowerASCII(gears_path.value());
423 FilePath::StringType plugin_path_lc = 442 FilePath::StringType plugin_path_lc =
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 DCHECK(MessageLoop::current() == 622 DCHECK(MessageLoop::current() ==
604 ChromeThread::GetMessageLoop(ChromeThread::IO)); 623 ChromeThread::GetMessageLoop(ChromeThread::IO));
605 624
606 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); 625 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path);
607 if (chrome_plugin) { 626 if (chrome_plugin) {
608 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); 627 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0]));
609 uint32 data_len = static_cast<uint32>(data.size()); 628 uint32 data_len = static_cast<uint32>(data.size());
610 chrome_plugin->functions().on_message(data_ptr, data_len); 629 chrome_plugin->functions().on_message(data_ptr, data_len);
611 } 630 }
612 } 631 }
OLDNEW
« no previous file with comments | « chrome/browser/plugin_carbon_interpose_mac.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698