OLD | NEW |
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 "ppapi/proxy/ppb_instance_proxy.h" | 5 #include "ppapi/proxy/ppb_instance_proxy.h" |
6 | 6 |
7 #include "ppapi/c/pp_errors.h" | 7 #include "ppapi/c/pp_errors.h" |
8 #include "ppapi/c/pp_var.h" | 8 #include "ppapi/c/pp_var.h" |
9 #include "ppapi/c/ppb_instance.h" | 9 #include "ppapi/c/ppb_instance.h" |
10 #include "ppapi/c/ppb_messaging.h" | 10 #include "ppapi/c/ppb_messaging.h" |
11 #include "ppapi/c/ppb_mouse_lock.h" | 11 #include "ppapi/c/ppb_mouse_lock.h" |
12 #include "ppapi/proxy/enter_proxy.h" | 12 #include "ppapi/proxy/enter_proxy.h" |
13 #include "ppapi/proxy/host_dispatcher.h" | 13 #include "ppapi/proxy/host_dispatcher.h" |
14 #include "ppapi/proxy/plugin_dispatcher.h" | 14 #include "ppapi/proxy/plugin_dispatcher.h" |
| 15 #include "ppapi/proxy/plugin_proxy_delegate.h" |
15 #include "ppapi/proxy/ppapi_messages.h" | 16 #include "ppapi/proxy/ppapi_messages.h" |
16 #include "ppapi/proxy/serialized_var.h" | 17 #include "ppapi/proxy/serialized_var.h" |
17 #include "ppapi/shared_impl/ppapi_globals.h" | 18 #include "ppapi/shared_impl/ppapi_globals.h" |
18 #include "ppapi/shared_impl/ppb_url_util_shared.h" | 19 #include "ppapi/shared_impl/ppb_url_util_shared.h" |
19 #include "ppapi/shared_impl/ppb_view_shared.h" | 20 #include "ppapi/shared_impl/ppb_view_shared.h" |
| 21 #include "ppapi/shared_impl/var.h" |
20 #include "ppapi/thunk/enter.h" | 22 #include "ppapi/thunk/enter.h" |
21 #include "ppapi/thunk/thunk.h" | 23 #include "ppapi/thunk/thunk.h" |
22 | 24 |
23 // Windows headers interfere with this file. | 25 // Windows headers interfere with this file. |
24 #ifdef PostMessage | 26 #ifdef PostMessage |
25 #undef PostMessage | 27 #undef PostMessage |
26 #endif | 28 #endif |
27 | 29 |
28 using ppapi::thunk::EnterFunctionNoLock; | 30 using ppapi::thunk::EnterFunctionNoLock; |
29 using ppapi::thunk::EnterResourceNoLock; | 31 using ppapi::thunk::EnterResourceNoLock; |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 } | 208 } |
207 | 209 |
208 PP_Bool PPB_Instance_Proxy::FlashIsFullscreen(PP_Instance instance) { | 210 PP_Bool PPB_Instance_Proxy::FlashIsFullscreen(PP_Instance instance) { |
209 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> | 211 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> |
210 GetInstanceData(instance); | 212 GetInstanceData(instance); |
211 if (!data) | 213 if (!data) |
212 return PP_FALSE; | 214 return PP_FALSE; |
213 return data->flash_fullscreen; | 215 return data->flash_fullscreen; |
214 } | 216 } |
215 | 217 |
| 218 PP_Var PPB_Instance_Proxy::GetFontFamilies(PP_Instance instance) { |
| 219 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
| 220 if (!dispatcher) |
| 221 return PP_MakeUndefined(); |
| 222 |
| 223 // Assume the font families don't change, so we can cache the result globally. |
| 224 CR_DEFINE_STATIC_LOCAL(std::string, families, ()); |
| 225 if (families.empty()) { |
| 226 PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser( |
| 227 new PpapiHostMsg_PPBInstance_GetFontFamilies(&families)); |
| 228 } |
| 229 |
| 230 return StringVar::StringToPPVar(families); |
| 231 } |
| 232 |
216 PP_Bool PPB_Instance_Proxy::SetFullscreen(PP_Instance instance, | 233 PP_Bool PPB_Instance_Proxy::SetFullscreen(PP_Instance instance, |
217 PP_Bool fullscreen) { | 234 PP_Bool fullscreen) { |
218 PP_Bool result = PP_FALSE; | 235 PP_Bool result = PP_FALSE; |
219 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SetFullscreen( | 236 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SetFullscreen( |
220 API_ID_PPB_INSTANCE, instance, fullscreen, &result)); | 237 API_ID_PPB_INSTANCE, instance, fullscreen, &result)); |
221 return result; | 238 return result; |
222 } | 239 } |
223 | 240 |
224 PP_Bool PPB_Instance_Proxy::FlashSetFullscreen(PP_Instance instance, | 241 PP_Bool PPB_Instance_Proxy::FlashSetFullscreen(PP_Instance instance, |
225 PP_Bool fullscreen) { | 242 PP_Bool fullscreen) { |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 } | 594 } |
578 | 595 |
579 void PPB_Instance_Proxy::MouseLockCompleteInHost(int32_t result, | 596 void PPB_Instance_Proxy::MouseLockCompleteInHost(int32_t result, |
580 PP_Instance instance) { | 597 PP_Instance instance) { |
581 dispatcher()->Send(new PpapiMsg_PPBInstance_MouseLockComplete( | 598 dispatcher()->Send(new PpapiMsg_PPBInstance_MouseLockComplete( |
582 API_ID_PPB_INSTANCE, instance, result)); | 599 API_ID_PPB_INSTANCE, instance, result)); |
583 } | 600 } |
584 | 601 |
585 } // namespace proxy | 602 } // namespace proxy |
586 } // namespace ppapi | 603 } // namespace ppapi |
OLD | NEW |