| 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_flash_proxy.h" | 5 #include "ppapi/proxy/ppb_flash_proxy.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_CreateDir, | 417 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_CreateDir, |
| 418 OnHostMsgCreateDir) | 418 OnHostMsgCreateDir) |
| 419 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_QueryFile, | 419 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_QueryFile, |
| 420 OnHostMsgQueryFile) | 420 OnHostMsgQueryFile) |
| 421 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetDirContents, | 421 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetDirContents, |
| 422 OnHostMsgGetDirContents) | 422 OnHostMsgGetDirContents) |
| 423 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_OpenFileRef, | 423 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_OpenFileRef, |
| 424 OnHostMsgOpenFileRef) | 424 OnHostMsgOpenFileRef) |
| 425 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_QueryFileRef, | 425 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_QueryFileRef, |
| 426 OnHostMsgQueryFileRef) | 426 OnHostMsgQueryFileRef) |
| 427 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetDeviceID, |
| 428 OnHostMsgGetDeviceID) |
| 427 IPC_MESSAGE_UNHANDLED(handled = false) | 429 IPC_MESSAGE_UNHANDLED(handled = false) |
| 428 IPC_END_MESSAGE_MAP() | 430 IPC_END_MESSAGE_MAP() |
| 429 // TODO(brettw) handle bad messages! | 431 // TODO(brettw) handle bad messages! |
| 430 return handled; | 432 return handled; |
| 431 } | 433 } |
| 432 | 434 |
| 433 void PPB_Flash_Proxy::SetInstanceAlwaysOnTop(PP_Instance instance, | 435 void PPB_Flash_Proxy::SetInstanceAlwaysOnTop(PP_Instance instance, |
| 434 PP_Bool on_top) { | 436 PP_Bool on_top) { |
| 435 dispatcher()->Send(new PpapiHostMsg_PPBFlash_SetInstanceAlwaysOnTop( | 437 dispatcher()->Send(new PpapiHostMsg_PPBFlash_SetInstanceAlwaysOnTop( |
| 436 API_ID_PPB_FLASH, instance, on_top)); | 438 API_ID_PPB_FLASH, instance, on_top)); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 int32_t PPB_Flash_Proxy::InvokePrinting(PP_Instance instance) { | 544 int32_t PPB_Flash_Proxy::InvokePrinting(PP_Instance instance) { |
| 543 return PP_ERROR_NOTSUPPORTED; | 545 return PP_ERROR_NOTSUPPORTED; |
| 544 } | 546 } |
| 545 | 547 |
| 546 void PPB_Flash_Proxy::UpdateActivity(PP_Instance instance) { | 548 void PPB_Flash_Proxy::UpdateActivity(PP_Instance instance) { |
| 547 PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser( | 549 PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser( |
| 548 new PpapiHostMsg_PPBFlash_UpdateActivity(API_ID_PPB_FLASH)); | 550 new PpapiHostMsg_PPBFlash_UpdateActivity(API_ID_PPB_FLASH)); |
| 549 } | 551 } |
| 550 | 552 |
| 551 PP_Var PPB_Flash_Proxy::GetDeviceID(PP_Instance instance) { | 553 PP_Var PPB_Flash_Proxy::GetDeviceID(PP_Instance instance) { |
| 552 std::string id; | 554 ReceiveSerializedVarReturnValue result; |
| 553 PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser( | 555 dispatcher()->Send(new PpapiHostMsg_PPBFlash_GetDeviceID( |
| 554 new PpapiHostMsg_PPBFlash_GetDeviceID(API_ID_PPB_FLASH, &id)); | 556 API_ID_PPB_FLASH, instance, &result)); |
| 555 return StringVar::StringToPPVar(id); | 557 return result.Return(dispatcher()); |
| 556 } | 558 } |
| 557 | 559 |
| 558 int32_t PPB_Flash_Proxy::GetSettingInt(PP_Instance instance, | 560 int32_t PPB_Flash_Proxy::GetSettingInt(PP_Instance instance, |
| 559 PP_FlashSetting setting) { | 561 PP_FlashSetting setting) { |
| 560 switch (setting) { | 562 switch (setting) { |
| 561 case PP_FLASHSETTING_3DENABLED: | 563 case PP_FLASHSETTING_3DENABLED: |
| 562 return static_cast<PluginDispatcher*>(dispatcher())->preferences(). | 564 return static_cast<PluginDispatcher*>(dispatcher())->preferences(). |
| 563 is_3d_supported; | 565 is_3d_supported; |
| 564 case PP_FLASHSETTING_INCOGNITO: | 566 case PP_FLASHSETTING_INCOGNITO: |
| 565 return static_cast<PluginDispatcher*>(dispatcher())->incognito(); | 567 return static_cast<PluginDispatcher*>(dispatcher())->incognito(); |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 int32_t* result) { | 1134 int32_t* result) { |
| 1133 EnterInstanceNoLock enter(instance); | 1135 EnterInstanceNoLock enter(instance); |
| 1134 if (enter.failed()) { | 1136 if (enter.failed()) { |
| 1135 *result = PP_ERROR_BADARGUMENT; | 1137 *result = PP_ERROR_BADARGUMENT; |
| 1136 return; | 1138 return; |
| 1137 } | 1139 } |
| 1138 *result = enter.functions()->GetFlashAPI()->QueryFileRef( | 1140 *result = enter.functions()->GetFlashAPI()->QueryFileRef( |
| 1139 instance, host_resource.host_resource(), info); | 1141 instance, host_resource.host_resource(), info); |
| 1140 } | 1142 } |
| 1141 | 1143 |
| 1144 void PPB_Flash_Proxy::OnHostMsgGetDeviceID(PP_Instance instance, |
| 1145 SerializedVarReturnValue id) { |
| 1146 EnterInstanceNoLock enter(instance); |
| 1147 if (enter.succeeded()) { |
| 1148 id.Return(dispatcher(), |
| 1149 enter.functions()->GetFlashAPI()->GetDeviceID( |
| 1150 instance)); |
| 1151 } else { |
| 1152 id.Return(dispatcher(), PP_MakeUndefined()); |
| 1153 } |
| 1154 } |
| 1155 |
| 1142 } // namespace proxy | 1156 } // namespace proxy |
| 1143 } // namespace ppapi | 1157 } // namespace ppapi |
| OLD | NEW |