OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/glue/plugins/pepper_private2.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" |
11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
13 #include "ppapi/c/dev/pp_file_info_dev.h" | 13 #include "ppapi/c/dev/pp_file_info_dev.h" |
14 #include "ppapi/c/dev/ppb_file_io_dev.h" | 14 #include "ppapi/c/dev/ppb_file_io_dev.h" |
15 #include "webkit/glue/plugins/pepper_error_util.h" | 15 #include "webkit/plugins/ppapi/error_util.h" |
16 #include "webkit/glue/plugins/pepper_plugin_delegate.h" | 16 #include "webkit/plugins/ppapi/plugin_delegate.h" |
17 #include "webkit/glue/plugins/pepper_plugin_instance.h" | 17 #include "webkit/plugins/ppapi/plugin_instance.h" |
18 #include "webkit/glue/plugins/pepper_plugin_module.h" | 18 #include "webkit/plugins/ppapi/plugin_module.h" |
19 #include "webkit/glue/plugins/pepper_var.h" | 19 #include "webkit/plugins/ppapi/ppb_flash.h" |
20 #include "webkit/glue/plugins/ppb_private2.h" | 20 #include "webkit/plugins/ppapi/var.h" |
21 | 21 |
22 namespace pepper { | 22 namespace webkit { |
| 23 namespace ppapi { |
23 | 24 |
24 namespace { | 25 namespace { |
25 | 26 |
26 PluginInstance* GetSomeInstance(PP_Module pp_module) { | 27 PluginInstance* GetSomeInstance(PP_Module pp_module) { |
27 PluginModule* module = ResourceTracker::Get()->GetModule(pp_module); | 28 PluginModule* module = ResourceTracker::Get()->GetModule(pp_module); |
28 if (!module) | 29 if (!module) |
29 return NULL; | 30 return NULL; |
30 | 31 |
31 return module->GetSomeInstance(); | 32 return module->GetSomeInstance(); |
32 } | 33 } |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 } | 164 } |
164 | 165 |
165 int32_t GetModuleLocalDirContents(PP_Module module, | 166 int32_t GetModuleLocalDirContents(PP_Module module, |
166 const char* path, | 167 const char* path, |
167 PP_DirContents_Dev** contents) { | 168 PP_DirContents_Dev** contents) { |
168 PluginInstance* instance = GetSomeInstance(module); | 169 PluginInstance* instance = GetSomeInstance(module); |
169 if (!instance) | 170 if (!instance) |
170 return PP_ERROR_FAILED; | 171 return PP_ERROR_FAILED; |
171 | 172 |
172 *contents = NULL; | 173 *contents = NULL; |
173 PepperDirContents pepper_contents; | 174 DirContents pepper_contents; |
174 base::PlatformFileError result = | 175 base::PlatformFileError result = |
175 instance->delegate()->GetModuleLocalDirContents( | 176 instance->delegate()->GetModuleLocalDirContents( |
176 instance->module()->name(), | 177 instance->module()->name(), |
177 GetFilePathFromUTF8(path), | 178 GetFilePathFromUTF8(path), |
178 &pepper_contents); | 179 &pepper_contents); |
179 | 180 |
180 if (result != base::PLATFORM_FILE_OK) | 181 if (result != base::PLATFORM_FILE_OK) |
181 return PlatformFileErrorToPepperError(result); | 182 return PlatformFileErrorToPepperError(result); |
182 | 183 |
183 *contents = new PP_DirContents_Dev; | 184 *contents = new PP_DirContents_Dev; |
(...skipping 28 matching lines...) Expand all Loading... |
212 | 213 |
213 bool NavigateToURL(PP_Instance pp_instance, | 214 bool NavigateToURL(PP_Instance pp_instance, |
214 const char* url, | 215 const char* url, |
215 const char* target) { | 216 const char* target) { |
216 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance); | 217 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance); |
217 if (!instance) | 218 if (!instance) |
218 return false; | 219 return false; |
219 return instance->NavigateToURL(url, target); | 220 return instance->NavigateToURL(url, target); |
220 } | 221 } |
221 | 222 |
222 const PPB_Private2 ppb_private2 = { | 223 const PPB_Flash ppb_flash = { |
223 &SetInstanceAlwaysOnTop, | 224 &SetInstanceAlwaysOnTop, |
224 &Private2::DrawGlyphs, | 225 &PPB_Flash_Impl::DrawGlyphs, |
225 &GetProxyForURL, | 226 &GetProxyForURL, |
226 &OpenModuleLocalFile, | 227 &OpenModuleLocalFile, |
227 &RenameModuleLocalFile, | 228 &RenameModuleLocalFile, |
228 &DeleteModuleLocalFileOrDir, | 229 &DeleteModuleLocalFileOrDir, |
229 &CreateModuleLocalDir, | 230 &CreateModuleLocalDir, |
230 &QueryModuleLocalFile, | 231 &QueryModuleLocalFile, |
231 &GetModuleLocalDirContents, | 232 &GetModuleLocalDirContents, |
232 &FreeModuleLocalDirContents, | 233 &FreeModuleLocalDirContents, |
233 &NavigateToURL, | 234 &NavigateToURL, |
234 }; | 235 }; |
235 | 236 |
236 } // namespace | 237 } // namespace |
237 | 238 |
238 // static | 239 // static |
239 const PPB_Private2* Private2::GetInterface() { | 240 const PPB_Flash* PPB_Flash_Impl::GetInterface() { |
240 return &ppb_private2; | 241 return &ppb_flash; |
241 } | 242 } |
242 | 243 |
243 } // namespace pepper | 244 } // namespace ppapi |
| 245 } // namespace webkit |
| 246 |
OLD | NEW |