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

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

Issue 196012: This changelist fixes some issues with the NPAPI WMP plugin work in Chrome. ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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/browser/plugin_service.cc » ('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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 pending_requests_[i].reply_msg); 488 pending_requests_[i].reply_msg);
489 } 489 }
490 490
491 pending_requests_.clear(); 491 pending_requests_.clear();
492 } 492 }
493 493
494 void PluginProcessHost::OnChannelError() { 494 void PluginProcessHost::OnChannelError() {
495 for (size_t i = 0; i < pending_requests_.size(); ++i) { 495 for (size_t i = 0; i < pending_requests_.size(); ++i) {
496 ReplyToRenderer(pending_requests_[i].renderer_message_filter_.get(), 496 ReplyToRenderer(pending_requests_[i].renderer_message_filter_.get(),
497 IPC::ChannelHandle(), 497 IPC::ChannelHandle(),
498 FilePath(), 498 WebPluginInfo(),
499 pending_requests_[i].reply_msg); 499 pending_requests_[i].reply_msg);
500 } 500 }
501 501
502 pending_requests_.clear(); 502 pending_requests_.clear();
503 } 503 }
504 504
505 void PluginProcessHost::OpenChannelToPlugin( 505 void PluginProcessHost::OpenChannelToPlugin(
506 ResourceMessageFilter* renderer_message_filter, 506 ResourceMessageFilter* renderer_message_filter,
507 const std::string& mime_type, 507 const std::string& mime_type,
508 IPC::Message* reply_msg) { 508 IPC::Message* reply_msg) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 int result, 566 int result,
567 const std::string& proxy_list) { 567 const std::string& proxy_list) {
568 PluginProcessHostMsg_ResolveProxy::WriteReplyParams( 568 PluginProcessHostMsg_ResolveProxy::WriteReplyParams(
569 reply_msg, result, proxy_list); 569 reply_msg, result, proxy_list);
570 Send(reply_msg); 570 Send(reply_msg);
571 } 571 }
572 572
573 void PluginProcessHost::ReplyToRenderer( 573 void PluginProcessHost::ReplyToRenderer(
574 ResourceMessageFilter* renderer_message_filter, 574 ResourceMessageFilter* renderer_message_filter,
575 const IPC::ChannelHandle& channel, 575 const IPC::ChannelHandle& channel,
576 const FilePath& plugin_path, 576 const WebPluginInfo& info,
577 IPC::Message* reply_msg) { 577 IPC::Message* reply_msg) {
578 ViewHostMsg_OpenChannelToPlugin::WriteReplyParams(reply_msg, channel, 578 ViewHostMsg_OpenChannelToPlugin::WriteReplyParams(reply_msg, channel, info);
579 plugin_path);
580 renderer_message_filter->Send(reply_msg); 579 renderer_message_filter->Send(reply_msg);
581 } 580 }
582 581
583 URLRequestContext* PluginProcessHost::GetRequestContext( 582 URLRequestContext* PluginProcessHost::GetRequestContext(
584 uint32 request_id, 583 uint32 request_id,
585 const ViewHostMsg_Resource_Request& request_data) { 584 const ViewHostMsg_Resource_Request& request_data) {
586 return CPBrowsingContextManager::Instance()->ToURLRequestContext(request_id); 585 return CPBrowsingContextManager::Instance()->ToURLRequestContext(request_id);
587 } 586 }
588 587
589 void PluginProcessHost::RequestPluginChannel( 588 void PluginProcessHost::RequestPluginChannel(
590 ResourceMessageFilter* renderer_message_filter, 589 ResourceMessageFilter* renderer_message_filter,
591 const std::string& mime_type, IPC::Message* reply_msg) { 590 const std::string& mime_type, IPC::Message* reply_msg) {
592 // We can't send any sync messages from the browser because it might lead to 591 // We can't send any sync messages from the browser because it might lead to
593 // a hang. However this async messages must be answered right away by the 592 // a hang. However this async messages must be answered right away by the
594 // plugin process (i.e. unblocks a Send() call like a sync message) otherwise 593 // plugin process (i.e. unblocks a Send() call like a sync message) otherwise
595 // a deadlock can occur if the plugin creation request from the renderer is 594 // a deadlock can occur if the plugin creation request from the renderer is
596 // a result of a sync message by the plugin process. 595 // a result of a sync message by the plugin process.
597 PluginProcessMsg_CreateChannel* msg = new PluginProcessMsg_CreateChannel( 596 PluginProcessMsg_CreateChannel* msg = new PluginProcessMsg_CreateChannel(
598 renderer_message_filter->id(), 597 renderer_message_filter->id(),
599 renderer_message_filter->off_the_record()); 598 renderer_message_filter->off_the_record());
600 msg->set_unblock(true); 599 msg->set_unblock(true);
601 if (Send(msg)) { 600 if (Send(msg)) {
602 sent_requests_.push(ChannelRequest( 601 sent_requests_.push(ChannelRequest(
603 renderer_message_filter, mime_type, reply_msg)); 602 renderer_message_filter, mime_type, reply_msg));
604 } else { 603 } else {
605 ReplyToRenderer(renderer_message_filter, IPC::ChannelHandle(), FilePath(), 604 ReplyToRenderer(renderer_message_filter,
605 IPC::ChannelHandle(),
606 WebPluginInfo(),
606 reply_msg); 607 reply_msg);
607 } 608 }
608 } 609 }
609 610
610 void PluginProcessHost::OnChannelCreated( 611 void PluginProcessHost::OnChannelCreated(
611 const IPC::ChannelHandle& channel_handle) { 612 const IPC::ChannelHandle& channel_handle) {
612 const ChannelRequest& request = sent_requests_.front(); 613 const ChannelRequest& request = sent_requests_.front();
613 614
614 ReplyToRenderer(request.renderer_message_filter_.get(), 615 ReplyToRenderer(request.renderer_message_filter_.get(),
615 channel_handle, 616 channel_handle,
616 info_.path, 617 info_,
617 request.reply_msg); 618 request.reply_msg);
618 sent_requests_.pop(); 619 sent_requests_.pop();
619 } 620 }
620 621
621 void PluginProcessHost::OnGetPluginFinderUrl(std::string* plugin_finder_url) { 622 void PluginProcessHost::OnGetPluginFinderUrl(std::string* plugin_finder_url) {
622 if (!plugin_finder_url) { 623 if (!plugin_finder_url) {
623 NOTREACHED(); 624 NOTREACHED();
624 return; 625 return;
625 } 626 }
626 627
627 // TODO(iyengar) Add the plumbing to retrieve the default 628 // TODO(iyengar) Add the plumbing to retrieve the default
628 // plugin finder URL. 629 // plugin finder URL.
629 *plugin_finder_url = kDefaultPluginFinderURL; 630 *plugin_finder_url = kDefaultPluginFinderURL;
630 } 631 }
631 632
632 void PluginProcessHost::OnPluginMessage( 633 void PluginProcessHost::OnPluginMessage(
633 const std::vector<uint8>& data) { 634 const std::vector<uint8>& data) {
634 DCHECK(MessageLoop::current() == 635 DCHECK(MessageLoop::current() ==
635 ChromeThread::GetMessageLoop(ChromeThread::IO)); 636 ChromeThread::GetMessageLoop(ChromeThread::IO));
636 637
637 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); 638 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path);
638 if (chrome_plugin) { 639 if (chrome_plugin) {
639 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); 640 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0]));
640 uint32 data_len = static_cast<uint32>(data.size()); 641 uint32 data_len = static_cast<uint32>(data.size());
641 chrome_plugin->functions().on_message(data_ptr, data_len); 642 chrome_plugin->functions().on_message(data_ptr, data_len);
642 } 643 }
643 } 644 }
OLDNEW
« no previous file with comments | « chrome/browser/plugin_process_host.h ('k') | chrome/browser/plugin_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698