OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 110 |
111 // Java doesn't like being loaded through a symlink, since it uses | 111 // Java doesn't like being loaded through a symlink, since it uses |
112 // its path to find dependent data files. | 112 // its path to find dependent data files. |
113 // file_util::AbsolutePath calls through to realpath(), which resolves | 113 // file_util::AbsolutePath calls through to realpath(), which resolves |
114 // symlinks. | 114 // symlinks. |
115 FilePath orig_path = path; | 115 FilePath orig_path = path; |
116 file_util::AbsolutePath(&path); | 116 file_util::AbsolutePath(&path); |
117 if (DebugPluginLoading()) | 117 if (DebugPluginLoading()) |
118 LOG(ERROR) << "Resolved " << orig_path.value() << " -> " << path.value(); | 118 LOG(ERROR) << "Resolved " << orig_path.value() << " -> " << path.value(); |
119 | 119 |
| 120 // Flash stops working if the containing directory involves 'netscape'. |
| 121 // No joke. So use the other path if it's better. |
| 122 static const char kFlashPlayerFilename[] = "libflashplayer.so"; |
| 123 static const char kNetscapeInPath[] = "/netscape/"; |
| 124 if (path.BaseName().value() == kFlashPlayerFilename && |
| 125 path.value().find(kNetscapeInPath) != std::string::npos) { |
| 126 if (orig_path.value().find(kNetscapeInPath) == std::string::npos) { |
| 127 // Go back to the old path. |
| 128 path = orig_path; |
| 129 } else { |
| 130 LOG(ERROR) << "Flash misbehaves when used from a directory containing " |
| 131 << kNetscapeInPath << ", so skipping " << orig_path.value(); |
| 132 continue; |
| 133 } |
| 134 } |
| 135 |
120 // Get mtime. | 136 // Get mtime. |
121 file_util::FileInfo info; | 137 file_util::FileInfo info; |
122 if (!file_util::GetFileInfo(path, &info)) | 138 if (!file_util::GetFileInfo(path, &info)) |
123 continue; | 139 continue; |
124 | 140 |
125 // Skip duplicates of the same file in our list. | 141 // Skip duplicates of the same file in our list. |
126 bool skip = false; | 142 bool skip = false; |
127 for (size_t i = 0; i < plugins->size(); ++i) { | 143 for (size_t i = 0; i < plugins->size(); ++i) { |
128 if (plugins->at(i).path == path) { | 144 if (plugins->at(i).path == path) { |
129 skip = true; | 145 skip = true; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 | 192 |
177 // TODO(evanm): prefer the newest version of flash, etc. here? | 193 // TODO(evanm): prefer the newest version of flash, etc. here? |
178 | 194 |
179 if (DebugPluginLoading()) | 195 if (DebugPluginLoading()) |
180 LOG(ERROR) << "Using " << info.path.value(); | 196 LOG(ERROR) << "Using " << info.path.value(); |
181 | 197 |
182 return true; | 198 return true; |
183 } | 199 } |
184 | 200 |
185 } // namespace NPAPI | 201 } // namespace NPAPI |
OLD | NEW |