| 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/flash_resource.h" | 5 #include "ppapi/proxy/flash_resource.h" |
| 6 | 6 |
| 7 #include "ppapi/c/pp_errors.h" | 7 #include "ppapi/c/pp_errors.h" |
| 8 #include "ppapi/c/private/ppb_flash.h" | 8 #include "ppapi/c/private/ppb_flash.h" |
| 9 #include "ppapi/proxy/plugin_dispatcher.h" |
| 9 #include "ppapi/proxy/plugin_globals.h" | 10 #include "ppapi/proxy/plugin_globals.h" |
| 10 #include "ppapi/proxy/ppapi_messages.h" | 11 #include "ppapi/proxy/ppapi_messages.h" |
| 12 #include "ppapi/shared_impl/ppapi_preferences.h" |
| 13 #include "ppapi/shared_impl/scoped_pp_var.h" |
| 11 #include "ppapi/shared_impl/var.h" | 14 #include "ppapi/shared_impl/var.h" |
| 15 #include "ppapi/thunk/enter.h" |
| 12 | 16 |
| 13 namespace ppapi { | 17 namespace ppapi { |
| 14 namespace proxy { | 18 namespace proxy { |
| 15 | 19 |
| 16 FlashResource::FlashResource(Connection connection, PP_Instance instance) | 20 FlashResource::FlashResource(Connection connection, |
| 17 : PluginResource(connection, instance) { | 21 PP_Instance instance, |
| 22 PluginDispatcher* plugin_dispatcher) |
| 23 : PluginResource(connection, instance), |
| 24 plugin_dispatcher_(plugin_dispatcher) { |
| 18 SendCreate(RENDERER, PpapiHostMsg_Flash_Create()); | 25 SendCreate(RENDERER, PpapiHostMsg_Flash_Create()); |
| 19 SendCreate(BROWSER, PpapiHostMsg_Flash_Create()); | 26 SendCreate(BROWSER, PpapiHostMsg_Flash_Create()); |
| 20 } | 27 } |
| 21 | 28 |
| 22 FlashResource::~FlashResource() { | 29 FlashResource::~FlashResource() { |
| 23 } | 30 } |
| 24 | 31 |
| 25 thunk::PPB_Flash_Functions_API* FlashResource::AsPPB_Flash_Functions_API() { | 32 thunk::PPB_Flash_Functions_API* FlashResource::AsPPB_Flash_Functions_API() { |
| 26 return this; | 33 return this; |
| 27 } | 34 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 49 StringVar* url_string_var(StringVar::FromPPVar(value)); | 56 StringVar* url_string_var(StringVar::FromPPVar(value)); |
| 50 if (!url_string_var) | 57 if (!url_string_var) |
| 51 return PP_FALSE; | 58 return PP_FALSE; |
| 52 PluginGlobals::Get()->SetActiveURL(url_string_var->value()); | 59 PluginGlobals::Get()->SetActiveURL(url_string_var->value()); |
| 53 return PP_TRUE; | 60 return PP_TRUE; |
| 54 } | 61 } |
| 55 } | 62 } |
| 56 return PP_FALSE; | 63 return PP_FALSE; |
| 57 } | 64 } |
| 58 | 65 |
| 66 PP_Var FlashResource::GetSetting(PP_Instance instance, |
| 67 PP_FlashSetting setting) { |
| 68 switch (setting) { |
| 69 case PP_FLASHSETTING_3DENABLED: |
| 70 return PP_MakeBool(PP_FromBool( |
| 71 plugin_dispatcher_->preferences().is_3d_supported)); |
| 72 case PP_FLASHSETTING_INCOGNITO: |
| 73 return PP_MakeBool(PP_FromBool(plugin_dispatcher_->incognito())); |
| 74 case PP_FLASHSETTING_STAGE3DENABLED: |
| 75 return PP_MakeBool(PP_FromBool( |
| 76 plugin_dispatcher_->preferences().is_stage3d_supported)); |
| 77 case PP_FLASHSETTING_LANGUAGE: |
| 78 return StringVar::StringToPPVar( |
| 79 PluginGlobals::Get()->GetUILanguage()); |
| 80 case PP_FLASHSETTING_NUMCORES: |
| 81 return PP_MakeInt32( |
| 82 plugin_dispatcher_->preferences().number_of_cpu_cores); |
| 83 case PP_FLASHSETTING_LSORESTRICTIONS: { |
| 84 int32_t restrictions; |
| 85 int32_t result = |
| 86 SyncCall<PpapiPluginMsg_Flash_GetLocalDataRestrictionsReply>(BROWSER, |
| 87 PpapiHostMsg_Flash_GetLocalDataRestrictions(), &restrictions); |
| 88 if (result != PP_OK) |
| 89 return PP_MakeInt32(PP_FLASHLSORESTRICTIONS_NONE); |
| 90 return PP_MakeInt32(restrictions); |
| 91 } |
| 92 } |
| 93 return PP_MakeUndefined(); |
| 94 } |
| 95 |
| 59 } // namespace proxy | 96 } // namespace proxy |
| 60 } // namespace ppapi | 97 } // namespace ppapi |
| OLD | NEW |