OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #include "chrome/browser/plugin_service.h" | 7 #include "chrome/browser/plugin_service.h" |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/string_util.h" |
10 #include "base/thread.h" | 11 #include "base/thread.h" |
11 #include "base/waitable_event.h" | 12 #include "base/waitable_event.h" |
12 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/chrome_plugin_host.h" | 14 #include "chrome/browser/chrome_plugin_host.h" |
14 #include "chrome/browser/chrome_thread.h" | 15 #include "chrome/browser/chrome_thread.h" |
15 #include "chrome/browser/extensions/extensions_service.h" | 16 #include "chrome/browser/extensions/extensions_service.h" |
16 #include "chrome/browser/plugin_process_host.h" | 17 #include "chrome/browser/plugin_process_host.h" |
17 #include "chrome/browser/renderer_host/render_process_host.h" | 18 #include "chrome/browser/renderer_host/render_process_host.h" |
18 #include "chrome/common/chrome_plugin_lib.h" | 19 #include "chrome/common/chrome_plugin_lib.h" |
19 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
20 #include "chrome/common/extensions/extension.h" | 21 #include "chrome/common/extensions/extension.h" |
21 #include "chrome/common/logging_chrome.h" | 22 #include "chrome/common/logging_chrome.h" |
22 #include "chrome/common/notification_type.h" | 23 #include "chrome/common/notification_type.h" |
23 #include "chrome/common/notification_service.h" | 24 #include "chrome/common/notification_service.h" |
24 #include "chrome/common/render_messages.h" | 25 #include "chrome/common/render_messages.h" |
25 #include "webkit/glue/plugins/plugin_constants_win.h" | 26 #include "webkit/glue/plugins/plugin_constants_win.h" |
26 #include "webkit/glue/plugins/plugin_list.h" | 27 #include "webkit/glue/plugins/plugin_list.h" |
27 | 28 |
28 // static | 29 // static |
29 PluginService* PluginService::GetInstance() { | 30 PluginService* PluginService::GetInstance() { |
30 return Singleton<PluginService>::get(); | 31 return Singleton<PluginService>::get(); |
31 } | 32 } |
32 | 33 |
33 PluginService::PluginService() | 34 PluginService::PluginService() |
34 : main_message_loop_(MessageLoop::current()), | 35 : main_message_loop_(MessageLoop::current()), |
35 resource_dispatcher_host_(NULL), | 36 resource_dispatcher_host_(NULL), |
36 ui_locale_(g_browser_process->GetApplicationLocale()) { | 37 ui_locale_(ASCIIToWide(g_browser_process->GetApplicationLocale())) { |
37 // Have the NPAPI plugin list search for Chrome plugins as well. | 38 // Have the NPAPI plugin list search for Chrome plugins as well. |
38 ChromePluginLib::RegisterPluginsWithNPAPI(); | 39 ChromePluginLib::RegisterPluginsWithNPAPI(); |
39 // Load the one specified on the command line as well. | 40 // Load the one specified on the command line as well. |
40 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 41 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
41 std::wstring path = command_line->GetSwitchValue(switches::kLoadPlugin); | 42 std::wstring path = command_line->GetSwitchValue(switches::kLoadPlugin); |
42 if (!path.empty()) | 43 if (!path.empty()) |
43 NPAPI::PluginList::AddExtraPluginPath(FilePath::FromWStringHack(path)); | 44 NPAPI::PluginList::AddExtraPluginPath(FilePath::FromWStringHack(path)); |
44 | 45 |
45 #if defined(OS_WIN) | 46 #if defined(OS_WIN) |
46 hkcu_key_.Create( | 47 hkcu_key_.Create( |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 PrivatePluginMap::iterator it = private_plugins_.find(plugin_path); | 272 PrivatePluginMap::iterator it = private_plugins_.find(plugin_path); |
272 if (it == private_plugins_.end()) | 273 if (it == private_plugins_.end()) |
273 return true; // This plugin is not private, so it's allowed everywhere. | 274 return true; // This plugin is not private, so it's allowed everywhere. |
274 | 275 |
275 // We do a dumb compare of scheme and host, rather than using the domain | 276 // We do a dumb compare of scheme and host, rather than using the domain |
276 // service, since we only care about this for extensions. | 277 // service, since we only care about this for extensions. |
277 const GURL& required_url = it->second; | 278 const GURL& required_url = it->second; |
278 return (url.scheme() == required_url.scheme() && | 279 return (url.scheme() == required_url.scheme() && |
279 url.host() == required_url.host()); | 280 url.host() == required_url.host()); |
280 } | 281 } |
OLD | NEW |