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

Side by Side Diff: webkit/plugins/ppapi/ppapi_plugin_instance.cc

Issue 11359063: Refactor the way singleton-style resources are exposed via PPB_Instance (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 base::Callback<const void*(const char*)> get_plugin_interface_func = 311 base::Callback<const void*(const char*)> get_plugin_interface_func =
312 base::Bind(&PluginModule::GetPluginInterface, module); 312 base::Bind(&PluginModule::GetPluginInterface, module);
313 PPP_Instance_Combined* ppp_instance_combined = 313 PPP_Instance_Combined* ppp_instance_combined =
314 PPP_Instance_Combined::Create(get_plugin_interface_func); 314 PPP_Instance_Combined::Create(get_plugin_interface_func);
315 if (!ppp_instance_combined) 315 if (!ppp_instance_combined)
316 return NULL; 316 return NULL;
317 return new PluginInstance(delegate, module, ppp_instance_combined); 317 return new PluginInstance(delegate, module, ppp_instance_combined);
318 } 318 }
319 319
320 PluginInstance::GamepadImpl::GamepadImpl(PluginDelegate* delegate) 320 PluginInstance::GamepadImpl::GamepadImpl(PluginDelegate* delegate)
321 : delegate_(delegate) { 321 : ::ppapi::Resource(::ppapi::Resource::Untracked()),
dmichael (off chromium) 2012/11/21 17:26:27 nit: using ppapi::Resource and using ppapi::thunk:
raymes 2012/11/21 20:59:10 Done.
322 delegate_(delegate) {
323 }
324
325 ::ppapi::thunk::PPB_Gamepad_API*
326 PluginInstance::GamepadImpl::AsPPB_Gamepad_API() {
327 return this;
322 } 328 }
323 329
324 void PluginInstance::GamepadImpl::Sample(PP_GamepadsSampleData* data) { 330 void PluginInstance::GamepadImpl::Sample(PP_GamepadsSampleData* data) {
325 WebKit::WebGamepads webkit_data; 331 WebKit::WebGamepads webkit_data;
326 delegate_->SampleGamepads(&webkit_data); 332 delegate_->SampleGamepads(&webkit_data);
327 ConvertWebKitGamepadData( 333 ConvertWebKitGamepadData(
328 *reinterpret_cast<const ::ppapi::WebKitGamepads*>(&webkit_data), data); 334 *reinterpret_cast<const ::ppapi::WebKitGamepads*>(&webkit_data), data);
329 } 335 }
330 336
331 PluginInstance::PluginInstance( 337 PluginInstance::PluginInstance(
(...skipping 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after
2106 PP_Bool PluginInstance::GetScreenSize(PP_Instance instance, PP_Size* size) { 2112 PP_Bool PluginInstance::GetScreenSize(PP_Instance instance, PP_Size* size) {
2107 gfx::Size screen_size = delegate()->GetScreenSize(); 2113 gfx::Size screen_size = delegate()->GetScreenSize();
2108 *size = PP_MakeSize(screen_size.width(), screen_size.height()); 2114 *size = PP_MakeSize(screen_size.width(), screen_size.height());
2109 return PP_TRUE; 2115 return PP_TRUE;
2110 } 2116 }
2111 2117
2112 ::ppapi::thunk::PPB_Flash_API* PluginInstance::GetFlashAPI() { 2118 ::ppapi::thunk::PPB_Flash_API* PluginInstance::GetFlashAPI() {
2113 return &flash_impl_; 2119 return &flash_impl_;
2114 } 2120 }
2115 2121
2116 ::ppapi::thunk::PPB_Flash_Clipboard_API* 2122 ::ppapi::Resource* PluginInstance::GetSingletonResource(
2117 PluginInstance::GetFlashClipboardAPI(PP_Instance /*instance*/) { 2123 PP_Instance instance,
2118 NOTIMPLEMENTED(); 2124 ::ppapi::SingletonResourceID id) {
2125 // Flash APIs aren't implemented in-process.
2126 switch (id) {
2127 case ::ppapi::FLASH_SINGLETON_ID:
2128 NOTIMPLEMENTED();
2129 return NULL;
2130 case ::ppapi::FLASH_CLIPBOARD_SINGLETON_ID:
2131 NOTIMPLEMENTED();
2132 return NULL;
2133 case ::ppapi::GAMEPAD_SINGLETON_ID:
2134 return &gamepad_impl_;
2135 }
2136
2137 NOTREACHED();
2119 return NULL; 2138 return NULL;
2120 } 2139 }
2121 2140
2122 ::ppapi::thunk::PPB_Flash_Functions_API*
2123 PluginInstance::GetFlashFunctionsAPI(PP_Instance /*instance*/) {
2124 NOTIMPLEMENTED();
2125 return NULL;
2126 }
2127
2128 ::ppapi::thunk::PPB_Gamepad_API* PluginInstance::GetGamepadAPI(
2129 PP_Instance /* instance */) {
2130 return &gamepad_impl_;
2131 }
2132
2133 int32_t PluginInstance::RequestInputEvents(PP_Instance instance, 2141 int32_t PluginInstance::RequestInputEvents(PP_Instance instance,
2134 uint32_t event_classes) { 2142 uint32_t event_classes) {
2135 input_event_mask_ |= event_classes; 2143 input_event_mask_ |= event_classes;
2136 filtered_input_event_mask_ &= ~(event_classes); 2144 filtered_input_event_mask_ &= ~(event_classes);
2137 if (event_classes & PP_INPUTEVENT_CLASS_TOUCH) 2145 if (event_classes & PP_INPUTEVENT_CLASS_TOUCH)
2138 container_->setIsAcceptingTouchEvents(IsAcceptingTouchEvents()); 2146 container_->setIsAcceptingTouchEvents(IsAcceptingTouchEvents());
2139 return ValidateRequestInputEvents(false, event_classes); 2147 return ValidateRequestInputEvents(false, event_classes);
2140 } 2148 }
2141 2149
2142 int32_t PluginInstance::RequestFilteringInputEvents(PP_Instance instance, 2150 int32_t PluginInstance::RequestFilteringInputEvents(PP_Instance instance,
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
2470 screen_size_for_fullscreen_ = gfx::Size(); 2478 screen_size_for_fullscreen_ = gfx::Size();
2471 WebElement element = container_->element(); 2479 WebElement element = container_->element();
2472 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); 2480 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_);
2473 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); 2481 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_);
2474 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); 2482 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_);
2475 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); 2483 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_);
2476 } 2484 }
2477 2485
2478 } // namespace ppapi 2486 } // namespace ppapi
2479 } // namespace webkit 2487 } // namespace webkit
OLDNEW
« ppapi/proxy/ppb_instance_proxy.cc ('K') | « webkit/plugins/ppapi/ppapi_plugin_instance.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698