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

Side by Side Diff: chrome/browser/plugin_service.cc

Issue 257029: Add an option to disable NaCl at compile time for platforms where it doesn't build yet (Closed)
Patch Set: Created 11 years, 2 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
« no previous file with comments | « chrome/browser/nacl_process_host.cc ('k') | chrome/chrome.gyp » ('j') | 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) 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/string_util.h"
11 #include "base/thread.h" 11 #include "base/thread.h"
12 #include "base/waitable_event.h" 12 #include "base/waitable_event.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/chrome_plugin_host.h" 14 #include "chrome/browser/chrome_plugin_host.h"
15 #include "chrome/browser/chrome_thread.h" 15 #include "chrome/browser/chrome_thread.h"
16 #include "chrome/browser/extensions/extensions_service.h" 16 #include "chrome/browser/extensions/extensions_service.h"
17 #include "chrome/browser/plugin_process_host.h" 17 #include "chrome/browser/plugin_process_host.h"
18 #include "chrome/browser/renderer_host/render_process_host.h" 18 #include "chrome/browser/renderer_host/render_process_host.h"
19 #include "chrome/common/chrome_plugin_lib.h" 19 #include "chrome/common/chrome_plugin_lib.h"
20 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
21 #include "chrome/common/extensions/extension.h" 21 #include "chrome/common/extensions/extension.h"
22 #include "chrome/common/logging_chrome.h" 22 #include "chrome/common/logging_chrome.h"
23 #include "chrome/common/notification_type.h" 23 #include "chrome/common/notification_type.h"
24 #include "chrome/common/notification_service.h" 24 #include "chrome/common/notification_service.h"
25 #include "chrome/common/render_messages.h" 25 #include "chrome/common/render_messages.h"
26 #ifndef DISABLE_NACL
26 #include "native_client/src/trusted/plugin/nacl_entry_points.h" 27 #include "native_client/src/trusted/plugin/nacl_entry_points.h"
28 #endif
27 #include "webkit/glue/plugins/plugin_constants_win.h" 29 #include "webkit/glue/plugins/plugin_constants_win.h"
28 #include "webkit/glue/plugins/plugin_list.h" 30 #include "webkit/glue/plugins/plugin_list.h"
29 31
30 // static 32 // static
31 PluginService* PluginService::GetInstance() { 33 PluginService* PluginService::GetInstance() {
32 return Singleton<PluginService>::get(); 34 return Singleton<PluginService>::get();
33 } 35 }
34 36
35 PluginService::PluginService() 37 PluginService::PluginService()
36 : main_message_loop_(MessageLoop::current()), 38 : main_message_loop_(MessageLoop::current()),
37 resource_dispatcher_host_(NULL), 39 resource_dispatcher_host_(NULL),
38 ui_locale_(ASCIIToWide(g_browser_process->GetApplicationLocale())) { 40 ui_locale_(ASCIIToWide(g_browser_process->GetApplicationLocale())) {
39 // Have the NPAPI plugin list search for Chrome plugins as well. 41 // Have the NPAPI plugin list search for Chrome plugins as well.
40 ChromePluginLib::RegisterPluginsWithNPAPI(); 42 ChromePluginLib::RegisterPluginsWithNPAPI();
41 // Load the one specified on the command line as well. 43 // Load the one specified on the command line as well.
42 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 44 const CommandLine* command_line = CommandLine::ForCurrentProcess();
43 std::wstring path = command_line->GetSwitchValue(switches::kLoadPlugin); 45 std::wstring path = command_line->GetSwitchValue(switches::kLoadPlugin);
44 if (!path.empty()) { 46 if (!path.empty()) {
45 NPAPI::PluginList::Singleton()->AddExtraPluginPath( 47 NPAPI::PluginList::Singleton()->AddExtraPluginPath(
46 FilePath::FromWStringHack(path)); 48 FilePath::FromWStringHack(path));
47 } 49 }
50 #ifndef DISABLE_NACL
48 if (command_line->HasSwitch(switches::kInternalNaCl)) 51 if (command_line->HasSwitch(switches::kInternalNaCl))
49 RegisterInternalNaClPlugin(); 52 RegisterInternalNaClPlugin();
53 #endif
50 54
51 #if defined(OS_WIN) 55 #if defined(OS_WIN)
52 hkcu_key_.Create( 56 hkcu_key_.Create(
53 HKEY_CURRENT_USER, kRegistryMozillaPlugins, KEY_NOTIFY); 57 HKEY_CURRENT_USER, kRegistryMozillaPlugins, KEY_NOTIFY);
54 hklm_key_.Create( 58 hklm_key_.Create(
55 HKEY_LOCAL_MACHINE, kRegistryMozillaPlugins, KEY_NOTIFY); 59 HKEY_LOCAL_MACHINE, kRegistryMozillaPlugins, KEY_NOTIFY);
56 if (hkcu_key_.StartWatching()) { 60 if (hkcu_key_.StartWatching()) {
57 hkcu_event_.reset(new base::WaitableEvent(hkcu_key_.watch_event())); 61 hkcu_event_.reset(new base::WaitableEvent(hkcu_key_.watch_event()));
58 hkcu_watcher_.StartWatching(hkcu_event_.get(), this); 62 hkcu_watcher_.StartWatching(hkcu_event_.get(), this);
59 } 63 }
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 PrivatePluginMap::iterator it = private_plugins_.find(plugin_path); 259 PrivatePluginMap::iterator it = private_plugins_.find(plugin_path);
256 if (it == private_plugins_.end()) 260 if (it == private_plugins_.end())
257 return true; // This plugin is not private, so it's allowed everywhere. 261 return true; // This plugin is not private, so it's allowed everywhere.
258 262
259 // We do a dumb compare of scheme and host, rather than using the domain 263 // We do a dumb compare of scheme and host, rather than using the domain
260 // service, since we only care about this for extensions. 264 // service, since we only care about this for extensions.
261 const GURL& required_url = it->second; 265 const GURL& required_url = it->second;
262 return (url.scheme() == required_url.scheme() && 266 return (url.scheme() == required_url.scheme() &&
263 url.host() == required_url.host()); 267 url.host() == required_url.host());
264 } 268 }
OLDNEW
« no previous file with comments | « chrome/browser/nacl_process_host.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698