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 "webkit/plugins/npapi/plugin_list.h" | 5 #include "webkit/plugins/npapi/plugin_list.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 PluginList* PluginList::Singleton() { | 72 PluginList* PluginList::Singleton() { |
73 return g_singleton.Pointer(); | 73 return g_singleton.Pointer(); |
74 } | 74 } |
75 | 75 |
76 // static | 76 // static |
77 bool PluginList::DebugPluginLoading() { | 77 bool PluginList::DebugPluginLoading() { |
78 return CommandLine::ForCurrentProcess()->HasSwitch( | 78 return CommandLine::ForCurrentProcess()->HasSwitch( |
79 switches::kDebugPluginLoading); | 79 switches::kDebugPluginLoading); |
80 } | 80 } |
81 | 81 |
| 82 void PluginList::DisablePluginsDiscovery() { |
| 83 plugins_discovery_disabled_ = true; |
| 84 } |
| 85 |
82 void PluginList::RefreshPlugins() { | 86 void PluginList::RefreshPlugins() { |
83 base::AutoLock lock(lock_); | 87 base::AutoLock lock(lock_); |
84 loading_state_ = LOADING_STATE_NEEDS_REFRESH; | 88 loading_state_ = LOADING_STATE_NEEDS_REFRESH; |
85 } | 89 } |
86 | 90 |
87 void PluginList::AddExtraPluginPath(const base::FilePath& plugin_path) { | 91 void PluginList::AddExtraPluginPath(const base::FilePath& plugin_path) { |
88 if (!NPAPIPluginsSupported()) { | 92 if (!NPAPIPluginsSupported()) { |
89 // TODO(jam): remove and just have CHECK once we're sure this doesn't get | 93 // TODO(jam): remove and just have CHECK once we're sure this doesn't get |
90 // triggered. | 94 // triggered. |
91 DLOG(INFO) << "NPAPI plugins not supported"; | 95 DLOG(INFO) << "NPAPI plugins not supported"; |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 } | 234 } |
231 | 235 |
232 return true; | 236 return true; |
233 } | 237 } |
234 | 238 |
235 PluginList::PluginList() | 239 PluginList::PluginList() |
236 : | 240 : |
237 #if defined(OS_WIN) | 241 #if defined(OS_WIN) |
238 dont_load_new_wmp_(false), | 242 dont_load_new_wmp_(false), |
239 #endif | 243 #endif |
240 loading_state_(LOADING_STATE_NEEDS_REFRESH) { | 244 loading_state_(LOADING_STATE_NEEDS_REFRESH), |
| 245 plugins_discovery_disabled_(false) { |
241 } | 246 } |
242 | 247 |
243 void PluginList::LoadPluginsIntoPluginListInternal( | 248 void PluginList::LoadPluginsIntoPluginListInternal( |
244 std::vector<webkit::WebPluginInfo>* plugins) { | 249 std::vector<webkit::WebPluginInfo>* plugins) { |
245 base::Closure will_load_callback; | 250 base::Closure will_load_callback; |
246 { | 251 { |
247 base::AutoLock lock(lock_); | 252 base::AutoLock lock(lock_); |
248 will_load_callback = will_load_plugins_callback_; | 253 will_load_callback = will_load_plugins_callback_; |
249 } | 254 } |
250 if (!will_load_callback.is_null()) | 255 if (!will_load_callback.is_null()) |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 // Those are all internal plugins so we have to use extra_plugin_paths. | 344 // Those are all internal plugins so we have to use extra_plugin_paths. |
340 for (size_t i = 0; i < extra_plugin_dirs.size(); ++i) | 345 for (size_t i = 0; i < extra_plugin_dirs.size(); ++i) |
341 GetPluginsInDir(extra_plugin_dirs[i], plugin_paths); | 346 GetPluginsInDir(extra_plugin_dirs[i], plugin_paths); |
342 | 347 |
343 std::vector<base::FilePath> directories_to_scan; | 348 std::vector<base::FilePath> directories_to_scan; |
344 GetPluginDirectories(&directories_to_scan); | 349 GetPluginDirectories(&directories_to_scan); |
345 for (size_t i = 0; i < directories_to_scan.size(); ++i) | 350 for (size_t i = 0; i < directories_to_scan.size(); ++i) |
346 GetPluginsInDir(directories_to_scan[i], plugin_paths); | 351 GetPluginsInDir(directories_to_scan[i], plugin_paths); |
347 | 352 |
348 #if defined(OS_WIN) | 353 #if defined(OS_WIN) |
349 GetPluginPathsFromRegistry(plugin_paths); | 354 GetPluginPathsFromRegistry(plugin_paths); |
350 #endif | 355 #endif |
351 } | 356 } |
352 } | 357 } |
353 | 358 |
354 void PluginList::SetPlugins(const std::vector<webkit::WebPluginInfo>& plugins) { | 359 void PluginList::SetPlugins(const std::vector<webkit::WebPluginInfo>& plugins) { |
355 base::AutoLock lock(lock_); | 360 base::AutoLock lock(lock_); |
356 | 361 |
357 DCHECK_NE(LOADING_STATE_REFRESHING, loading_state_); | 362 DCHECK_NE(LOADING_STATE_REFRESHING, loading_state_); |
358 loading_state_ = LOADING_STATE_UP_TO_DATE; | 363 loading_state_ = LOADING_STATE_UP_TO_DATE; |
359 | 364 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 } | 471 } |
467 return false; | 472 return false; |
468 } | 473 } |
469 | 474 |
470 PluginList::~PluginList() { | 475 PluginList::~PluginList() { |
471 } | 476 } |
472 | 477 |
473 | 478 |
474 } // namespace npapi | 479 } // namespace npapi |
475 } // namespace webkit | 480 } // namespace webkit |
OLD | NEW |