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

Unified 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, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: ppapi/proxy/flash_resource.cc
diff --git a/ppapi/proxy/flash_resource.cc b/ppapi/proxy/flash_resource.cc
index afbe6243c1984dd9cf0b910fcd7b51ffffabb677..aae611e83e462533c54afe71936bdb250695989d 100644
--- a/ppapi/proxy/flash_resource.cc
+++ b/ppapi/proxy/flash_resource.cc
@@ -4,7 +4,11 @@
#include "ppapi/proxy/flash_resource.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/ppb_flash.h"
+#include "ppapi/proxy/plugin_globals.h"
#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/shared_impl/var.h"
namespace ppapi {
namespace proxy {
@@ -12,6 +16,7 @@ namespace proxy {
FlashResource::FlashResource(Connection connection, PP_Instance instance)
: PluginResource(connection, instance) {
SendCreate(RENDERER, PpapiHostMsg_Flash_Create());
+ SendCreate(BROWSER, PpapiHostMsg_Flash_Create());
}
FlashResource::~FlashResource() {
@@ -21,5 +26,35 @@ thunk::PPB_Flash_Functions_API* FlashResource::AsPPB_Flash_Functions_API() {
return this;
}
+PP_Var FlashResource::GetProxyForURL(PP_Instance instance,
+ const std::string& url) {
+ std::string proxy;
+ int32_t result = SyncCall<PpapiPluginMsg_Flash_GetProxyForURLReply>(RENDERER,
+ PpapiHostMsg_Flash_GetProxyForURL(url), &proxy);
+
+ if (result == PP_OK)
+ return StringVar::StringToPPVar(proxy);
+ return PP_MakeUndefined();
+}
+
+void FlashResource::UpdateActivity(PP_Instance instance) {
+ Post(BROWSER, PpapiHostMsg_Flash_UpdateActivity());
+}
+
+PP_Bool FlashResource::SetCrashData(PP_Instance instance,
+ PP_FlashCrashKey key,
+ PP_Var value) {
+ switch (key) {
+ 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.
+ 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.
+ if (!url_string_var)
+ return PP_FALSE;
+ 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.
+ PluginGlobals::Get()->SetActiveURL(url_string);
+ return PP_TRUE;
+ }
+ return PP_FALSE;
+}
+
} // namespace proxy
} // namespace ppapi

Powered by Google App Engine
This is Rietveld 408576698