| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // Note that the single accessor, Module::Get(), is not actually implemented | 5 // Note that the single accessor, Module::Get(), is not actually implemented |
| 6 // in this file. This is an intentional hook that allows users of ppapi's | 6 // in this file. This is an intentional hook that allows users of ppapi's |
| 7 // C++ wrapper objects to provide difference semantics for how the singleton | 7 // C++ wrapper objects to provide difference semantics for how the singleton |
| 8 // object is accessed. | 8 // object is accessed. |
| 9 // | 9 // |
| 10 // In general, users of ppapi will also link in ppp_entrypoints.cc, which | 10 // In general, users of ppapi will also link in ppp_entrypoints.cc, which |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // implementing such behavior. | 22 // implementing such behavior. |
| 23 | 23 |
| 24 #include "ppapi/cpp/module.h" | 24 #include "ppapi/cpp/module.h" |
| 25 | 25 |
| 26 #include <string.h> | 26 #include <string.h> |
| 27 | 27 |
| 28 #include "ppapi/c/pp_instance.h" | 28 #include "ppapi/c/pp_instance.h" |
| 29 #include "ppapi/c/pp_var.h" | 29 #include "ppapi/c/pp_var.h" |
| 30 #include "ppapi/c/ppp_instance.h" | 30 #include "ppapi/c/ppp_instance.h" |
| 31 #include "ppapi/cpp/common.h" | 31 #include "ppapi/cpp/common.h" |
| 32 #include "ppapi/cpp/dev/url_loader_dev.h" | 32 #include "ppapi/cpp/url_loader.h" |
| 33 #include "ppapi/cpp/instance.h" | 33 #include "ppapi/cpp/instance.h" |
| 34 #include "ppapi/cpp/rect.h" | 34 #include "ppapi/cpp/rect.h" |
| 35 #include "ppapi/cpp/resource.h" | 35 #include "ppapi/cpp/resource.h" |
| 36 #include "ppapi/cpp/var.h" | 36 #include "ppapi/cpp/var.h" |
| 37 | 37 |
| 38 namespace pp { | 38 namespace pp { |
| 39 | 39 |
| 40 // PPP_Instance implementation ------------------------------------------------- | 40 // PPP_Instance implementation ------------------------------------------------- |
| 41 | 41 |
| 42 PP_Bool Instance_DidCreate(PP_Instance pp_instance, | 42 PP_Bool Instance_DidCreate(PP_Instance pp_instance, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 104 |
| 105 PP_Bool Instance_HandleDocumentLoad(PP_Instance pp_instance, | 105 PP_Bool Instance_HandleDocumentLoad(PP_Instance pp_instance, |
| 106 PP_Resource pp_url_loader) { | 106 PP_Resource pp_url_loader) { |
| 107 Module* module_singleton = Module::Get(); | 107 Module* module_singleton = Module::Get(); |
| 108 if (!module_singleton) | 108 if (!module_singleton) |
| 109 return PP_FALSE; | 109 return PP_FALSE; |
| 110 Instance* instance = module_singleton->InstanceForPPInstance(pp_instance); | 110 Instance* instance = module_singleton->InstanceForPPInstance(pp_instance); |
| 111 if (!instance) | 111 if (!instance) |
| 112 return PP_FALSE; | 112 return PP_FALSE; |
| 113 return BoolToPPBool( | 113 return BoolToPPBool( |
| 114 instance->HandleDocumentLoad(URLLoader_Dev(pp_url_loader))); | 114 instance->HandleDocumentLoad(URLLoader(pp_url_loader))); |
| 115 } | 115 } |
| 116 | 116 |
| 117 PP_Var Instance_GetInstanceObject(PP_Instance pp_instance) { | 117 PP_Var Instance_GetInstanceObject(PP_Instance pp_instance) { |
| 118 Module* module_singleton = Module::Get(); | 118 Module* module_singleton = Module::Get(); |
| 119 if (!module_singleton) | 119 if (!module_singleton) |
| 120 return Var().Detach(); | 120 return Var().Detach(); |
| 121 Instance* instance = module_singleton->InstanceForPPInstance(pp_instance); | 121 Instance* instance = module_singleton->InstanceForPPInstance(pp_instance); |
| 122 if (!instance) | 122 if (!instance) |
| 123 return Var().Detach(); | 123 return Var().Detach(); |
| 124 return instance->GetInstanceObject().Detach(); | 124 return instance->GetInstanceObject().Detach(); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 const PPB_Core* core = reinterpret_cast<const PPB_Core*>(GetBrowserInterface( | 191 const PPB_Core* core = reinterpret_cast<const PPB_Core*>(GetBrowserInterface( |
| 192 PPB_CORE_INTERFACE)); | 192 PPB_CORE_INTERFACE)); |
| 193 if (!core) | 193 if (!core) |
| 194 return false; | 194 return false; |
| 195 core_ = new Core(core); | 195 core_ = new Core(core); |
| 196 | 196 |
| 197 return Init(); | 197 return Init(); |
| 198 } | 198 } |
| 199 | 199 |
| 200 } // namespace pp | 200 } // namespace pp |
| OLD | NEW |