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

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

Issue 7471006: Revert 93223 - Reland http://codereview.chromium.org/7452002/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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/examples/2d/graphics_2d_example.c » ('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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 void Instance_DidChangeFocus(PP_Instance pp_instance, PP_Bool has_focus) { 103 void Instance_DidChangeFocus(PP_Instance pp_instance, PP_Bool has_focus) {
104 Module* module_singleton = Module::Get(); 104 Module* module_singleton = Module::Get();
105 if (!module_singleton) 105 if (!module_singleton)
106 return; 106 return;
107 Instance* instance = module_singleton->InstanceForPPInstance(pp_instance); 107 Instance* instance = module_singleton->InstanceForPPInstance(pp_instance);
108 if (!instance) 108 if (!instance)
109 return; 109 return;
110 instance->DidChangeFocus(PP_ToBool(has_focus)); 110 instance->DidChangeFocus(PP_ToBool(has_focus));
111 } 111 }
112 112
113 PP_Bool Instance_HandleInputEvent(PP_Instance pp_instance,
114 const PP_InputEvent* event) {
115 Module* module_singleton = Module::Get();
116 if (!module_singleton)
117 return PP_FALSE;
118 Instance* instance = module_singleton->InstanceForPPInstance(pp_instance);
119 if (!instance)
120 return PP_FALSE;
121 return PP_FromBool(instance->HandleInputEvent(*event));
122 }
123
113 PP_Bool Instance_HandleDocumentLoad(PP_Instance pp_instance, 124 PP_Bool Instance_HandleDocumentLoad(PP_Instance pp_instance,
114 PP_Resource pp_url_loader) { 125 PP_Resource pp_url_loader) {
115 Module* module_singleton = Module::Get(); 126 Module* module_singleton = Module::Get();
116 if (!module_singleton) 127 if (!module_singleton)
117 return PP_FALSE; 128 return PP_FALSE;
118 Instance* instance = module_singleton->InstanceForPPInstance(pp_instance); 129 Instance* instance = module_singleton->InstanceForPPInstance(pp_instance);
119 if (!instance) 130 if (!instance)
120 return PP_FALSE; 131 return PP_FALSE;
121 return PP_FromBool(instance->HandleDocumentLoad(URLLoader(pp_url_loader))); 132 return PP_FromBool(instance->HandleDocumentLoad(URLLoader(pp_url_loader)));
122 } 133 }
123 134
124 static PPP_Instance instance_interface = { 135 static PPP_Instance instance_interface = {
125 &Instance_DidCreate, 136 &Instance_DidCreate,
126 &Instance_DidDestroy, 137 &Instance_DidDestroy,
127 &Instance_DidChangeView, 138 &Instance_DidChangeView,
128 &Instance_DidChangeFocus, 139 &Instance_DidChangeFocus,
140 &Instance_HandleInputEvent,
129 &Instance_HandleDocumentLoad 141 &Instance_HandleDocumentLoad
130 }; 142 };
131 143
132 // PPP_Messaging implementation ------------------------------------------------ 144 // PPP_Messaging implementation ------------------------------------------------
133 145
134 void Messaging_HandleMessage(PP_Instance pp_instance, PP_Var var) { 146 void Messaging_HandleMessage(PP_Instance pp_instance, PP_Var var) {
135 Module* module_singleton = Module::Get(); 147 Module* module_singleton = Module::Get();
136 if (!module_singleton) 148 if (!module_singleton)
137 return; 149 return;
138 Instance* instance = module_singleton->InstanceForPPInstance(pp_instance); 150 Instance* instance = module_singleton->InstanceForPPInstance(pp_instance);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 const PPB_Core* core = reinterpret_cast<const PPB_Core*>(GetBrowserInterface( 222 const PPB_Core* core = reinterpret_cast<const PPB_Core*>(GetBrowserInterface(
211 PPB_CORE_INTERFACE)); 223 PPB_CORE_INTERFACE));
212 if (!core) 224 if (!core)
213 return false; 225 return false;
214 core_ = new Core(core); 226 core_ = new Core(core);
215 227
216 return Init(); 228 return Init();
217 } 229 }
218 230
219 } // namespace pp 231 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/instance.cc ('k') | ppapi/examples/2d/graphics_2d_example.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698