Home | History | Annotate | Download | only in pepper
      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.
      4 
      5 #include "content/renderer/pepper/mock_renderer_ppapi_host.h"
      6 
      7 #include "ui/gfx/point.h"
      8 
      9 namespace content {
     10 
     11 MockRendererPpapiHost::MockRendererPpapiHost(RenderView* render_view,
     12                                              PP_Instance instance)
     13     : sink_(),
     14       ppapi_host_(&sink_, ppapi::PpapiPermissions()),
     15       render_view_(render_view),
     16       pp_instance_(instance),
     17       has_user_gesture_(false) {
     18 }
     19 
     20 MockRendererPpapiHost::~MockRendererPpapiHost() {
     21 }
     22 
     23 ppapi::host::PpapiHost* MockRendererPpapiHost::GetPpapiHost() {
     24   return &ppapi_host_;
     25 }
     26 
     27 bool MockRendererPpapiHost::IsValidInstance(PP_Instance instance) const {
     28   return instance == pp_instance_;
     29 }
     30 
     31 PepperPluginInstance* MockRendererPpapiHost::GetPluginInstance(
     32     PP_Instance instance) const {
     33   NOTIMPLEMENTED();
     34   return NULL;
     35 }
     36 
     37 RenderView* MockRendererPpapiHost::GetRenderViewForInstance(
     38     PP_Instance instance) const {
     39   if (instance == pp_instance_)
     40     return render_view_;
     41   return NULL;
     42 }
     43 
     44 WebKit::WebPluginContainer* MockRendererPpapiHost::GetContainerForInstance(
     45     PP_Instance instance) const {
     46   NOTIMPLEMENTED();
     47   return NULL;
     48 }
     49 
     50 base::ProcessId MockRendererPpapiHost::GetPluginPID() const {
     51   NOTIMPLEMENTED();
     52   return base::kNullProcessId;
     53 }
     54 
     55 bool MockRendererPpapiHost::HasUserGesture(PP_Instance instance) const {
     56   return has_user_gesture_;
     57 }
     58 
     59 int MockRendererPpapiHost::GetRoutingIDForWidget(PP_Instance instance) const {
     60   return 0;
     61 }
     62 
     63 gfx::Point MockRendererPpapiHost::PluginPointToRenderView(
     64     PP_Instance instance,
     65     const gfx::Point& pt) const {
     66   return gfx::Point();
     67 }
     68 
     69 IPC::PlatformFileForTransit MockRendererPpapiHost::ShareHandleWithRemote(
     70     base::PlatformFile handle,
     71     bool should_close_source) {
     72   NOTIMPLEMENTED();
     73   return IPC::InvalidPlatformFileForTransit();
     74 }
     75 
     76 bool MockRendererPpapiHost::IsRunningInProcess() const {
     77   NOTIMPLEMENTED();
     78   return false;
     79 }
     80 
     81 void MockRendererPpapiHost::CreateBrowserResourceHost(
     82     PP_Instance instance,
     83     const IPC::Message& nested_msg,
     84     const base::Callback<void(int)>& callback) const {
     85   NOTIMPLEMENTED();
     86   callback.Run(0);
     87   return;
     88 }
     89 
     90 }  // namespace content
     91