| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // HACK: we need this #define in place before npapi.h is included for | 5 // HACK: we need this #define in place before npapi.h is included for |
| 6 // plugins to work. However, all sorts of headers include npapi.h, so | 6 // plugins to work. However, all sorts of headers include npapi.h, so |
| 7 // the only way to be certain the define is in place is to put it | 7 // the only way to be certain the define is in place is to put it |
| 8 // here. You might ask, "Why not set it in npapi.h directly, or in | 8 // here. You might ask, "Why not set it in npapi.h directly, or in |
| 9 // this directory's SConscript, then?" but it turns out this define | 9 // this directory's SConscript, then?" but it turns out this define |
| 10 // makes npapi.h include Xlib.h, which in turn defines a ton of symbols | 10 // makes npapi.h include Xlib.h, which in turn defines a ton of symbols |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 | 443 |
| 444 if (!buf) | 444 if (!buf) |
| 445 return NPERR_FILE_NOT_FOUND; | 445 return NPERR_FILE_NOT_FOUND; |
| 446 | 446 |
| 447 std::string file_path_ascii(buf); | 447 std::string file_path_ascii(buf); |
| 448 std::wstring file_path; | 448 std::wstring file_path; |
| 449 static const char kFileUrlPrefix[] = "file:"; | 449 static const char kFileUrlPrefix[] = "file:"; |
| 450 if (StartsWithASCII(file_path_ascii, kFileUrlPrefix, false)) { | 450 if (StartsWithASCII(file_path_ascii, kFileUrlPrefix, false)) { |
| 451 GURL file_url(file_path_ascii); | 451 GURL file_url(file_path_ascii); |
| 452 DCHECK(file_url.SchemeIsFile()); | 452 DCHECK(file_url.SchemeIsFile()); |
| 453 net::FileURLToFilePath(file_url, &file_path); | 453 FilePath path; |
| 454 net::FileURLToFilePath(file_url, &path); |
| 455 file_path = path.ToWStringHack(); |
| 454 } else { | 456 } else { |
| 455 file_path = base::SysNativeMBToWide(file_path_ascii); | 457 file_path = base::SysNativeMBToWide(file_path_ascii); |
| 456 } | 458 } |
| 457 | 459 |
| 458 file_util::FileInfo post_file_info = {0}; | 460 file_util::FileInfo post_file_info = {0}; |
| 459 if (!file_util::GetFileInfo(file_path.c_str(), &post_file_info) || | 461 if (!file_util::GetFileInfo(file_path.c_str(), &post_file_info) || |
| 460 post_file_info.is_directory) | 462 post_file_info.is_directory) |
| 461 return NPERR_FILE_NOT_FOUND; | 463 return NPERR_FILE_NOT_FOUND; |
| 462 | 464 |
| 463 if (!file_util::ReadFileToString(file_path, &post_file_contents)) | 465 if (!file_util::ReadFileToString(file_path, &post_file_contents)) |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 void NPN_PluginThreadAsyncCall(NPP id, | 909 void NPN_PluginThreadAsyncCall(NPP id, |
| 908 void (*func)(void *), | 910 void (*func)(void *), |
| 909 void *userData) { | 911 void *userData) { |
| 910 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); | 912 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); |
| 911 if (plugin) { | 913 if (plugin) { |
| 912 plugin->PluginThreadAsyncCall(func, userData); | 914 plugin->PluginThreadAsyncCall(func, userData); |
| 913 } | 915 } |
| 914 } | 916 } |
| 915 | 917 |
| 916 } // extern "C" | 918 } // extern "C" |
| OLD | NEW |