| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/child/npapi/plugin_host.h" | 5 #include "content/child/npapi/plugin_host.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 base::FilePath file_path; | 462 base::FilePath file_path; |
| 463 static const char kFileUrlPrefix[] = "file:"; | 463 static const char kFileUrlPrefix[] = "file:"; |
| 464 if (StartsWithASCII(file_path_ascii, kFileUrlPrefix, false)) { | 464 if (StartsWithASCII(file_path_ascii, kFileUrlPrefix, false)) { |
| 465 GURL file_url(file_path_ascii); | 465 GURL file_url(file_path_ascii); |
| 466 DCHECK(file_url.SchemeIsFile()); | 466 DCHECK(file_url.SchemeIsFile()); |
| 467 net::FileURLToFilePath(file_url, &file_path); | 467 net::FileURLToFilePath(file_url, &file_path); |
| 468 } else { | 468 } else { |
| 469 file_path = base::FilePath::FromUTF8Unsafe(file_path_ascii); | 469 file_path = base::FilePath::FromUTF8Unsafe(file_path_ascii); |
| 470 } | 470 } |
| 471 | 471 |
| 472 base::PlatformFileInfo post_file_info; | 472 base::File::Info post_file_info; |
| 473 if (!base::GetFileInfo(file_path, &post_file_info) || | 473 if (!base::GetFileInfo(file_path, &post_file_info) || |
| 474 post_file_info.is_directory) | 474 post_file_info.is_directory) |
| 475 return NPERR_FILE_NOT_FOUND; | 475 return NPERR_FILE_NOT_FOUND; |
| 476 | 476 |
| 477 if (!base::ReadFileToString(file_path, &post_file_contents)) | 477 if (!base::ReadFileToString(file_path, &post_file_contents)) |
| 478 return NPERR_FILE_NOT_FOUND; | 478 return NPERR_FILE_NOT_FOUND; |
| 479 | 479 |
| 480 buf = post_file_contents.c_str(); | 480 buf = post_file_contents.c_str(); |
| 481 len = post_file_contents.size(); | 481 len = post_file_contents.size(); |
| 482 } | 482 } |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1100 } | 1100 } |
| 1101 | 1101 |
| 1102 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { | 1102 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { |
| 1103 scoped_refptr<PluginInstance> plugin(FindInstance(instance)); | 1103 scoped_refptr<PluginInstance> plugin(FindInstance(instance)); |
| 1104 if (plugin.get()) { | 1104 if (plugin.get()) { |
| 1105 plugin->URLRedirectResponse(!!allow, notify_data); | 1105 plugin->URLRedirectResponse(!!allow, notify_data); |
| 1106 } | 1106 } |
| 1107 } | 1107 } |
| 1108 | 1108 |
| 1109 } // extern "C" | 1109 } // extern "C" |
| OLD | NEW |