Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Side by Side Diff: ppapi/proxy/flash_resource.cc

Issue 11415140: Refactor 3 PPB_Flash functions to the new resource model. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/flash_resource.h ('k') | ppapi/proxy/ppapi_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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: {
49 StringVar* url_string_var(StringVar::FromPPVar(value));
50 if (!url_string_var)
51 return PP_FALSE;
52 PluginGlobals::Get()->SetActiveURL(url_string_var->value());
53 return PP_TRUE;
54 }
55 }
56 return PP_FALSE;
57 }
58
24 } // namespace proxy 59 } // namespace proxy
25 } // namespace ppapi 60 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/flash_resource.h ('k') | ppapi/proxy/ppapi_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698