OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "content/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/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "base/synchronization/waitable_event.h" | 13 #include "base/synchronization/waitable_event.h" |
14 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
16 #include "base/values.h" | 16 #include "base/values.h" |
17 #include "chrome/common/chrome_paths.h" | |
18 #include "content/browser/browser_thread.h" | 17 #include "content/browser/browser_thread.h" |
19 #include "content/browser/content_browser_client.h" | 18 #include "content/browser/content_browser_client.h" |
20 #include "content/browser/ppapi_plugin_process_host.h" | 19 #include "content/browser/ppapi_plugin_process_host.h" |
21 #include "content/browser/renderer_host/render_process_host.h" | 20 #include "content/browser/renderer_host/render_process_host.h" |
22 #include "content/browser/renderer_host/render_view_host.h" | 21 #include "content/browser/renderer_host/render_view_host.h" |
23 #include "content/browser/resource_context.h" | 22 #include "content/browser/resource_context.h" |
24 #include "content/common/content_switches.h" | 23 #include "content/common/content_switches.h" |
25 #include "content/common/notification_service.h" | 24 #include "content/common/notification_service.h" |
26 #include "content/common/notification_type.h" | 25 #include "content/common/notification_type.h" |
27 #include "content/common/pepper_plugin_registry.h" | 26 #include "content/common/pepper_plugin_registry.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 hklm_event_.reset(new base::WaitableEvent(hklm_key_.watch_event())); | 98 hklm_event_.reset(new base::WaitableEvent(hklm_key_.watch_event())); |
100 hklm_watcher_.StartWatching(hklm_event_.get(), this); | 99 hklm_watcher_.StartWatching(hklm_event_.get(), this); |
101 } | 100 } |
102 } | 101 } |
103 #elif defined(OS_MACOSX) | 102 #elif defined(OS_MACOSX) |
104 // We need to know when the browser comes forward so we can bring modal plugin | 103 // We need to know when the browser comes forward so we can bring modal plugin |
105 // windows forward too. | 104 // windows forward too. |
106 registrar_.Add(this, NotificationType::APP_ACTIVATED, | 105 registrar_.Add(this, NotificationType::APP_ACTIVATED, |
107 NotificationService::AllSources()); | 106 NotificationService::AllSources()); |
108 #elif defined(OS_POSIX) | 107 #elif defined(OS_POSIX) |
109 // Also find plugins in a user-specific plugins dir, | |
110 // e.g. ~/.config/chromium/Plugins. | |
111 FilePath user_data_dir; | |
112 if (PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) { | |
113 webkit::npapi::PluginList::Singleton()->AddExtraPluginDir( | |
114 user_data_dir.Append("Plugins")); | |
115 } | |
116 | |
117 // The FilePathWatcher produces too many false positives on MacOS (access time | 108 // The FilePathWatcher produces too many false positives on MacOS (access time |
118 // updates?) which will lead to enforcing updates of the plugins way too often. | 109 // updates?) which will lead to enforcing updates of the plugins way too often. |
119 // On ChromeOS the user can't install plugins anyway and on Windows all | 110 // On ChromeOS the user can't install plugins anyway and on Windows all |
120 // important plugins register themselves in the registry so no need to do that. | 111 // important plugins register themselves in the registry so no need to do that. |
121 file_watcher_delegate_ = new PluginDirWatcherDelegate(); | 112 file_watcher_delegate_ = new PluginDirWatcherDelegate(); |
122 // Get the list of all paths for registering the FilePathWatchers | 113 // Get the list of all paths for registering the FilePathWatchers |
123 // that will track and if needed reload the list of plugins on runtime. | 114 // that will track and if needed reload the list of plugins on runtime. |
124 std::vector<FilePath> plugin_dirs; | 115 std::vector<FilePath> plugin_dirs; |
125 webkit::npapi::PluginList::Singleton()->GetPluginDirectories( | 116 webkit::npapi::PluginList::Singleton()->GetPluginDirectories( |
126 &plugin_dirs); | 117 &plugin_dirs); |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 487 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
497 // static | 488 // static |
498 void PluginService::RegisterFilePathWatcher( | 489 void PluginService::RegisterFilePathWatcher( |
499 FilePathWatcher *watcher, | 490 FilePathWatcher *watcher, |
500 const FilePath& path, | 491 const FilePath& path, |
501 FilePathWatcher::Delegate* delegate) { | 492 FilePathWatcher::Delegate* delegate) { |
502 bool result = watcher->Watch(path, delegate); | 493 bool result = watcher->Watch(path, delegate); |
503 DCHECK(result); | 494 DCHECK(result); |
504 } | 495 } |
505 #endif | 496 #endif |
OLD | NEW |