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/plugin_list.h" | 5 #include "webkit/glue/plugins/plugin_list.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/sha1.h" | 9 #include "base/sha1.h" |
10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(bad_entries); i++) { | 48 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(bad_entries); i++) { |
49 if (bad_entries[i].size != size) | 49 if (bad_entries[i].size != size) |
50 continue; | 50 continue; |
51 | 51 |
52 std::string file_content; | 52 std::string file_content; |
53 if (!file_util::ReadFileToString(path, &file_content)) | 53 if (!file_util::ReadFileToString(path, &file_content)) |
54 continue; | 54 continue; |
55 std::string sha1 = base::SHA1HashString(file_content); | 55 std::string sha1 = base::SHA1HashString(file_content); |
56 std::string sha1_readable; | 56 std::string sha1_readable; |
57 for (size_t j = 0; j < sha1.size(); j++) | 57 for (size_t j = 0; j < sha1.size(); j++) |
58 StringAppendF(&sha1_readable, "%02x", sha1[j] & 0xFF); | 58 base::StringAppendF(&sha1_readable, "%02x", sha1[j] & 0xFF); |
59 if (bad_entries[i].sha1 == sha1_readable) | 59 if (bad_entries[i].sha1 == sha1_readable) |
60 return true; | 60 return true; |
61 } | 61 } |
62 return false; | 62 return false; |
63 } | 63 } |
64 | 64 |
65 // Some plugins are shells around other plugins; we prefer to use the | 65 // Some plugins are shells around other plugins; we prefer to use the |
66 // real plugin directly, if it's available. This function returns | 66 // real plugin directly, if it's available. This function returns |
67 // true if we should prefer other plugins over this one. We'll still | 67 // true if we should prefer other plugins over this one. We'll still |
68 // use a "undesirable" plugin if no other option is available. | 68 // use a "undesirable" plugin if no other option is available. |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 } | 261 } |
262 | 262 |
263 // TODO(evanm): prefer the newest version of flash, etc. here? | 263 // TODO(evanm): prefer the newest version of flash, etc. here? |
264 | 264 |
265 VLOG_IF(1, PluginList::DebugPluginLoading()) << "Using " << info.path.value(); | 265 VLOG_IF(1, PluginList::DebugPluginLoading()) << "Using " << info.path.value(); |
266 | 266 |
267 return true; | 267 return true; |
268 } | 268 } |
269 | 269 |
270 } // namespace NPAPI | 270 } // namespace NPAPI |
OLD | NEW |