| Index: content/renderer/pepper/pepper_helper_impl.cc
|
| ===================================================================
|
| --- content/renderer/pepper/pepper_helper_impl.cc (revision 214411)
|
| +++ content/renderer/pepper/pepper_helper_impl.cc (working copy)
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "content/renderer/pepper/pepper_plugin_delegate_impl.h"
|
| +#include "content/renderer/pepper/pepper_helper_impl.h"
|
|
|
| #include <cmath>
|
| #include <cstddef>
|
| @@ -111,7 +111,7 @@
|
|
|
| } // namespace
|
|
|
| -PepperPluginDelegateImpl::PepperPluginDelegateImpl(RenderViewImpl* render_view)
|
| +PepperHelperImpl::PepperHelperImpl(RenderViewImpl* render_view)
|
| : RenderViewObserver(render_view),
|
| render_view_(render_view),
|
| pepper_browser_connection_(this),
|
| @@ -119,10 +119,10 @@
|
| last_mouse_event_target_(NULL) {
|
| }
|
|
|
| -PepperPluginDelegateImpl::~PepperPluginDelegateImpl() {
|
| +PepperHelperImpl::~PepperHelperImpl() {
|
| }
|
|
|
| -WebKit::WebPlugin* PepperPluginDelegateImpl::CreatePepperWebPlugin(
|
| +WebKit::WebPlugin* PepperHelperImpl::CreatePepperWebPlugin(
|
| const WebPluginInfo& webplugin_info,
|
| const WebKit::WebPluginParams& params) {
|
| bool pepper_plugin_was_registered = false;
|
| @@ -139,7 +139,7 @@
|
| return NULL;
|
| }
|
|
|
| -scoped_refptr<PluginModule> PepperPluginDelegateImpl::CreatePepperPluginModule(
|
| +scoped_refptr<PluginModule> PepperHelperImpl::CreatePepperPluginModule(
|
| const WebPluginInfo& webplugin_info,
|
| bool* pepper_plugin_was_registered) {
|
| *pepper_plugin_was_registered = true;
|
| @@ -202,7 +202,7 @@
|
| return module;
|
| }
|
|
|
| -scoped_refptr<PepperBroker> PepperPluginDelegateImpl::CreateBroker(
|
| +scoped_refptr<PepperBroker> PepperHelperImpl::CreateBroker(
|
| PluginModule* plugin_module) {
|
| DCHECK(plugin_module);
|
| DCHECK(!plugin_module->GetBroker());
|
| @@ -222,7 +222,7 @@
|
| return broker;
|
| }
|
|
|
| -RendererPpapiHost* PepperPluginDelegateImpl::CreateOutOfProcessModule(
|
| +RendererPpapiHost* PepperHelperImpl::CreateOutOfProcessModule(
|
| PluginModule* module,
|
| const base::FilePath& path,
|
| ppapi::PpapiPermissions permissions,
|
| @@ -254,7 +254,7 @@
|
| return host_impl;
|
| }
|
|
|
| -void PepperPluginDelegateImpl::OnPpapiBrokerChannelCreated(
|
| +void PepperHelperImpl::OnPpapiBrokerChannelCreated(
|
| int request_id,
|
| base::ProcessId broker_pid,
|
| const IPC::ChannelHandle& handle) {
|
| @@ -277,7 +277,7 @@
|
| // Iterates through pending_connect_broker_ to find the broker.
|
| // Cannot use Lookup() directly because pending_connect_broker_ does not store
|
| // the raw pointer to the broker. Assumes maximum of one copy of broker exists.
|
| -bool PepperPluginDelegateImpl::StopWaitingForBrokerConnection(
|
| +bool PepperHelperImpl::StopWaitingForBrokerConnection(
|
| PepperBroker* broker) {
|
| for (BrokerMap::iterator i(&pending_connect_broker_);
|
| !i.IsAtEnd(); i.Advance()) {
|
| @@ -290,7 +290,7 @@
|
| return false;
|
| }
|
|
|
| -void PepperPluginDelegateImpl::ViewWillInitiatePaint() {
|
| +void PepperHelperImpl::ViewWillInitiatePaint() {
|
| // Notify all of our instances that we started painting. This is used for
|
| // internal bookkeeping only, so we know that the set can not change under
|
| // us.
|
| @@ -300,7 +300,7 @@
|
| (*i)->ViewWillInitiatePaint();
|
| }
|
|
|
| -void PepperPluginDelegateImpl::ViewInitiatedPaint() {
|
| +void PepperHelperImpl::ViewInitiatedPaint() {
|
| // Notify all instances that we painted. The same caveats apply as for
|
| // ViewFlushedPaint regarding instances closing themselves, so we take
|
| // similar precautions.
|
| @@ -312,7 +312,7 @@
|
| }
|
| }
|
|
|
| -void PepperPluginDelegateImpl::ViewFlushedPaint() {
|
| +void PepperHelperImpl::ViewFlushedPaint() {
|
| // Notify all instances that we flushed. This will call into the plugin, and
|
| // we it may ask to close itself as a result. This will, in turn, modify our
|
| // set, possibly invalidating the iterator. So we iterate on a copy that
|
| @@ -341,13 +341,12 @@
|
| }
|
| }
|
|
|
| -PepperPluginInstanceImpl* PepperPluginDelegateImpl::
|
| - GetBitmapForOptimizedPluginPaint(
|
| - const gfx::Rect& paint_bounds,
|
| - TransportDIB** dib,
|
| - gfx::Rect* location,
|
| - gfx::Rect* clip,
|
| - float* scale_factor) {
|
| +PepperPluginInstanceImpl* PepperHelperImpl::GetBitmapForOptimizedPluginPaint(
|
| + const gfx::Rect& paint_bounds,
|
| + TransportDIB** dib,
|
| + gfx::Rect* location,
|
| + gfx::Rect* clip,
|
| + float* scale_factor) {
|
| for (std::set<PepperPluginInstanceImpl*>::iterator i =
|
| active_instances_.begin();
|
| i != active_instances_.end(); ++i) {
|
| @@ -362,7 +361,7 @@
|
| return NULL;
|
| }
|
|
|
| -void PepperPluginDelegateImpl::PluginFocusChanged(
|
| +void PepperHelperImpl::PluginFocusChanged(
|
| PepperPluginInstanceImpl* instance,
|
| bool focused) {
|
| if (focused)
|
| @@ -373,31 +372,31 @@
|
| render_view_->PpapiPluginFocusChanged();
|
| }
|
|
|
| -void PepperPluginDelegateImpl::PluginTextInputTypeChanged(
|
| +void PepperHelperImpl::PluginTextInputTypeChanged(
|
| PepperPluginInstanceImpl* instance) {
|
| if (focused_plugin_ == instance && render_view_)
|
| render_view_->PpapiPluginTextInputTypeChanged();
|
| }
|
|
|
| -void PepperPluginDelegateImpl::PluginCaretPositionChanged(
|
| +void PepperHelperImpl::PluginCaretPositionChanged(
|
| PepperPluginInstanceImpl* instance) {
|
| if (focused_plugin_ == instance && render_view_)
|
| render_view_->PpapiPluginCaretPositionChanged();
|
| }
|
|
|
| -void PepperPluginDelegateImpl::PluginRequestedCancelComposition(
|
| +void PepperHelperImpl::PluginRequestedCancelComposition(
|
| PepperPluginInstanceImpl* instance) {
|
| if (focused_plugin_ == instance && render_view_)
|
| render_view_->PpapiPluginCancelComposition();
|
| }
|
|
|
| -void PepperPluginDelegateImpl::PluginSelectionChanged(
|
| +void PepperHelperImpl::PluginSelectionChanged(
|
| PepperPluginInstanceImpl* instance) {
|
| if (focused_plugin_ == instance && render_view_)
|
| render_view_->PpapiPluginSelectionChanged();
|
| }
|
|
|
| -void PepperPluginDelegateImpl::OnImeSetComposition(
|
| +void PepperHelperImpl::OnImeSetComposition(
|
| const string16& text,
|
| const std::vector<WebKit::WebCompositionUnderline>& underlines,
|
| int selection_start,
|
| @@ -425,7 +424,7 @@
|
| }
|
| }
|
|
|
| -void PepperPluginDelegateImpl::OnImeConfirmComposition(const string16& text) {
|
| +void PepperHelperImpl::OnImeConfirmComposition(const string16& text) {
|
| // Here, text.empty() has a special meaning. It means to commit the last
|
| // update of composition text (see RenderWidgetHost::ImeConfirmComposition()).
|
| const string16& last_text = text.empty() ? composition_text_ : text;
|
| @@ -456,36 +455,36 @@
|
| composition_text_.clear();
|
| }
|
|
|
| -gfx::Rect PepperPluginDelegateImpl::GetCaretBounds() const {
|
| +gfx::Rect PepperHelperImpl::GetCaretBounds() const {
|
| if (!focused_plugin_)
|
| return gfx::Rect(0, 0, 0, 0);
|
| return focused_plugin_->GetCaretBounds();
|
| }
|
|
|
| -ui::TextInputType PepperPluginDelegateImpl::GetTextInputType() const {
|
| +ui::TextInputType PepperHelperImpl::GetTextInputType() const {
|
| if (!focused_plugin_)
|
| return ui::TEXT_INPUT_TYPE_NONE;
|
| return focused_plugin_->text_input_type();
|
| }
|
|
|
| -void PepperPluginDelegateImpl::GetSurroundingText(string16* text,
|
| - ui::Range* range) const {
|
| +void PepperHelperImpl::GetSurroundingText(string16* text,
|
| + ui::Range* range) const {
|
| if (!focused_plugin_)
|
| return;
|
| return focused_plugin_->GetSurroundingText(text, range);
|
| }
|
|
|
| -bool PepperPluginDelegateImpl::IsPluginAcceptingCompositionEvents() const {
|
| +bool PepperHelperImpl::IsPluginAcceptingCompositionEvents() const {
|
| if (!focused_plugin_)
|
| return false;
|
| return focused_plugin_->IsPluginAcceptingCompositionEvents();
|
| }
|
|
|
| -bool PepperPluginDelegateImpl::CanComposeInline() const {
|
| +bool PepperHelperImpl::CanComposeInline() const {
|
| return IsPluginAcceptingCompositionEvents();
|
| }
|
|
|
| -void PepperPluginDelegateImpl::InstanceCreated(
|
| +void PepperHelperImpl::InstanceCreated(
|
| PepperPluginInstanceImpl* instance) {
|
| active_instances_.insert(instance);
|
|
|
| @@ -493,7 +492,7 @@
|
| instance->SetContentAreaFocus(render_view_->has_focus());
|
| }
|
|
|
| -void PepperPluginDelegateImpl::InstanceDeleted(
|
| +void PepperHelperImpl::InstanceDeleted(
|
| PepperPluginInstanceImpl* instance) {
|
| active_instances_.erase(instance);
|
|
|
| @@ -504,7 +503,7 @@
|
| }
|
|
|
| // If a broker has not already been created for this plugin, creates one.
|
| -PepperBroker* PepperPluginDelegateImpl::ConnectToBroker(
|
| +PepperBroker* PepperHelperImpl::ConnectToBroker(
|
| PPB_Broker_Impl* client) {
|
| DCHECK(client);
|
|
|
| @@ -532,9 +531,8 @@
|
| return broker.get();
|
| }
|
|
|
| -void PepperPluginDelegateImpl::OnPpapiBrokerPermissionResult(
|
| - int request_id,
|
| - bool result) {
|
| +void PepperHelperImpl::OnPpapiBrokerPermissionResult(int request_id,
|
| + bool result) {
|
| scoped_ptr<base::WeakPtr<PPB_Broker_Impl> > client_ptr(
|
| pending_permission_requests_.Lookup(request_id));
|
| DCHECK(client_ptr.get());
|
| @@ -551,17 +549,16 @@
|
| broker->OnBrokerPermissionResult(client.get(), result);
|
| }
|
|
|
| -bool PepperPluginDelegateImpl::AsyncOpenFile(
|
| - const base::FilePath& path,
|
| - int flags,
|
| - const AsyncOpenFileCallback& callback) {
|
| +bool PepperHelperImpl::AsyncOpenFile(const base::FilePath& path,
|
| + int flags,
|
| + const AsyncOpenFileCallback& callback) {
|
| int message_id = pending_async_open_files_.Add(
|
| new AsyncOpenFileCallback(callback));
|
| return Send(new ViewHostMsg_AsyncOpenFile(
|
| routing_id(), path, flags, message_id));
|
| }
|
|
|
| -void PepperPluginDelegateImpl::OnAsyncFileOpened(
|
| +void PepperHelperImpl::OnAsyncFileOpened(
|
| base::PlatformFileError error_code,
|
| IPC::PlatformFileForTransit file_for_transit,
|
| int message_id) {
|
| @@ -583,25 +580,25 @@
|
| delete callback;
|
| }
|
|
|
| -void PepperPluginDelegateImpl::OnSetFocus(bool has_focus) {
|
| +void PepperHelperImpl::OnSetFocus(bool has_focus) {
|
| for (std::set<PepperPluginInstanceImpl*>::iterator i =
|
| active_instances_.begin();
|
| i != active_instances_.end(); ++i)
|
| (*i)->SetContentAreaFocus(has_focus);
|
| }
|
|
|
| -void PepperPluginDelegateImpl::PageVisibilityChanged(bool is_visible) {
|
| +void PepperHelperImpl::PageVisibilityChanged(bool is_visible) {
|
| for (std::set<PepperPluginInstanceImpl*>::iterator i =
|
| active_instances_.begin();
|
| i != active_instances_.end(); ++i)
|
| (*i)->PageVisibilityChanged(is_visible);
|
| }
|
|
|
| -bool PepperPluginDelegateImpl::IsPluginFocused() const {
|
| +bool PepperHelperImpl::IsPluginFocused() const {
|
| return focused_plugin_ != NULL;
|
| }
|
|
|
| -void PepperPluginDelegateImpl::WillHandleMouseEvent() {
|
| +void PepperHelperImpl::WillHandleMouseEvent() {
|
| // This method is called for every mouse event that the render view receives.
|
| // And then the mouse event is forwarded to WebKit, which dispatches it to the
|
| // event target. Potentially a Pepper plugin will receive the event.
|
| @@ -612,24 +609,24 @@
|
| last_mouse_event_target_ = NULL;
|
| }
|
|
|
| -void PepperPluginDelegateImpl::RegisterTCPSocket(
|
| +void PepperHelperImpl::RegisterTCPSocket(
|
| PPB_TCPSocket_Private_Impl* socket,
|
| uint32 socket_id) {
|
| tcp_sockets_.AddWithID(socket, socket_id);
|
| }
|
|
|
| -void PepperPluginDelegateImpl::UnregisterTCPSocket(uint32 socket_id) {
|
| +void PepperHelperImpl::UnregisterTCPSocket(uint32 socket_id) {
|
| // There is no DCHECK(tcp_sockets_.Lookup(socket_id)) because this method
|
| // can be called before TCPSocketConnect or TCPSocketConnectWithNetAddress.
|
| if (tcp_sockets_.Lookup(socket_id))
|
| tcp_sockets_.Remove(socket_id);
|
| }
|
|
|
| -void PepperPluginDelegateImpl::TCPServerSocketStopListening(uint32 socket_id) {
|
| +void PepperHelperImpl::TCPServerSocketStopListening(uint32 socket_id) {
|
| tcp_server_sockets_.Remove(socket_id);
|
| }
|
|
|
| -void PepperPluginDelegateImpl::HandleDocumentLoad(
|
| +void PepperHelperImpl::HandleDocumentLoad(
|
| PepperPluginInstanceImpl* instance,
|
| const WebKit::WebURLResponse& response) {
|
| DCHECK(!instance->document_loader());
|
| @@ -686,7 +683,7 @@
|
| }
|
| }
|
|
|
| -RendererPpapiHost* PepperPluginDelegateImpl::CreateExternalPluginModule(
|
| +RendererPpapiHost* PepperHelperImpl::CreateExternalPluginModule(
|
| scoped_refptr<PluginModule> module,
|
| const base::FilePath& path,
|
| ppapi::PpapiPermissions permissions,
|
| @@ -704,9 +701,8 @@
|
| true); // is_external = true
|
| }
|
|
|
| -void PepperPluginDelegateImpl::DidChangeCursor(
|
| - PepperPluginInstanceImpl* instance,
|
| - const WebKit::WebCursorInfo& cursor) {
|
| +void PepperHelperImpl::DidChangeCursor(PepperPluginInstanceImpl* instance,
|
| + const WebKit::WebCursorInfo& cursor) {
|
| // Update the cursor appearance immediately if the requesting plugin is the
|
| // one which receives the last mouse event. Otherwise, the new cursor won't be
|
| // picked up until the plugin gets the next input event. That is bad if, e.g.,
|
| @@ -716,23 +712,23 @@
|
| render_view_->didChangeCursor(cursor);
|
| }
|
|
|
| -void PepperPluginDelegateImpl::DidReceiveMouseEvent(
|
| +void PepperHelperImpl::DidReceiveMouseEvent(
|
| PepperPluginInstanceImpl* instance) {
|
| last_mouse_event_target_ = instance;
|
| }
|
|
|
| -void PepperPluginDelegateImpl::SampleGamepads(WebKit::WebGamepads* data) {
|
| +void PepperHelperImpl::SampleGamepads(WebKit::WebGamepads* data) {
|
| if (!gamepad_shared_memory_reader_)
|
| gamepad_shared_memory_reader_.reset(new GamepadSharedMemoryReader);
|
| gamepad_shared_memory_reader_->SampleGamepads(*data);
|
| }
|
|
|
| -bool PepperPluginDelegateImpl::OnMessageReceived(const IPC::Message& message) {
|
| +bool PepperHelperImpl::OnMessageReceived(const IPC::Message& message) {
|
| if (pepper_browser_connection_.OnMessageReceived(message))
|
| return true;
|
|
|
| bool handled = true;
|
| - IPC_BEGIN_MESSAGE_MAP(PepperPluginDelegateImpl, message)
|
| + IPC_BEGIN_MESSAGE_MAP(PepperHelperImpl, message)
|
| IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ConnectACK,
|
| OnTCPSocketConnectACK)
|
| IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SSLHandshakeACK,
|
| @@ -755,13 +751,13 @@
|
| return handled;
|
| }
|
|
|
| -void PepperPluginDelegateImpl::OnDestruct() {
|
| +void PepperHelperImpl::OnDestruct() {
|
| // Nothing to do here. Default implementation in RenderViewObserver does
|
| - // 'delete this' but it's not suitable for PepperPluginDelegateImpl because
|
| + // 'delete this' but it's not suitable for PepperHelperImpl because
|
| // it's non-pointer member in RenderViewImpl.
|
| }
|
|
|
| -void PepperPluginDelegateImpl::OnTCPSocketConnectACK(
|
| +void PepperHelperImpl::OnTCPSocketConnectACK(
|
| uint32 plugin_dispatcher_id,
|
| uint32 socket_id,
|
| int32_t result,
|
| @@ -774,7 +770,7 @@
|
| tcp_sockets_.Remove(socket_id);
|
| }
|
|
|
| -void PepperPluginDelegateImpl::OnTCPSocketSSLHandshakeACK(
|
| +void PepperHelperImpl::OnTCPSocketSSLHandshakeACK(
|
| uint32 plugin_dispatcher_id,
|
| uint32 socket_id,
|
| bool succeeded,
|
| @@ -784,24 +780,24 @@
|
| socket->OnSSLHandshakeCompleted(succeeded, certificate_fields);
|
| }
|
|
|
| -void PepperPluginDelegateImpl::OnTCPSocketReadACK(uint32 plugin_dispatcher_id,
|
| - uint32 socket_id,
|
| - int32_t result,
|
| - const std::string& data) {
|
| +void PepperHelperImpl::OnTCPSocketReadACK(uint32 plugin_dispatcher_id,
|
| + uint32 socket_id,
|
| + int32_t result,
|
| + const std::string& data) {
|
| PPB_TCPSocket_Private_Impl* socket = tcp_sockets_.Lookup(socket_id);
|
| if (socket)
|
| socket->OnReadCompleted(result, data);
|
| }
|
|
|
| -void PepperPluginDelegateImpl::OnTCPSocketWriteACK(uint32 plugin_dispatcher_id,
|
| - uint32 socket_id,
|
| - int32_t result) {
|
| +void PepperHelperImpl::OnTCPSocketWriteACK(uint32 plugin_dispatcher_id,
|
| + uint32 socket_id,
|
| + int32_t result) {
|
| PPB_TCPSocket_Private_Impl* socket = tcp_sockets_.Lookup(socket_id);
|
| if (socket)
|
| socket->OnWriteCompleted(result);
|
| }
|
|
|
| -void PepperPluginDelegateImpl::OnTCPSocketSetOptionACK(
|
| +void PepperHelperImpl::OnTCPSocketSetOptionACK(
|
| uint32 plugin_dispatcher_id,
|
| uint32 socket_id,
|
| int32_t result) {
|
| @@ -810,7 +806,7 @@
|
| socket->OnSetOptionCompleted(result);
|
| }
|
|
|
| -void PepperPluginDelegateImpl::OnTCPServerSocketListenACK(
|
| +void PepperHelperImpl::OnTCPServerSocketListenACK(
|
| uint32 plugin_dispatcher_id,
|
| PP_Resource socket_resource,
|
| uint32 socket_id,
|
| @@ -830,7 +826,7 @@
|
| }
|
| }
|
|
|
| -void PepperPluginDelegateImpl::OnTCPServerSocketAcceptACK(
|
| +void PepperHelperImpl::OnTCPServerSocketAcceptACK(
|
| uint32 plugin_dispatcher_id,
|
| uint32 server_socket_id,
|
| uint32 accepted_socket_id,
|
|
|