Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Side by Side Diff: webkit/glue/plugins/plugin_list_posix.cc

Issue 3013039: Enhance plugin logging a bit. This adds logging in a few more places, especia... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/glue/plugins/plugin_list.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_util.h" 10 #include "base/string_util.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 // Skip over Mozilla .xpt files. 176 // Skip over Mozilla .xpt files.
177 if (path.MatchesExtension(FILE_PATH_LITERAL(".xpt"))) 177 if (path.MatchesExtension(FILE_PATH_LITERAL(".xpt")))
178 continue; 178 continue;
179 179
180 // Java doesn't like being loaded through a symlink, since it uses 180 // Java doesn't like being loaded through a symlink, since it uses
181 // its path to find dependent data files. 181 // its path to find dependent data files.
182 // file_util::AbsolutePath calls through to realpath(), which resolves 182 // file_util::AbsolutePath calls through to realpath(), which resolves
183 // symlinks. 183 // symlinks.
184 FilePath orig_path = path; 184 FilePath orig_path = path;
185 file_util::AbsolutePath(&path); 185 file_util::AbsolutePath(&path);
186 LOG_IF(INFO, PluginList::DebugPluginLoading()) 186 LOG_IF(ERROR, PluginList::DebugPluginLoading())
187 << "Resolved " << orig_path.value() << " -> " << path.value(); 187 << "Resolved " << orig_path.value() << " -> " << path.value();
188 188
189 if (visited_plugins->find(path) != visited_plugins->end()) { 189 if (visited_plugins->find(path) != visited_plugins->end()) {
190 LOG_IF(INFO, PluginList::DebugPluginLoading()) 190 LOG_IF(ERROR, PluginList::DebugPluginLoading())
191 << "Skipping duplicate instance of " << path.value(); 191 << "Skipping duplicate instance of " << path.value();
192 continue; 192 continue;
193 } 193 }
194 visited_plugins->insert(path); 194 visited_plugins->insert(path);
195 195
196 if (IsBlacklistedPlugin(path)) { 196 if (IsBlacklistedPlugin(path)) {
197 LOG_IF(INFO, PluginList::DebugPluginLoading()) 197 LOG_IF(ERROR, PluginList::DebugPluginLoading())
198 << "Skipping blacklisted plugin " << path.value(); 198 << "Skipping blacklisted plugin " << path.value();
199 continue; 199 continue;
200 } 200 }
201 201
202 // Flash stops working if the containing directory involves 'netscape'. 202 // Flash stops working if the containing directory involves 'netscape'.
203 // No joke. So use the other path if it's better. 203 // No joke. So use the other path if it's better.
204 static const char kFlashPlayerFilename[] = "libflashplayer.so"; 204 static const char kFlashPlayerFilename[] = "libflashplayer.so";
205 static const char kNetscapeInPath[] = "/netscape/"; 205 static const char kNetscapeInPath[] = "/netscape/";
206 if (path.BaseName().value() == kFlashPlayerFilename && 206 if (path.BaseName().value() == kFlashPlayerFilename &&
207 path.value().find(kNetscapeInPath) != std::string::npos) { 207 path.value().find(kNetscapeInPath) != std::string::npos) {
208 if (orig_path.value().find(kNetscapeInPath) == std::string::npos) { 208 if (orig_path.value().find(kNetscapeInPath) == std::string::npos) {
209 // Go back to the old path. 209 // Go back to the old path.
210 path = orig_path; 210 path = orig_path;
211 } else { 211 } else {
212 LOG(ERROR) << "Flash misbehaves when used from a directory containing " 212 LOG_IF(ERROR, PluginList::DebugPluginLoading())
213 << kNetscapeInPath << ", so skipping " << orig_path.value(); 213 << "Flash misbehaves when used from a directory containing "
214 << kNetscapeInPath << ", so skipping " << orig_path.value();
214 continue; 215 continue;
215 } 216 }
216 } 217 }
217 218
218 // Get mtime. 219 // Get mtime.
219 file_util::FileInfo info; 220 file_util::FileInfo info;
220 if (!file_util::GetFileInfo(path, &info)) 221 if (!file_util::GetFileInfo(path, &info))
221 continue; 222 continue;
222 223
223 files.push_back(std::make_pair(path, info.last_modified)); 224 files.push_back(std::make_pair(path, info.last_modified));
224 } 225 }
225 226
226 // Sort the file list by time (and filename). 227 // Sort the file list by time (and filename).
227 std::sort(files.begin(), files.end(), CompareTime); 228 std::sort(files.begin(), files.end(), CompareTime);
228 229
229 // Load the files in order. 230 // Load the files in order.
230 for (FileTimeList::const_iterator i = files.begin(); i != files.end(); ++i) { 231 for (FileTimeList::const_iterator i = files.begin(); i != files.end(); ++i) {
231 LoadPlugin(i->first, plugins); 232 LoadPlugin(i->first, plugins);
232 } 233 }
233 } 234 }
234 235
235
236 bool PluginList::ShouldLoadPlugin(const WebPluginInfo& info, 236 bool PluginList::ShouldLoadPlugin(const WebPluginInfo& info,
237 std::vector<WebPluginInfo>* plugins) { 237 std::vector<WebPluginInfo>* plugins) {
238 LOG_IF(INFO, PluginList::DebugPluginLoading()) 238 LOG_IF(ERROR, PluginList::DebugPluginLoading())
239 << "Considering " << info.path.value() << " (" << info.name << ")"; 239 << "Considering " << info.path.value() << " (" << info.name << ")";
240 240
241 if (IsUndesirablePlugin(info)) { 241 if (IsUndesirablePlugin(info)) {
242 LOG_IF(INFO, PluginList::DebugPluginLoading()) 242 LOG_IF(ERROR, PluginList::DebugPluginLoading())
243 << info.path.value() << " is undesirable."; 243 << info.path.value() << " is undesirable.";
244 244
245 // See if we have a better version of this plugin. 245 // See if we have a better version of this plugin.
246 for (size_t i = 0; i < plugins->size(); ++i) { 246 for (size_t i = 0; i < plugins->size(); ++i) {
247 if (plugins->at(i).name == info.name && 247 if (plugins->at(i).name == info.name &&
248 !IsUndesirablePlugin(plugins->at(i))) { 248 !IsUndesirablePlugin(plugins->at(i))) {
249 // Skip the current undesirable one so we can use the better one 249 // Skip the current undesirable one so we can use the better one
250 // we just found. 250 // we just found.
251 LOG_IF(INFO, PluginList::DebugPluginLoading()) 251 LOG_IF(ERROR, PluginList::DebugPluginLoading())
252 << "Skipping " << info.path.value() << ", preferring " 252 << "Skipping " << info.path.value() << ", preferring "
253 << plugins->at(i).path.value(); 253 << plugins->at(i).path.value();
254 return false; 254 return false;
255 } 255 }
256 } 256 }
257 } 257 }
258 258
259 // TODO(evanm): prefer the newest version of flash, etc. here? 259 // TODO(evanm): prefer the newest version of flash, etc. here?
260 260
261 LOG_IF(INFO, PluginList::DebugPluginLoading()) 261 LOG_IF(INFO, PluginList::DebugPluginLoading())
262 << "Using " << info.path.value(); 262 << "Using " << info.path.value();
263 263
264 return true; 264 return true;
265 } 265 }
266 266
267 } // namespace NPAPI 267 } // namespace NPAPI
OLDNEW
« no previous file with comments | « webkit/glue/plugins/plugin_list.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698