| 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 plugins { |
| 24 namespace ppapi { |
| 23 | 25 |
| 24 namespace { | 26 namespace { |
| 25 | 27 |
| 26 PluginInstance* GetSomeInstance(PP_Module pp_module) { | 28 PluginInstance* GetSomeInstance(PP_Module pp_module) { |
| 27 PluginModule* module = ResourceTracker::Get()->GetModule(pp_module); | 29 PluginModule* module = ResourceTracker::Get()->GetModule(pp_module); |
| 28 if (!module) | 30 if (!module) |
| 29 return NULL; | 31 return NULL; |
| 30 | 32 |
| 31 return module->GetSomeInstance(); | 33 return module->GetSomeInstance(); |
| 32 } | 34 } |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 } | 165 } |
| 164 | 166 |
| 165 int32_t GetModuleLocalDirContents(PP_Module module, | 167 int32_t GetModuleLocalDirContents(PP_Module module, |
| 166 const char* path, | 168 const char* path, |
| 167 PP_DirContents_Dev** contents) { | 169 PP_DirContents_Dev** contents) { |
| 168 PluginInstance* instance = GetSomeInstance(module); | 170 PluginInstance* instance = GetSomeInstance(module); |
| 169 if (!instance) | 171 if (!instance) |
| 170 return PP_ERROR_FAILED; | 172 return PP_ERROR_FAILED; |
| 171 | 173 |
| 172 *contents = NULL; | 174 *contents = NULL; |
| 173 PepperDirContents pepper_contents; | 175 DirContents pepper_contents; |
| 174 base::PlatformFileError result = | 176 base::PlatformFileError result = |
| 175 instance->delegate()->GetModuleLocalDirContents( | 177 instance->delegate()->GetModuleLocalDirContents( |
| 176 instance->module()->name(), | 178 instance->module()->name(), |
| 177 GetFilePathFromUTF8(path), | 179 GetFilePathFromUTF8(path), |
| 178 &pepper_contents); | 180 &pepper_contents); |
| 179 | 181 |
| 180 if (result != base::PLATFORM_FILE_OK) | 182 if (result != base::PLATFORM_FILE_OK) |
| 181 return PlatformFileErrorToPepperError(result); | 183 return PlatformFileErrorToPepperError(result); |
| 182 | 184 |
| 183 *contents = new PP_DirContents_Dev; | 185 *contents = new PP_DirContents_Dev; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 212 | 214 |
| 213 bool NavigateToURL(PP_Instance pp_instance, | 215 bool NavigateToURL(PP_Instance pp_instance, |
| 214 const char* url, | 216 const char* url, |
| 215 const char* target) { | 217 const char* target) { |
| 216 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance); | 218 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance); |
| 217 if (!instance) | 219 if (!instance) |
| 218 return false; | 220 return false; |
| 219 return instance->NavigateToURL(url, target); | 221 return instance->NavigateToURL(url, target); |
| 220 } | 222 } |
| 221 | 223 |
| 222 const PPB_Private2 ppb_private2 = { | 224 const PPB_Flash ppb_flash = { |
| 223 &SetInstanceAlwaysOnTop, | 225 &SetInstanceAlwaysOnTop, |
| 224 &Private2::DrawGlyphs, | 226 &PPB_Flash_Impl::DrawGlyphs, |
| 225 &GetProxyForURL, | 227 &GetProxyForURL, |
| 226 &OpenModuleLocalFile, | 228 &OpenModuleLocalFile, |
| 227 &RenameModuleLocalFile, | 229 &RenameModuleLocalFile, |
| 228 &DeleteModuleLocalFileOrDir, | 230 &DeleteModuleLocalFileOrDir, |
| 229 &CreateModuleLocalDir, | 231 &CreateModuleLocalDir, |
| 230 &QueryModuleLocalFile, | 232 &QueryModuleLocalFile, |
| 231 &GetModuleLocalDirContents, | 233 &GetModuleLocalDirContents, |
| 232 &FreeModuleLocalDirContents, | 234 &FreeModuleLocalDirContents, |
| 233 &NavigateToURL, | 235 &NavigateToURL, |
| 234 }; | 236 }; |
| 235 | 237 |
| 236 } // namespace | 238 } // namespace |
| 237 | 239 |
| 238 // static | 240 // static |
| 239 const PPB_Private2* Private2::GetInterface() { | 241 const PPB_Flash* PPB_Flash_Impl::GetInterface() { |
| 240 return &ppb_private2; | 242 return &ppb_flash; |
| 241 } | 243 } |
| 242 | 244 |
| 243 } // namespace pepper | 245 } // namespace ppapi |
| 246 } // namespace plugins |
| 247 } // namespace webkit |
| 248 |
| OLD | NEW |