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" |
| 8 #include "ppapi/c/private/ppb_flash.h" |
| 9 #include "ppapi/proxy/plugin_globals.h" |
| 10 #include "ppapi/proxy/plugin_proxy_delegate.h" |
7 #include "ppapi/proxy/ppapi_messages.h" | 11 #include "ppapi/proxy/ppapi_messages.h" |
| 12 #include "ppapi/shared_impl/var.h" |
8 | 13 |
9 namespace ppapi { | 14 namespace ppapi { |
10 namespace proxy { | 15 namespace proxy { |
11 | 16 |
12 FlashResource::FlashResource(Connection connection, PP_Instance instance) | 17 FlashResource::FlashResource(Connection connection, PP_Instance instance) |
13 : PluginResource(connection, instance) { | 18 : PluginResource(connection, instance) { |
14 SendCreate(RENDERER, PpapiHostMsg_Flash_Create()); | 19 SendCreate(RENDERER, PpapiHostMsg_Flash_Create()); |
| 20 SendCreate(BROWSER, PpapiHostMsg_Flash_Create()); |
15 } | 21 } |
16 | 22 |
17 FlashResource::~FlashResource() { | 23 FlashResource::~FlashResource() { |
18 } | 24 } |
19 | 25 |
20 thunk::PPB_Flash_Functions_API* FlashResource::AsPPB_Flash_Functions_API() { | 26 thunk::PPB_Flash_Functions_API* FlashResource::AsPPB_Flash_Functions_API() { |
21 return this; | 27 return this; |
22 } | 28 } |
23 | 29 |
| 30 PP_Var FlashResource::GetProxyForURL(PP_Instance instance, |
| 31 const std::string& url) { |
| 32 std::string proxy; |
| 33 int32_t result = SyncCall<PpapiPluginMsg_Flash_GetProxyForURLReply>(RENDERER, |
| 34 PpapiHostMsg_Flash_GetProxyForURL(url), &proxy); |
| 35 |
| 36 if (result == PP_OK) |
| 37 return StringVar::StringToPPVar(proxy); |
| 38 return PP_MakeUndefined(); |
| 39 } |
| 40 |
| 41 void FlashResource::UpdateActivity(PP_Instance instance) { |
| 42 Post(BROWSER, PpapiHostMsg_Flash_UpdateActivity()); |
| 43 } |
| 44 |
| 45 PP_Bool FlashResource::SetCrashData(PP_Instance instance, |
| 46 PP_FlashCrashKey key, |
| 47 PP_Var value) { |
| 48 switch (key) { |
| 49 case PP_FLASHCRASHKEY_URL: |
| 50 StringVar *url_string_var(StringVar::FromPPVar(value)); |
| 51 if (!url_string_var) |
| 52 return PP_FALSE; |
| 53 std::string url_string(url_string_var->value()); |
| 54 PluginGlobals::Get()->plugin_proxy_delegate()->SetActiveURL(url_string); |
| 55 return PP_TRUE; |
| 56 } |
| 57 return PP_FALSE; |
| 58 } |
| 59 |
24 } // namespace proxy | 60 } // namespace proxy |
25 } // namespace ppapi | 61 } // namespace ppapi |
OLD | NEW |