OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 public: | 23 public: |
24 // Get a new PluginChannel object for the current process to talk to the | 24 // Get a new PluginChannel object for the current process to talk to the |
25 // given renderer process. The renderer ID is an opaque unique ID generated | 25 // given renderer process. The renderer ID is an opaque unique ID generated |
26 // by the browser. | 26 // by the browser. |
27 static PluginChannel* GetPluginChannel(int renderer_id, | 27 static PluginChannel* GetPluginChannel(int renderer_id, |
28 MessageLoop* ipc_message_loop); | 28 MessageLoop* ipc_message_loop); |
29 | 29 |
30 // Send a message to all renderers that the process is going to shutdown. | 30 // Send a message to all renderers that the process is going to shutdown. |
31 static void NotifyRenderersOfPendingShutdown(); | 31 static void NotifyRenderersOfPendingShutdown(); |
32 | 32 |
33 ~PluginChannel(); | 33 virtual ~PluginChannel(); |
34 | 34 |
35 virtual bool Send(IPC::Message* msg); | 35 virtual bool Send(IPC::Message* msg); |
36 virtual void OnMessageReceived(const IPC::Message& message); | 36 virtual void OnMessageReceived(const IPC::Message& message); |
37 | 37 |
38 base::ProcessHandle renderer_handle() const { return renderer_handle_; } | 38 base::ProcessHandle renderer_handle() const { return renderer_handle_; } |
39 int renderer_id() { return renderer_id_; } | 39 int renderer_id() { return renderer_id_; } |
40 | 40 |
41 int GenerateRouteID(); | 41 virtual int GenerateRouteID(); |
42 | 42 |
43 // 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 |
44 // dialog to come up. | 44 // dialog to come up. |
45 base::WaitableEvent* GetModalDialogEvent(gfx::NativeViewId containing_window); | 45 base::WaitableEvent* GetModalDialogEvent(gfx::NativeViewId containing_window); |
46 | 46 |
47 bool in_send() { return in_send_ != 0; } | 47 bool in_send() { return in_send_ != 0; } |
48 | 48 |
49 bool off_the_record() { return off_the_record_; } | 49 bool off_the_record() { return off_the_record_; } |
50 void set_off_the_record(bool value) { off_the_record_ = value; } | 50 void set_off_the_record(bool value) { off_the_record_ = value; } |
51 | 51 |
(...skipping 10 matching lines...) Expand all Loading... |
62 | 62 |
63 // Overrides PluginChannelBase::Init. | 63 // Overrides PluginChannelBase::Init. |
64 virtual bool Init(MessageLoop* ipc_message_loop, bool create_pipe_now); | 64 virtual bool Init(MessageLoop* ipc_message_loop, bool create_pipe_now); |
65 | 65 |
66 private: | 66 private: |
67 class MessageFilter; | 67 class MessageFilter; |
68 | 68 |
69 // Called on the plugin thread | 69 // Called on the plugin thread |
70 PluginChannel(); | 70 PluginChannel(); |
71 | 71 |
72 void OnControlMessageReceived(const IPC::Message& msg); | 72 virtual void OnControlMessageReceived(const IPC::Message& msg); |
73 | 73 |
74 static PluginChannelBase* ClassFactory() { return new PluginChannel(); } | 74 static PluginChannelBase* ClassFactory() { return new PluginChannel(); } |
75 | 75 |
76 void OnCreateInstance(const std::string& mime_type, int* instance_id); | 76 void OnCreateInstance(const std::string& mime_type, int* instance_id); |
77 void OnDestroyInstance(int instance_id, IPC::Message* reply_msg); | 77 void OnDestroyInstance(int instance_id, IPC::Message* reply_msg); |
78 void OnGenerateRouteID(int* route_id); | 78 void OnGenerateRouteID(int* route_id); |
79 void OnClearSiteData(uint64 flags, | 79 void OnClearSiteData(uint64 flags, |
80 const std::string& domain, | 80 const std::string& domain, |
81 base::Time begin_time); | 81 base::Time begin_time); |
82 | 82 |
(...skipping 21 matching lines...) Expand all Loading... |
104 | 104 |
105 int in_send_; // Tracks if we're in a Send call. | 105 int in_send_; // Tracks if we're in a Send call. |
106 bool log_messages_; // True if we should log sent and received messages. | 106 bool log_messages_; // True if we should log sent and received messages. |
107 bool off_the_record_; // True if the renderer is in off the record mode. | 107 bool off_the_record_; // True if the renderer is in off the record mode. |
108 scoped_refptr<MessageFilter> filter_; // Handles the modal dialog events. | 108 scoped_refptr<MessageFilter> filter_; // Handles the modal dialog events. |
109 | 109 |
110 DISALLOW_COPY_AND_ASSIGN(PluginChannel); | 110 DISALLOW_COPY_AND_ASSIGN(PluginChannel); |
111 }; | 111 }; |
112 | 112 |
113 #endif // CHROME_PLUGIN_PLUGIN_CHANNEL_H_ | 113 #endif // CHROME_PLUGIN_PLUGIN_CHANNEL_H_ |
OLD | NEW |