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