OLD | NEW |
1 // Copyright (c) 2010 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/npapi/plugin_host.h" | 5 #include "webkit/plugins/npapi/plugin_host.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 static const char kFileUrlPrefix[] = "file:"; | 453 static const char kFileUrlPrefix[] = "file:"; |
454 if (StartsWithASCII(file_path_ascii, kFileUrlPrefix, false)) { | 454 if (StartsWithASCII(file_path_ascii, kFileUrlPrefix, false)) { |
455 GURL file_url(file_path_ascii); | 455 GURL file_url(file_path_ascii); |
456 DCHECK(file_url.SchemeIsFile()); | 456 DCHECK(file_url.SchemeIsFile()); |
457 net::FileURLToFilePath(file_url, &file_path); | 457 net::FileURLToFilePath(file_url, &file_path); |
458 } else { | 458 } else { |
459 file_path = FilePath::FromWStringHack( | 459 file_path = FilePath::FromWStringHack( |
460 base::SysNativeMBToWide(file_path_ascii)); | 460 base::SysNativeMBToWide(file_path_ascii)); |
461 } | 461 } |
462 | 462 |
463 base::PlatformFileInfo post_file_info = {0}; | 463 base::PlatformFileInfo post_file_info; |
464 if (!file_util::GetFileInfo(file_path, &post_file_info) || | 464 if (!file_util::GetFileInfo(file_path, &post_file_info) || |
465 post_file_info.is_directory) | 465 post_file_info.is_directory) |
466 return NPERR_FILE_NOT_FOUND; | 466 return NPERR_FILE_NOT_FOUND; |
467 | 467 |
468 if (!file_util::ReadFileToString(file_path, &post_file_contents)) | 468 if (!file_util::ReadFileToString(file_path, &post_file_contents)) |
469 return NPERR_FILE_NOT_FOUND; | 469 return NPERR_FILE_NOT_FOUND; |
470 | 470 |
471 buf = post_file_contents.c_str(); | 471 buf = post_file_contents.c_str(); |
472 len = post_file_contents.size(); | 472 len = post_file_contents.size(); |
473 } | 473 } |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1113 } | 1113 } |
1114 | 1114 |
1115 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { | 1115 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { |
1116 scoped_refptr<PluginInstance> plugin(FindInstance(instance)); | 1116 scoped_refptr<PluginInstance> plugin(FindInstance(instance)); |
1117 if (plugin.get()) { | 1117 if (plugin.get()) { |
1118 plugin->URLRedirectResponse(!!allow, notify_data); | 1118 plugin->URLRedirectResponse(!!allow, notify_data); |
1119 } | 1119 } |
1120 } | 1120 } |
1121 | 1121 |
1122 } // extern "C" | 1122 } // extern "C" |
OLD | NEW |