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 "chrome/browser/plugin_service.h" | 5 #include "chrome/browser/plugin_service.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 overridden_plugins_.push_back(plugin); | 489 overridden_plugins_.push_back(plugin); |
490 } | 490 } |
491 | 491 |
492 void PluginService::RegisterPepperPlugins() { | 492 void PluginService::RegisterPepperPlugins() { |
493 std::vector<PepperPluginInfo> plugins; | 493 std::vector<PepperPluginInfo> plugins; |
494 PepperPluginRegistry::ComputeList(&plugins); | 494 PepperPluginRegistry::ComputeList(&plugins); |
495 for (size_t i = 0; i < plugins.size(); ++i) { | 495 for (size_t i = 0; i < plugins.size(); ++i) { |
496 webkit::npapi::WebPluginInfo info; | 496 webkit::npapi::WebPluginInfo info; |
497 info.path = plugins[i].path; | 497 info.path = plugins[i].path; |
498 info.name = plugins[i].name.empty() ? | 498 info.name = plugins[i].name.empty() ? |
499 WideToUTF16(plugins[i].path.BaseName().ToWStringHack()) : | 499 plugins[i].path.BaseName().LossyDisplayName() : |
500 ASCIIToUTF16(plugins[i].name); | 500 ASCIIToUTF16(plugins[i].name); |
501 info.desc = ASCIIToUTF16(plugins[i].description); | 501 info.desc = ASCIIToUTF16(plugins[i].description); |
502 info.enabled = webkit::npapi::WebPluginInfo::USER_ENABLED_POLICY_UNMANAGED; | 502 info.enabled = webkit::npapi::WebPluginInfo::USER_ENABLED_POLICY_UNMANAGED; |
503 | 503 |
504 // TODO(evan): Pepper shouldn't require us to parse strings to get | 504 // TODO(evan): Pepper shouldn't require us to parse strings to get |
505 // the list of mime types out. | 505 // the list of mime types out. |
506 if (!webkit::npapi::PluginList::ParseMimeTypes( | 506 if (!webkit::npapi::PluginList::ParseMimeTypes( |
507 JoinString(plugins[i].mime_types, '|'), | 507 JoinString(plugins[i].mime_types, '|'), |
508 plugins[i].file_extensions, | 508 plugins[i].file_extensions, |
509 ASCIIToUTF16(plugins[i].type_descriptions), | 509 ASCIIToUTF16(plugins[i].type_descriptions), |
510 &info.mime_types)) { | 510 &info.mime_types)) { |
511 LOG(ERROR) << "Error parsing mime types for " | 511 LOG(ERROR) << "Error parsing mime types for " |
512 << plugins[i].path.ToWStringHack(); | 512 << plugins[i].path.LossyDisplayName(); |
513 return; | 513 return; |
514 } | 514 } |
515 | 515 |
516 webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(info); | 516 webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(info); |
517 } | 517 } |
518 } | 518 } |
519 | 519 |
520 #if defined(OS_LINUX) | 520 #if defined(OS_LINUX) |
521 // static | 521 // static |
522 void PluginService::RegisterFilePathWatcher( | 522 void PluginService::RegisterFilePathWatcher( |
523 FilePathWatcher *watcher, | 523 FilePathWatcher *watcher, |
524 const FilePath& path, | 524 const FilePath& path, |
525 FilePathWatcher::Delegate* delegate) { | 525 FilePathWatcher::Delegate* delegate) { |
526 bool result = watcher->Watch(path, delegate); | 526 bool result = watcher->Watch(path, delegate); |
527 DCHECK(result); | 527 DCHECK(result); |
528 } | 528 } |
529 #endif | 529 #endif |
OLD | NEW |