| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 The Native Client 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 #ifndef NATIVE_CLIENT_TESTS_FAKE_BROWSER_PPAPI_FAKE_INSTANCE_H_ | |
| 6 #define NATIVE_CLIENT_TESTS_FAKE_BROWSER_PPAPI_FAKE_INSTANCE_H_ | |
| 7 | |
| 8 #include "native_client/src/include/nacl_macros.h" | |
| 9 #include "ppapi/c/pp_module.h" | |
| 10 #include "ppapi/c/ppb_instance.h" | |
| 11 | |
| 12 struct PPB_Instance_Private; | |
| 13 | |
| 14 namespace fake_browser_ppapi { | |
| 15 | |
| 16 class FakeWindow; | |
| 17 class Host; | |
| 18 | |
| 19 // Implements the PPB_Instance interface. | |
| 20 class Instance { | |
| 21 public: | |
| 22 // You must call set_window to complete initialization. | |
| 23 Instance() : instance_id_(0), window_(NULL) {} | |
| 24 virtual ~Instance() {} | |
| 25 | |
| 26 void set_window(FakeWindow* window) { window_ = window; } | |
| 27 | |
| 28 void set_instance_id(PP_Instance instance_id) { instance_id_ = instance_id; } | |
| 29 PP_Instance instance_id() const { return instance_id_; } | |
| 30 | |
| 31 // The bindings for the methods invoked by the PPAPI interface. | |
| 32 virtual PP_Var GetWindowObject(); | |
| 33 virtual PP_Var GetOwnerElementObject(); | |
| 34 virtual bool BindGraphics(PP_Resource device); | |
| 35 virtual bool IsFullFrame(); | |
| 36 virtual PP_Var ExecuteScript(PP_Var script, | |
| 37 PP_Var* exception); | |
| 38 static const PPB_Instance* GetInterface(); | |
| 39 static const PPB_Instance_Private* GetPrivateInterface(); | |
| 40 static Instance* Invalid() { return &kInvalidInstance; } | |
| 41 private: | |
| 42 static Instance kInvalidInstance; | |
| 43 PP_Instance instance_id_; | |
| 44 FakeWindow* window_; | |
| 45 NACL_DISALLOW_COPY_AND_ASSIGN(Instance); | |
| 46 }; | |
| 47 | |
| 48 // These are made global so that C API functions can access them from any file. | |
| 49 // To be implemented by main.cc. | |
| 50 PP_Instance TrackInstance(Instance* instance); | |
| 51 // Returns Instance::Invalid() on error. | |
| 52 Instance* GetInstance(PP_Instance instance_id); | |
| 53 | |
| 54 } // namespace fake_browser_ppapi | |
| 55 | |
| 56 #endif // NATIVE_CLIENT_TESTS_FAKE_BROWSER_PPAPI_FAKE_INSTANCE_H_ | |
| OLD | NEW |