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
3 // found in the LICENSE file.
5 #include "content/renderer/pepper/mock_renderer_ppapi_host.h"
7 #include "content/renderer/pepper/fake_pepper_plugin_instance.h"
8 #include "ui/gfx/point.h"
12 MockRendererPpapiHost::MockRendererPpapiHost(RenderView
* render_view
,
15 ppapi_host_(&sink_
, ppapi::PpapiPermissions()),
16 render_view_(render_view
),
17 pp_instance_(instance
),
18 has_user_gesture_(false),
19 plugin_instance_(new FakePepperPluginInstance
) {}
21 MockRendererPpapiHost::~MockRendererPpapiHost() {}
23 ppapi::host::PpapiHost
* MockRendererPpapiHost::GetPpapiHost() {
27 bool MockRendererPpapiHost::IsValidInstance(PP_Instance instance
) const {
28 return instance
== pp_instance_
;
31 PepperPluginInstance
* MockRendererPpapiHost::GetPluginInstance(
32 PP_Instance instance
) const {
33 return plugin_instance_
.get();
36 RenderFrame
* MockRendererPpapiHost::GetRenderFrameForInstance(
37 PP_Instance instance
) const {
41 RenderView
* MockRendererPpapiHost::GetRenderViewForInstance(
42 PP_Instance instance
) const {
43 if (instance
== pp_instance_
)
48 blink::WebPluginContainer
* MockRendererPpapiHost::GetContainerForInstance(
49 PP_Instance instance
) const {
54 base::ProcessId
MockRendererPpapiHost::GetPluginPID() const {
56 return base::kNullProcessId
;
59 bool MockRendererPpapiHost::HasUserGesture(PP_Instance instance
) const {
60 return has_user_gesture_
;
63 int MockRendererPpapiHost::GetRoutingIDForWidget(PP_Instance instance
) const {
67 gfx::Point
MockRendererPpapiHost::PluginPointToRenderFrame(
69 const gfx::Point
& pt
) const {
73 IPC::PlatformFileForTransit
MockRendererPpapiHost::ShareHandleWithRemote(
74 base::PlatformFile handle
,
75 bool should_close_source
) {
77 return IPC::InvalidPlatformFileForTransit();
80 bool MockRendererPpapiHost::IsRunningInProcess() const { return false; }
82 std::string
MockRendererPpapiHost::GetPluginName() const {
86 void MockRendererPpapiHost::SetToExternalPluginHost() {
90 void MockRendererPpapiHost::CreateBrowserResourceHosts(
92 const std::vector
<IPC::Message
>& nested_msgs
,
93 const base::Callback
<void(const std::vector
<int>&)>& callback
) const {
94 callback
.Run(std::vector
<int>(nested_msgs
.size(), 0));
98 GURL
MockRendererPpapiHost::GetDocumentURL(PP_Instance instance
) const {
103 } // namespace content