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

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

Issue 9838083: Add a sandbox API for broker handle duplication (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_PLUGIN_PLUGIN_CHANNEL_H_ 5 #ifndef CONTENT_PLUGIN_PLUGIN_CHANNEL_H_
6 #define CONTENT_PLUGIN_PLUGIN_CHANNEL_H_ 6 #define CONTENT_PLUGIN_PLUGIN_CHANNEL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_handle.h" 11 #include "base/memory/scoped_handle.h"
(...skipping 17 matching lines...) Expand all
29 int renderer_id, base::MessageLoopProxy* ipc_message_loop); 29 int renderer_id, base::MessageLoopProxy* ipc_message_loop);
30 30
31 // Send a message to all renderers that the process is going to shutdown. 31 // Send a message to all renderers that the process is going to shutdown.
32 static void NotifyRenderersOfPendingShutdown(); 32 static void NotifyRenderersOfPendingShutdown();
33 33
34 virtual ~PluginChannel(); 34 virtual ~PluginChannel();
35 35
36 virtual bool Send(IPC::Message* msg) OVERRIDE; 36 virtual bool Send(IPC::Message* msg) OVERRIDE;
37 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 37 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
38 38
39 base::ProcessHandle renderer_handle() const { return renderer_handle_; }
40 int renderer_id() { return renderer_id_; } 39 int renderer_id() { return renderer_id_; }
41 40
42 virtual int GenerateRouteID() OVERRIDE; 41 virtual int GenerateRouteID() OVERRIDE;
43 42
44 // Returns the event that's set when a call to the renderer causes a modal 43 // Returns the event that's set when a call to the renderer causes a modal
45 // dialog to come up. 44 // dialog to come up.
46 virtual base::WaitableEvent* GetModalDialogEvent( 45 virtual base::WaitableEvent* GetModalDialogEvent(
47 gfx::NativeViewId containing_window) OVERRIDE; 46 gfx::NativeViewId containing_window) OVERRIDE;
48 47
49 bool in_send() { return in_send_ != 0; } 48 bool in_send() { return in_send_ != 0; }
50 49
51 bool incognito() { return incognito_; } 50 bool incognito() { return incognito_; }
52 void set_incognito(bool value) { incognito_ = value; } 51 void set_incognito(bool value) { incognito_ = value; }
53 52
54 #if defined(OS_POSIX) 53 #if defined(OS_POSIX)
55 int TakeRendererFileDescriptor() { 54 int TakeRendererFileDescriptor() {
56 return channel_->TakeClientFileDescriptor(); 55 return channel_->TakeClientFileDescriptor();
57 } 56 }
58 #endif 57 #endif
59 58
60 protected: 59 protected:
61 // IPC::Channel::Listener implementation: 60 // IPC::Channel::Listener implementation:
62 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
63 virtual void OnChannelError() OVERRIDE; 61 virtual void OnChannelError() OVERRIDE;
64 62
65 virtual void CleanUp() OVERRIDE; 63 virtual void CleanUp() OVERRIDE;
66 64
67 // Overrides NPChannelBase::Init. 65 // Overrides NPChannelBase::Init.
68 virtual bool Init(base::MessageLoopProxy* ipc_message_loop, 66 virtual bool Init(base::MessageLoopProxy* ipc_message_loop,
69 bool create_pipe_now, 67 bool create_pipe_now,
70 base::WaitableEvent* shutdown_event) OVERRIDE; 68 base::WaitableEvent* shutdown_event) OVERRIDE;
71 69
72 private: 70 private:
73 class MessageFilter; 71 class MessageFilter;
74 72
75 // Called on the plugin thread 73 // Called on the plugin thread
76 PluginChannel(); 74 PluginChannel();
77 75
78 virtual bool OnControlMessageReceived(const IPC::Message& msg) OVERRIDE; 76 virtual bool OnControlMessageReceived(const IPC::Message& msg) OVERRIDE;
79 77
80 static NPChannelBase* ClassFactory() { return new PluginChannel(); } 78 static NPChannelBase* ClassFactory() { return new PluginChannel(); }
81 79
82 void OnCreateInstance(const std::string& mime_type, int* instance_id); 80 void OnCreateInstance(const std::string& mime_type, int* instance_id);
83 void OnDestroyInstance(int instance_id, IPC::Message* reply_msg); 81 void OnDestroyInstance(int instance_id, IPC::Message* reply_msg);
84 void OnGenerateRouteID(int* route_id); 82 void OnGenerateRouteID(int* route_id);
85 void OnClearSiteData(const std::string& site, 83 void OnClearSiteData(const std::string& site,
86 uint64 flags, 84 uint64 flags,
87 base::Time begin_time); 85 base::Time begin_time);
88 86
89 std::vector<scoped_refptr<WebPluginDelegateStub> > plugin_stubs_; 87 std::vector<scoped_refptr<WebPluginDelegateStub> > plugin_stubs_;
90 88
91 // Handle to the renderer process who is on the other side of the channel.
92 base::ProcessHandle renderer_handle_;
93
94 // The id of the renderer who is on the other side of the channel. 89 // The id of the renderer who is on the other side of the channel.
95 int renderer_id_; 90 int renderer_id_;
96 91
97 int in_send_; // Tracks if we're in a Send call. 92 int in_send_; // Tracks if we're in a Send call.
98 bool log_messages_; // True if we should log sent and received messages. 93 bool log_messages_; // True if we should log sent and received messages.
99 bool incognito_; // True if the renderer is in incognito mode. 94 bool incognito_; // True if the renderer is in incognito mode.
100 scoped_refptr<MessageFilter> filter_; // Handles the modal dialog events. 95 scoped_refptr<MessageFilter> filter_; // Handles the modal dialog events.
101 96
102 DISALLOW_COPY_AND_ASSIGN(PluginChannel); 97 DISALLOW_COPY_AND_ASSIGN(PluginChannel);
103 }; 98 };
104 99
105 #endif // CONTENT_PLUGIN_PLUGIN_CHANNEL_H_ 100 #endif // CONTENT_PLUGIN_PLUGIN_CHANNEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698