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

Side by Side Diff: chrome/plugin/plugin_channel.h

Issue 195079: Gears File Drag Drop (Closed) Base URL: http://src.chromium.org/svn/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/plugin/chrome_plugin_host.cc ('k') | chrome/plugin/plugin_channel.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) 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 #ifndef CHROME_PLUGIN_PLUGIN_CHANNEL_H_ 5 #ifndef CHROME_PLUGIN_PLUGIN_CHANNEL_H_
6 #define CHROME_PLUGIN_PLUGIN_CHANNEL_H_ 6 #define CHROME_PLUGIN_PLUGIN_CHANNEL_H_
7 7
8 #include <vector> 8 #include <vector>
9 #include "base/scoped_handle.h" 9 #include "base/scoped_handle.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 #include "chrome/plugin/plugin_channel_base.h" 11 #include "chrome/plugin/plugin_channel_base.h"
12 #include "chrome/plugin/webplugin_delegate_stub.h" 12 #include "chrome/plugin/webplugin_delegate_stub.h"
13 13
14 // Encapsulates an IPC channel between the plugin process and one renderer 14 // Encapsulates an IPC channel between the plugin process and one renderer
15 // process. On the renderer side there's a corresponding PluginChannelHost. 15 // process. On the renderer side there's a corresponding PluginChannelHost.
16 class PluginChannel : public PluginChannelBase { 16 class PluginChannel : public PluginChannelBase {
17 public: 17 public:
18 // Get a new PluginChannel object for the current process to talk to the 18 // Get a new PluginChannel object for the current process to talk to the
19 // given rendeer process. The renderer ID is an opaque unique ID generated by 19 // given renderer process. The renderer ID is an opaque unique ID generated
20 // the browser. 20 // by the browser.
21 // 21 //
22 // POSIX only: If |channel_fd| > 0, use that file descriptor for the 22 // POSIX only: If |channel_fd| > 0, use that file descriptor for the
23 // channel socket. 23 // channel socket.
24 static PluginChannel* GetPluginChannel(int renderer_id, 24 static PluginChannel* GetPluginChannel(int renderer_id,
25 MessageLoop* ipc_message_loop); 25 MessageLoop* ipc_message_loop);
26 26
27 ~PluginChannel(); 27 ~PluginChannel();
28 28
29 virtual bool Send(IPC::Message* msg); 29 virtual bool Send(IPC::Message* msg);
30 virtual void OnMessageReceived(const IPC::Message& message); 30 virtual void OnMessageReceived(const IPC::Message& message);
31 31
32 base::ProcessHandle renderer_handle() const { return renderer_handle_; } 32 base::ProcessHandle renderer_handle() const { return renderer_handle_; }
33 int renderer_id() { return renderer_id_; }
34
33 int GenerateRouteID(); 35 int GenerateRouteID();
34 36
35 #if defined(OS_POSIX) 37 #if defined(OS_POSIX)
36 // When first created, the PluginChannel gets assigned the file descriptor 38 // When first created, the PluginChannel gets assigned the file descriptor
37 // for the renderer. 39 // for the renderer.
38 // After the first time we pass it through the IPC, we don't need it anymore, 40 // After the first time we pass it through the IPC, we don't need it anymore,
39 // and we close it. At that time, we reset renderer_fd_ to -1. 41 // and we close it. At that time, we reset renderer_fd_ to -1.
40 int DisownRendererFd() { 42 int DisownRendererFd() {
41 int value = renderer_fd_; 43 int value = renderer_fd_;
42 renderer_fd_ = -1; 44 renderer_fd_ = -1;
(...skipping 26 matching lines...) Expand all
69 71
70 void OnCreateInstance(const std::string& mime_type, int* instance_id); 72 void OnCreateInstance(const std::string& mime_type, int* instance_id);
71 void OnDestroyInstance(int instance_id, IPC::Message* reply_msg); 73 void OnDestroyInstance(int instance_id, IPC::Message* reply_msg);
72 void OnGenerateRouteID(int* route_id); 74 void OnGenerateRouteID(int* route_id);
73 75
74 std::vector<scoped_refptr<WebPluginDelegateStub> > plugin_stubs_; 76 std::vector<scoped_refptr<WebPluginDelegateStub> > plugin_stubs_;
75 77
76 // Handle to the renderer process who is on the other side of the channel. 78 // Handle to the renderer process who is on the other side of the channel.
77 base::ProcessHandle renderer_handle_; 79 base::ProcessHandle renderer_handle_;
78 80
81 // The id of the renderer who is on the other side of the channel.
82 int renderer_id_;
83
79 #if defined(OS_POSIX) 84 #if defined(OS_POSIX)
80 // FD for the renderer end of the pipe. It is stored until we send it over 85 // FD for the renderer end of the pipe. It is stored until we send it over
81 // IPC after which it is cleared. It will be closed by the IPC mechanism. 86 // IPC after which it is cleared. It will be closed by the IPC mechanism.
82 int renderer_fd_; 87 int renderer_fd_;
83 #endif 88 #endif
84 89
85 int in_send_; // Tracks if we're in a Send call. 90 int in_send_; // Tracks if we're in a Send call.
86 bool log_messages_; // True if we should log sent and received messages. 91 bool log_messages_; // True if we should log sent and received messages.
87 bool off_the_record_; // True if the renderer is in off the record mode. 92 bool off_the_record_; // True if the renderer is in off the record mode.
88 93
89 DISALLOW_EVIL_CONSTRUCTORS(PluginChannel); 94 DISALLOW_EVIL_CONSTRUCTORS(PluginChannel);
90 }; 95 };
91 96
92 #endif // CHROME_PLUGIN_PLUGIN_CHANNEL_H_ 97 #endif // CHROME_PLUGIN_PLUGIN_CHANNEL_H_
OLDNEW
« no previous file with comments | « chrome/plugin/chrome_plugin_host.cc ('k') | chrome/plugin/plugin_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698