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

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

Issue 153002: NaCl-Chrome integration - step 1 (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
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 | Annotate | Revision Log
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 #include "native_client/src/trusted/plugin/nacl_entry_points.h"
26 #include "webkit/glue/plugins/plugin_constants_win.h" 27 #include "webkit/glue/plugins/plugin_constants_win.h"
27 #include "webkit/glue/plugins/plugin_list.h" 28 #include "webkit/glue/plugins/plugin_list.h"
28 29
29 // static 30 // static
30 PluginService* PluginService::GetInstance() { 31 PluginService* PluginService::GetInstance() {
31 return Singleton<PluginService>::get(); 32 return Singleton<PluginService>::get();
32 } 33 }
33 34
34 PluginService::PluginService() 35 PluginService::PluginService()
35 : main_message_loop_(MessageLoop::current()), 36 : main_message_loop_(MessageLoop::current()),
36 resource_dispatcher_host_(NULL), 37 resource_dispatcher_host_(NULL),
37 ui_locale_(ASCIIToWide(g_browser_process->GetApplicationLocale())) { 38 ui_locale_(ASCIIToWide(g_browser_process->GetApplicationLocale())) {
38 // Have the NPAPI plugin list search for Chrome plugins as well. 39 // Have the NPAPI plugin list search for Chrome plugins as well.
39 ChromePluginLib::RegisterPluginsWithNPAPI(); 40 ChromePluginLib::RegisterPluginsWithNPAPI();
40 // Load the one specified on the command line as well. 41 // Load the one specified on the command line as well.
41 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 42 const CommandLine* command_line = CommandLine::ForCurrentProcess();
42 std::wstring path = command_line->GetSwitchValue(switches::kLoadPlugin); 43 std::wstring path = command_line->GetSwitchValue(switches::kLoadPlugin);
43 if (!path.empty()) { 44 if (!path.empty()) {
44 NPAPI::PluginList::Singleton()->AddExtraPluginPath( 45 NPAPI::PluginList::Singleton()->AddExtraPluginPath(
45 FilePath::FromWStringHack(path)); 46 FilePath::FromWStringHack(path));
46 } 47 }
48 if (command_line->HasSwitch(switches::kInternalNaCl))
49 RegisterInternalNaClPlugin();
47 50
48 #if defined(OS_WIN) 51 #if defined(OS_WIN)
49 hkcu_key_.Create( 52 hkcu_key_.Create(
50 HKEY_CURRENT_USER, kRegistryMozillaPlugins, KEY_NOTIFY); 53 HKEY_CURRENT_USER, kRegistryMozillaPlugins, KEY_NOTIFY);
51 hklm_key_.Create( 54 hklm_key_.Create(
52 HKEY_LOCAL_MACHINE, kRegistryMozillaPlugins, KEY_NOTIFY); 55 HKEY_LOCAL_MACHINE, kRegistryMozillaPlugins, KEY_NOTIFY);
53 if (hkcu_key_.StartWatching()) { 56 if (hkcu_key_.StartWatching()) {
54 hkcu_event_.reset(new base::WaitableEvent(hkcu_key_.watch_event())); 57 hkcu_event_.reset(new base::WaitableEvent(hkcu_key_.watch_event()));
55 hkcu_watcher_.StartWatching(hkcu_event_.get(), this); 58 hkcu_watcher_.StartWatching(hkcu_event_.get(), this);
56 } 59 }
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 PrivatePluginMap::iterator it = private_plugins_.find(plugin_path); 255 PrivatePluginMap::iterator it = private_plugins_.find(plugin_path);
253 if (it == private_plugins_.end()) 256 if (it == private_plugins_.end())
254 return true; // This plugin is not private, so it's allowed everywhere. 257 return true; // This plugin is not private, so it's allowed everywhere.
255 258
256 // We do a dumb compare of scheme and host, rather than using the domain 259 // We do a dumb compare of scheme and host, rather than using the domain
257 // service, since we only care about this for extensions. 260 // service, since we only care about this for extensions.
258 const GURL& required_url = it->second; 261 const GURL& required_url = it->second;
259 return (url.scheme() == required_url.scheme() && 262 return (url.scheme() == required_url.scheme() &&
260 url.host() == required_url.host()); 263 url.host() == required_url.host());
261 } 264 }
OLDNEW
« no previous file with comments | « chrome/browser/nacl_process_host.cc ('k') | chrome/browser/renderer_host/browser_render_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698