| 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 "content/browser/plugin_service_impl.h" | 5 #include "content/browser/plugin_service_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 if (plugin_host) | 285 if (plugin_host) |
| 286 return plugin_host; | 286 return plugin_host; |
| 287 | 287 |
| 288 WebPluginInfo info; | 288 WebPluginInfo info; |
| 289 if (!GetPluginInfoByPath(plugin_path, &info)) { | 289 if (!GetPluginInfoByPath(plugin_path, &info)) { |
| 290 return NULL; | 290 return NULL; |
| 291 } | 291 } |
| 292 | 292 |
| 293 // Record when NPAPI Flash process is started for the first time. | 293 // Record when NPAPI Flash process is started for the first time. |
| 294 static bool counted = false; | 294 static bool counted = false; |
| 295 if (!counted && UTF16ToUTF8(info.name) == kFlashPluginName) { | 295 if (!counted && base::UTF16ToUTF8(info.name) == kFlashPluginName) { |
| 296 counted = true; | 296 counted = true; |
| 297 UMA_HISTOGRAM_ENUMERATION("Plugin.FlashUsage", | 297 UMA_HISTOGRAM_ENUMERATION("Plugin.FlashUsage", |
| 298 START_NPAPI_FLASH_AT_LEAST_ONCE, | 298 START_NPAPI_FLASH_AT_LEAST_ONCE, |
| 299 FLASH_USAGE_ENUM_COUNT); | 299 FLASH_USAGE_ENUM_COUNT); |
| 300 } | 300 } |
| 301 #if defined(OS_CHROMEOS) | 301 #if defined(OS_CHROMEOS) |
| 302 // TODO(ihf): Move to an earlier place once crbug.com/314301 is fixed. For now | 302 // TODO(ihf): Move to an earlier place once crbug.com/314301 is fixed. For now |
| 303 // we still want Plugin.FlashUsage recorded if we end up here. | 303 // we still want Plugin.FlashUsage recorded if we end up here. |
| 304 LOG(WARNING) << "Refusing to start npapi plugin on ChromeOS."; | 304 LOG(WARNING) << "Refusing to start npapi plugin on ChromeOS."; |
| 305 return NULL; | 305 return NULL; |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 const base::FilePath& path) { | 567 const base::FilePath& path) { |
| 568 base::string16 plugin_name = path.LossyDisplayName(); | 568 base::string16 plugin_name = path.LossyDisplayName(); |
| 569 WebPluginInfo info; | 569 WebPluginInfo info; |
| 570 if (PluginService::GetInstance()->GetPluginInfoByPath(path, &info) && | 570 if (PluginService::GetInstance()->GetPluginInfoByPath(path, &info) && |
| 571 !info.name.empty()) { | 571 !info.name.empty()) { |
| 572 plugin_name = info.name; | 572 plugin_name = info.name; |
| 573 #if defined(OS_MACOSX) | 573 #if defined(OS_MACOSX) |
| 574 // Many plugins on the Mac have .plugin in the actual name, which looks | 574 // Many plugins on the Mac have .plugin in the actual name, which looks |
| 575 // terrible, so look for that and strip it off if present. | 575 // terrible, so look for that and strip it off if present. |
| 576 const std::string kPluginExtension = ".plugin"; | 576 const std::string kPluginExtension = ".plugin"; |
| 577 if (EndsWith(plugin_name, ASCIIToUTF16(kPluginExtension), true)) | 577 if (EndsWith(plugin_name, base::ASCIIToUTF16(kPluginExtension), true)) |
| 578 plugin_name.erase(plugin_name.length() - kPluginExtension.length()); | 578 plugin_name.erase(plugin_name.length() - kPluginExtension.length()); |
| 579 #endif // OS_MACOSX | 579 #endif // OS_MACOSX |
| 580 } | 580 } |
| 581 return plugin_name; | 581 return plugin_name; |
| 582 } | 582 } |
| 583 | 583 |
| 584 void PluginServiceImpl::GetPlugins(const GetPluginsCallback& callback) { | 584 void PluginServiceImpl::GetPlugins(const GetPluginsCallback& callback) { |
| 585 scoped_refptr<base::MessageLoopProxy> target_loop( | 585 scoped_refptr<base::MessageLoopProxy> target_loop( |
| 586 base::MessageLoop::current()->message_loop_proxy()); | 586 base::MessageLoop::current()->message_loop_proxy()); |
| 587 | 587 |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 return gfx::GetClassName(window) == base::string16(kNativeWindowClassName); | 840 return gfx::GetClassName(window) == base::string16(kNativeWindowClassName); |
| 841 } | 841 } |
| 842 #endif | 842 #endif |
| 843 | 843 |
| 844 bool PluginServiceImpl::PpapiDevChannelSupported() { | 844 bool PluginServiceImpl::PpapiDevChannelSupported() { |
| 845 return content::GetContentClient()->browser()-> | 845 return content::GetContentClient()->browser()-> |
| 846 IsPluginAllowedToUseDevChannelAPIs(); | 846 IsPluginAllowedToUseDevChannelAPIs(); |
| 847 } | 847 } |
| 848 | 848 |
| 849 } // namespace content | 849 } // namespace content |
| OLD | NEW |