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

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

Issue 18248: CommandLine API rework (Closed)
Patch Set: fixes Created 11 years, 11 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/browsing_instance.cc ('k') | chrome/browser/debugger/debugger_contents.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "chrome/browser/chrome_plugin_host.h" 5 #include "chrome/browser/chrome_plugin_host.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 PluginProcessHost *host = service->FindPluginProcess(plugin->filename()); 633 PluginProcessHost *host = service->FindPluginProcess(plugin->filename());
634 return host ? true : false; 634 return host ? true : false;
635 } 635 }
636 636
637 CPProcessType STDCALL CPB_GetProcessType(CPID id) { 637 CPProcessType STDCALL CPB_GetProcessType(CPID id) {
638 CHECK(ChromePluginLib::IsPluginThread()); 638 CHECK(ChromePluginLib::IsPluginThread());
639 return CP_PROCESS_BROWSER; 639 return CP_PROCESS_BROWSER;
640 } 640 }
641 641
642 CPError STDCALL CPB_SendMessage(CPID id, const void *data, uint32 data_len) { 642 CPError STDCALL CPB_SendMessage(CPID id, const void *data, uint32 data_len) {
643 CommandLine cmd; 643 if (CommandLine::ForCurrentProcess()->HasSwitch(
644 if (cmd.HasSwitch(switches::kGearsInRenderer)) { 644 switches::kGearsInRenderer)) {
645 ChromePluginLib* plugin = ChromePluginLib::FromCPID(id); 645 ChromePluginLib* plugin = ChromePluginLib::FromCPID(id);
646 CHECK(plugin); 646 CHECK(plugin);
647 647
648 const unsigned char* data_ptr = static_cast<const unsigned char*>(data); 648 const unsigned char* data_ptr = static_cast<const unsigned char*>(data);
649 std::vector<uint8> v(data_ptr, data_ptr + data_len); 649 std::vector<uint8> v(data_ptr, data_ptr + data_len);
650 for (RenderProcessHost::iterator it = RenderProcessHost::begin(); 650 for (RenderProcessHost::iterator it = RenderProcessHost::begin();
651 it != RenderProcessHost::end(); ++it) { 651 it != RenderProcessHost::end(); ++it) {
652 it->second->Send(new ViewMsg_PluginMessage(plugin->filename(), v)); 652 it->second->Send(new ViewMsg_PluginMessage(plugin->filename(), v));
653 } 653 }
654 654
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 void CPHandleCommand(int command, CPCommandInterface* data, 764 void CPHandleCommand(int command, CPCommandInterface* data,
765 CPBrowsingContext context) { 765 CPBrowsingContext context) {
766 // Sadly if we try and pass context through, we seem to break cl's little 766 // Sadly if we try and pass context through, we seem to break cl's little
767 // brain trying to compile the Tuple3 ctor. This cast works. 767 // brain trying to compile the Tuple3 ctor. This cast works.
768 int32 context_as_int32 = static_cast<int32>(context); 768 int32 context_as_int32 = static_cast<int32>(context);
769 // Plugins can only be accessed on the IO thread. 769 // Plugins can only be accessed on the IO thread.
770 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, 770 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE,
771 NewRunnableFunction(PluginCommandHandler::HandleCommand, 771 NewRunnableFunction(PluginCommandHandler::HandleCommand,
772 command, data, context_as_int32)); 772 command, data, context_as_int32));
773 } 773 }
OLDNEW
« no previous file with comments | « chrome/browser/browsing_instance.cc ('k') | chrome/browser/debugger/debugger_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698