| OLD | NEW |
| 1 // Copyright (c) 2012 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" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 public: | 24 public: |
| 25 // Get a new PluginChannel object for the current process to talk to the | 25 // Get a new PluginChannel object for the current process to talk to the |
| 26 // given renderer process. The renderer ID is an opaque unique ID generated | 26 // given renderer process. The renderer ID is an opaque unique ID generated |
| 27 // by the browser. | 27 // by the browser. |
| 28 static PluginChannel* GetPluginChannel( | 28 static PluginChannel* GetPluginChannel( |
| 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 // IPC::Channel::Listener: |
| 35 | |
| 36 virtual bool Send(IPC::Message* msg) OVERRIDE; | 35 virtual bool Send(IPC::Message* msg) OVERRIDE; |
| 37 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 36 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 37 virtual void OnChannelError() OVERRIDE; |
| 38 | 38 |
| 39 int renderer_id() { return renderer_id_; } | 39 int renderer_id() { return renderer_id_; } |
| 40 | 40 |
| 41 virtual int GenerateRouteID() OVERRIDE; | 41 virtual int GenerateRouteID() OVERRIDE; |
| 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 virtual base::WaitableEvent* GetModalDialogEvent( | 45 virtual base::WaitableEvent* GetModalDialogEvent( |
| 46 gfx::NativeViewId containing_window) OVERRIDE; | 46 gfx::NativeViewId containing_window) OVERRIDE; |
| 47 | 47 |
| 48 bool in_send() { return in_send_ != 0; } | 48 bool in_send() { return in_send_ != 0; } |
| 49 | 49 |
| 50 bool incognito() { return incognito_; } | 50 bool incognito() { return incognito_; } |
| 51 void set_incognito(bool value) { incognito_ = value; } | 51 void set_incognito(bool value) { incognito_ = value; } |
| 52 | 52 |
| 53 #if defined(OS_POSIX) | 53 #if defined(OS_POSIX) |
| 54 int TakeRendererFileDescriptor() { | 54 int TakeRendererFileDescriptor() { |
| 55 return channel_->TakeClientFileDescriptor(); | 55 return channel_->TakeClientFileDescriptor(); |
| 56 } | 56 } |
| 57 #endif | 57 #endif |
| 58 | 58 |
| 59 protected: | 59 protected: |
| 60 // IPC::Channel::Listener implementation: | 60 virtual ~PluginChannel(); |
| 61 virtual void OnChannelError() OVERRIDE; | |
| 62 | 61 |
| 62 // NPChannelBase:: |
| 63 virtual void CleanUp() OVERRIDE; | 63 virtual void CleanUp() OVERRIDE; |
| 64 | |
| 65 // Overrides NPChannelBase::Init. | |
| 66 virtual bool Init(base::MessageLoopProxy* ipc_message_loop, | 64 virtual bool Init(base::MessageLoopProxy* ipc_message_loop, |
| 67 bool create_pipe_now, | 65 bool create_pipe_now, |
| 68 base::WaitableEvent* shutdown_event) OVERRIDE; | 66 base::WaitableEvent* shutdown_event) OVERRIDE; |
| 69 | 67 |
| 70 private: | 68 private: |
| 71 class MessageFilter; | 69 class MessageFilter; |
| 72 | 70 |
| 73 // Called on the plugin thread | 71 // Called on the plugin thread |
| 74 PluginChannel(); | 72 PluginChannel(); |
| 75 | 73 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 91 | 89 |
| 92 int in_send_; // Tracks if we're in a Send call. | 90 int in_send_; // Tracks if we're in a Send call. |
| 93 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. |
| 94 bool incognito_; // True if the renderer is in incognito mode. | 92 bool incognito_; // True if the renderer is in incognito mode. |
| 95 scoped_refptr<MessageFilter> filter_; // Handles the modal dialog events. | 93 scoped_refptr<MessageFilter> filter_; // Handles the modal dialog events. |
| 96 | 94 |
| 97 DISALLOW_COPY_AND_ASSIGN(PluginChannel); | 95 DISALLOW_COPY_AND_ASSIGN(PluginChannel); |
| 98 }; | 96 }; |
| 99 | 97 |
| 100 #endif // CONTENT_PLUGIN_PLUGIN_CHANNEL_H_ | 98 #endif // CONTENT_PLUGIN_PLUGIN_CHANNEL_H_ |
| OLD | NEW |