| 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 "webkit/plugins/npapi/plugin_list.h" | 5 #include "webkit/plugins/npapi/plugin_list.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/files/memory_mapped_file.h" |
| 12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/path_service.h" | 14 #include "base/path_service.h" |
| 14 #include "base/string_number_conversions.h" | 15 #include "base/string_number_conversions.h" |
| 15 #include "base/string_split.h" | 16 #include "base/string_split.h" |
| 16 #include "base/string_util.h" | 17 #include "base/string_util.h" |
| 17 #include "base/win/pe_image.h" | 18 #include "base/win/pe_image.h" |
| 18 #include "base/win/registry.h" | 19 #include "base/win/registry.h" |
| 19 #include "base/win/scoped_handle.h" | 20 #include "base/win/scoped_handle.h" |
| 20 #include "base/win/windows_version.h" | 21 #include "base/win/windows_version.h" |
| 21 #include "webkit/plugins/npapi/plugin_constants_win.h" | 22 #include "webkit/plugins/npapi/plugin_constants_win.h" |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 java_plugin_directory.append(L"\\bin\\new_plugin"); | 199 java_plugin_directory.append(L"\\bin\\new_plugin"); |
| 199 | 200 |
| 200 // 5. We don't know the exact name of the DLL but it's in the form | 201 // 5. We don't know the exact name of the DLL but it's in the form |
| 201 // NP*.dll so just invoke LoadPlugins on this path. | 202 // NP*.dll so just invoke LoadPlugins on this path. |
| 202 plugin_dirs->insert(base::FilePath(java_plugin_directory)); | 203 plugin_dirs->insert(base::FilePath(java_plugin_directory)); |
| 203 } | 204 } |
| 204 } | 205 } |
| 205 } | 206 } |
| 206 | 207 |
| 207 bool IsValid32BitImage(const base::FilePath& path) { | 208 bool IsValid32BitImage(const base::FilePath& path) { |
| 208 file_util::MemoryMappedFile plugin_image; | 209 base::MemoryMappedFile plugin_image; |
| 209 | 210 |
| 210 if (!plugin_image.InitializeAsImageSection(path)) | 211 if (!plugin_image.InitializeAsImageSection(path)) |
| 211 return false; | 212 return false; |
| 212 | 213 |
| 213 base::win::PEImage image(plugin_image.data()); | 214 base::win::PEImage image(plugin_image.data()); |
| 214 | 215 |
| 215 PIMAGE_NT_HEADERS nt_headers = image.GetNTHeaders(); | 216 PIMAGE_NT_HEADERS nt_headers = image.GetNTHeaders(); |
| 216 return (nt_headers->FileHeader.Machine == IMAGE_FILE_MACHINE_I386); | 217 return (nt_headers->FileHeader.Machine == IMAGE_FILE_MACHINE_I386); |
| 217 } | 218 } |
| 218 | 219 |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 base::FilePath plugin_path(info.path); | 421 base::FilePath plugin_path(info.path); |
| 421 file_util::AbsolutePath(&plugin_path); | 422 file_util::AbsolutePath(&plugin_path); |
| 422 if (!IsValid32BitImage(plugin_path)) | 423 if (!IsValid32BitImage(plugin_path)) |
| 423 return false; | 424 return false; |
| 424 #endif | 425 #endif |
| 425 return true; | 426 return true; |
| 426 } | 427 } |
| 427 | 428 |
| 428 } // namespace npapi | 429 } // namespace npapi |
| 429 } // namespace webkit | 430 } // namespace webkit |
| OLD | NEW |