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

Side by Side Diff: webkit/plugins/ppapi/ppb_flash_impl.cc

Issue 6282007: First pass at making the proxy handle multiple renderers. This associates the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months 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 | « webkit/plugins/ppapi/ppb_flash_impl.h ('k') | webkit/plugins/ppapi/ppb_flash_impl_linux.cc » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "webkit/plugins/ppapi/ppb_flash_impl.h" 5 #include "webkit/plugins/ppapi/ppb_flash_impl.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 10 matching lines...) Expand all
21 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 21 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
22 #include "webkit/plugins/ppapi/var.h" 22 #include "webkit/plugins/ppapi/var.h"
23 23
24 namespace webkit { 24 namespace webkit {
25 namespace ppapi { 25 namespace ppapi {
26 26
27 // PPB_Flash_Impl -------------------------------------------------------------- 27 // PPB_Flash_Impl --------------------------------------------------------------
28 28
29 namespace { 29 namespace {
30 30
31 void SetInstanceAlwaysOnTop(PP_Instance pp_instance, bool on_top) { 31 void SetInstanceAlwaysOnTop(PP_Instance pp_instance, PP_Bool on_top) {
32 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance); 32 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance);
33 if (!instance) 33 if (!instance)
34 return; 34 return;
35 instance->set_always_on_top(on_top); 35 instance->set_always_on_top(on_top);
36 } 36 }
37 37
38 PP_Var GetProxyForURL(PP_Instance pp_instance, const char* url) { 38 PP_Var GetProxyForURL(PP_Instance pp_instance, const char* url) {
39 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance); 39 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance);
40 if (!instance) 40 if (!instance)
41 return PP_MakeUndefined(); 41 return PP_MakeUndefined();
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 base::PlatformFileError result = instance->delegate()->RenameModuleLocalFile( 108 base::PlatformFileError result = instance->delegate()->RenameModuleLocalFile(
109 instance->module()->name(), 109 instance->module()->name(),
110 GetFilePathFromUTF8(path_from), 110 GetFilePathFromUTF8(path_from),
111 GetFilePathFromUTF8(path_to)); 111 GetFilePathFromUTF8(path_to));
112 return PlatformFileErrorToPepperError(result); 112 return PlatformFileErrorToPepperError(result);
113 } 113 }
114 114
115 int32_t DeleteModuleLocalFileOrDir(PP_Instance pp_instance, 115 int32_t DeleteModuleLocalFileOrDir(PP_Instance pp_instance,
116 const char* path, 116 const char* path,
117 bool recursive) { 117 PP_Bool recursive) {
118 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance); 118 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance);
119 if (!instance) 119 if (!instance)
120 return PP_ERROR_FAILED; 120 return PP_ERROR_FAILED;
121 121
122 base::PlatformFileError result = 122 base::PlatformFileError result =
123 instance->delegate()->DeleteModuleLocalFileOrDir( 123 instance->delegate()->DeleteModuleLocalFileOrDir(
124 instance->module()->name(), GetFilePathFromUTF8(path), recursive); 124 instance->module()->name(), GetFilePathFromUTF8(path), recursive);
125 return PlatformFileErrorToPepperError(result); 125 return PlatformFileErrorToPepperError(result);
126 } 126 }
127 127
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 PP_DirEntry_Dev& entry = (*contents)->entries[i]; 185 PP_DirEntry_Dev& entry = (*contents)->entries[i];
186 #if defined(OS_WIN) 186 #if defined(OS_WIN)
187 const std::string& name = UTF16ToUTF8(pepper_contents[i].name.value()); 187 const std::string& name = UTF16ToUTF8(pepper_contents[i].name.value());
188 #else 188 #else
189 const std::string& name = pepper_contents[i].name.value(); 189 const std::string& name = pepper_contents[i].name.value();
190 #endif 190 #endif
191 size_t size = name.size() + 1; 191 size_t size = name.size() + 1;
192 char* name_copy = new char[size]; 192 char* name_copy = new char[size];
193 memcpy(name_copy, name.c_str(), size); 193 memcpy(name_copy, name.c_str(), size);
194 entry.name = name_copy; 194 entry.name = name_copy;
195 entry.is_dir = pepper_contents[i].is_dir; 195 entry.is_dir = BoolToPPBool(pepper_contents[i].is_dir);
196 } 196 }
197 return PP_OK; 197 return PP_OK;
198 } 198 }
199 199
200 void FreeModuleLocalDirContents(PP_Instance instance, 200 void FreeModuleLocalDirContents(PP_Instance instance,
201 PP_DirContents_Dev* contents) { 201 PP_DirContents_Dev* contents) {
202 DCHECK(contents); 202 DCHECK(contents);
203 for (int32_t i = 0; i < contents->count; ++i) { 203 for (int32_t i = 0; i < contents->count; ++i) {
204 delete [] contents->entries[i].name; 204 delete [] contents->entries[i].name;
205 } 205 }
206 delete [] contents->entries; 206 delete [] contents->entries;
207 delete contents; 207 delete contents;
208 } 208 }
209 209
210 bool NavigateToURL(PP_Instance pp_instance, 210 PP_Bool NavigateToURL(PP_Instance pp_instance,
211 const char* url, 211 const char* url,
212 const char* target) { 212 const char* target) {
213 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance); 213 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance);
214 if (!instance) 214 if (!instance)
215 return false; 215 return PP_FALSE;
216 return instance->NavigateToURL(url, target); 216 return BoolToPPBool(instance->NavigateToURL(url, target));
217 } 217 }
218 218
219 const PPB_Flash ppb_flash = { 219 const PPB_Flash ppb_flash = {
220 &SetInstanceAlwaysOnTop, 220 &SetInstanceAlwaysOnTop,
221 &PPB_Flash_Impl::DrawGlyphs, 221 &PPB_Flash_Impl::DrawGlyphs,
222 &GetProxyForURL, 222 &GetProxyForURL,
223 &OpenModuleLocalFile, 223 &OpenModuleLocalFile,
224 &RenameModuleLocalFile, 224 &RenameModuleLocalFile,
225 &DeleteModuleLocalFileOrDir, 225 &DeleteModuleLocalFileOrDir,
226 &CreateModuleLocalDir, 226 &CreateModuleLocalDir,
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 // Wipe everything else out for safety. 420 // Wipe everything else out for safety.
421 socket_out_ = NULL; 421 socket_out_ = NULL;
422 local_addr_out_ = NULL; 422 local_addr_out_ = NULL;
423 remote_addr_out_ = NULL; 423 remote_addr_out_ = NULL;
424 424
425 callback->Run(rv); // Will complete abortively if necessary. 425 callback->Run(rv); // Will complete abortively if necessary.
426 } 426 }
427 427
428 } // namespace ppapi 428 } // namespace ppapi
429 } // namespace webkit 429 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppb_flash_impl.h ('k') | webkit/plugins/ppapi/ppb_flash_impl_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698