Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/plugin_process_host.h" | 5 #include "content/browser/plugin_process_host.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #elif defined(OS_POSIX) | 9 #elif defined(OS_POSIX) |
| 10 #include <utility> // for pair<> | 10 #include <utility> // for pair<> |
| 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 #include "base/file_path.h" | 17 #include "base/file_path.h" |
| 18 #include "base/file_util.h" | 18 #include "base/file_util.h" |
| 19 #include "base/logging.h" | 19 #include "base/logging.h" |
| 20 #include "base/path_service.h" | 20 #include "base/path_service.h" |
| 21 #include "base/string_util.h" | 21 #include "base/string_util.h" |
| 22 #include "base/utf_string_conversions.h" | 22 #include "base/utf_string_conversions.h" |
| 23 #include "chrome/browser/browser_process.h" | |
| 23 #include "chrome/browser/chrome_plugin_browsing_context.h" | 24 #include "chrome/browser/chrome_plugin_browsing_context.h" |
| 24 #include "chrome/browser/net/url_request_tracking.h" | 25 #include "chrome/browser/net/url_request_tracking.h" |
| 25 #include "chrome/browser/plugin_download_helper.h" | 26 #include "chrome/browser/plugin_download_helper.h" |
| 26 #include "chrome/browser/plugin_service.h" | 27 #include "chrome/browser/plugin_service.h" |
| 27 #include "chrome/browser/profiles/profile.h" | 28 #include "chrome/browser/profiles/profile.h" |
| 28 #include "chrome/common/chrome_paths.h" | 29 #include "chrome/common/chrome_paths.h" |
| 29 #include "chrome/common/chrome_plugin_lib.h" | 30 #include "chrome/common/chrome_plugin_lib.h" |
| 30 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
| 31 #include "chrome/common/logging_chrome.h" | 32 #include "chrome/common/logging_chrome.h" |
| 32 #include "chrome/common/net/url_request_context_getter.h" | 33 #include "chrome/common/net/url_request_context_getter.h" |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 447 } | 448 } |
| 448 | 449 |
| 449 void PluginProcessHost::OnChannelCreated( | 450 void PluginProcessHost::OnChannelCreated( |
| 450 const IPC::ChannelHandle& channel_handle) { | 451 const IPC::ChannelHandle& channel_handle) { |
| 451 Client* client = sent_requests_.front(); | 452 Client* client = sent_requests_.front(); |
| 452 | 453 |
| 453 client->OnChannelOpened(channel_handle); | 454 client->OnChannelOpened(channel_handle); |
| 454 sent_requests_.pop(); | 455 sent_requests_.pop(); |
| 455 } | 456 } |
| 456 | 457 |
| 457 void PluginProcessHost::OnGetPluginFinderUrl(std::string* plugin_finder_url) { | 458 void PluginProcessHost::OnGetPluginFinderUrl(std::string* plugin_finder_url) { |
|
Bernhard Bauer
2011/02/24 16:25:19
We should move this into a MessageFilter some time
pastarmovj
2011/02/25 09:56:37
Done.
| |
| 458 if (!plugin_finder_url) { | 459 if (!plugin_finder_url) { |
| 459 NOTREACHED(); | 460 NOTREACHED(); |
| 460 return; | 461 return; |
| 461 } | 462 } |
| 462 | 463 |
| 463 // TODO(iyengar) Add the plumbing to retrieve the default | 464 if (!g_browser_process->plugin_finder_disabled()) { |
| 464 // plugin finder URL. | 465 // TODO(iyengar) Add the plumbing to retrieve the default |
| 465 *plugin_finder_url = kDefaultPluginFinderURL; | 466 // plugin finder URL. |
| 467 *plugin_finder_url = kDefaultPluginFinderURL; | |
| 468 } else { | |
| 469 plugin_finder_url->clear(); | |
| 470 } | |
| 466 } | 471 } |
| 467 | 472 |
| 468 void PluginProcessHost::OnPluginMessage( | 473 void PluginProcessHost::OnPluginMessage( |
| 469 const std::vector<uint8>& data) { | 474 const std::vector<uint8>& data) { |
| 470 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 475 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 471 | 476 |
| 472 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); | 477 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); |
| 473 if (chrome_plugin) { | 478 if (chrome_plugin) { |
| 474 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); | 479 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); |
| 475 uint32 data_len = static_cast<uint32>(data.size()); | 480 uint32 data_len = static_cast<uint32>(data.size()); |
| 476 chrome_plugin->functions().on_message(data_ptr, data_len); | 481 chrome_plugin->functions().on_message(data_ptr, data_len); |
| 477 } | 482 } |
| 478 } | 483 } |
| OLD | NEW |