Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: ppapi/cpp/module.cc

Issue 7362012: Remove untrusted scripting support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merged Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/cpp/instance.cc ('k') | ppapi/cpp/private/instance_private.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 PP_Resource pp_url_loader) { 125 PP_Resource pp_url_loader) {
126 Module* module_singleton = Module::Get(); 126 Module* module_singleton = Module::Get();
127 if (!module_singleton) 127 if (!module_singleton)
128 return PP_FALSE; 128 return PP_FALSE;
129 Instance* instance = module_singleton->InstanceForPPInstance(pp_instance); 129 Instance* instance = module_singleton->InstanceForPPInstance(pp_instance);
130 if (!instance) 130 if (!instance)
131 return PP_FALSE; 131 return PP_FALSE;
132 return PP_FromBool(instance->HandleDocumentLoad(URLLoader(pp_url_loader))); 132 return PP_FromBool(instance->HandleDocumentLoad(URLLoader(pp_url_loader)));
133 } 133 }
134 134
135 #ifndef PPAPI_INSTANCE_REMOVE_SCRIPTING
136 PP_Var Instance_GetInstanceObject(PP_Instance pp_instance) {
137 Module* module_singleton = Module::Get();
138 if (!module_singleton)
139 return Var().Detach();
140 Instance* instance = module_singleton->InstanceForPPInstance(pp_instance);
141 if (!instance)
142 return Var().Detach();
143 return instance->GetInstanceObject().Detach();
144 }
145 #endif
146
147 static PPP_Instance instance_interface = { 135 static PPP_Instance instance_interface = {
148 &Instance_DidCreate, 136 &Instance_DidCreate,
149 &Instance_DidDestroy, 137 &Instance_DidDestroy,
150 &Instance_DidChangeView, 138 &Instance_DidChangeView,
151 &Instance_DidChangeFocus, 139 &Instance_DidChangeFocus,
152 &Instance_HandleInputEvent, 140 &Instance_HandleInputEvent,
153 &Instance_HandleDocumentLoad, 141 &Instance_HandleDocumentLoad
154 #ifndef PPAPI_INSTANCE_REMOVE_SCRIPTING
155 &Instance_GetInstanceObject
156 #endif
157 }; 142 };
158 143
159 // PPP_Messaging implementation ------------------------------------------------ 144 // PPP_Messaging implementation ------------------------------------------------
160 145
161 void Messaging_HandleMessage(PP_Instance pp_instance, PP_Var var) { 146 void Messaging_HandleMessage(PP_Instance pp_instance, PP_Var var) {
162 Module* module_singleton = Module::Get(); 147 Module* module_singleton = Module::Get();
163 if (!module_singleton) 148 if (!module_singleton)
164 return; 149 return;
165 Instance* instance = module_singleton->InstanceForPPInstance(pp_instance); 150 Instance* instance = module_singleton->InstanceForPPInstance(pp_instance);
166 if (!instance) 151 if (!instance)
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 const PPB_Core* core = reinterpret_cast<const PPB_Core*>(GetBrowserInterface( 222 const PPB_Core* core = reinterpret_cast<const PPB_Core*>(GetBrowserInterface(
238 PPB_CORE_INTERFACE)); 223 PPB_CORE_INTERFACE));
239 if (!core) 224 if (!core)
240 return false; 225 return false;
241 core_ = new Core(core); 226 core_ = new Core(core);
242 227
243 return Init(); 228 return Init();
244 } 229 }
245 230
246 } // namespace pp 231 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/instance.cc ('k') | ppapi/cpp/private/instance_private.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698