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 "chrome/browser/plugin_prefs.h" | 5 #include "chrome/browser/plugin_prefs.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/plugin_prefs_factory.h" | 21 #include "chrome/browser/plugin_prefs_factory.h" |
22 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 22 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
23 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
24 #include "chrome/browser/profiles/profile_keyed_service.h" | 24 #include "chrome/browser/profiles/profile_keyed_service.h" |
25 #include "chrome/browser/profiles/profile_manager.h" | 25 #include "chrome/browser/profiles/profile_manager.h" |
26 #include "chrome/common/chrome_content_client.h" | 26 #include "chrome/common/chrome_content_client.h" |
27 #include "chrome/common/chrome_notification_types.h" | 27 #include "chrome/common/chrome_notification_types.h" |
28 #include "chrome/common/chrome_paths.h" | 28 #include "chrome/common/chrome_paths.h" |
29 #include "chrome/common/chrome_switches.h" | 29 #include "chrome/common/chrome_switches.h" |
30 #include "chrome/common/pref_names.h" | 30 #include "chrome/common/pref_names.h" |
31 #include "content/browser/plugin_service.h" | |
32 #include "content/public/browser/browser_thread.h" | 31 #include "content/public/browser/browser_thread.h" |
33 #include "content/public/browser/notification_service.h" | 32 #include "content/public/browser/notification_service.h" |
| 33 #include "content/public/browser/plugin_service.h" |
34 #include "webkit/plugins/npapi/plugin_group.h" | 34 #include "webkit/plugins/npapi/plugin_group.h" |
35 #include "webkit/plugins/npapi/plugin_list.h" | 35 #include "webkit/plugins/npapi/plugin_list.h" |
36 #include "webkit/plugins/webplugininfo.h" | 36 #include "webkit/plugins/webplugininfo.h" |
37 | 37 |
38 using content::BrowserThread; | 38 using content::BrowserThread; |
| 39 using content::PluginService; |
39 | 40 |
40 namespace { | 41 namespace { |
41 | 42 |
42 // Default state for a plug-in (not state of the default plug-in!). | 43 // Default state for a plug-in (not state of the default plug-in!). |
43 // Accessed only on the UI thread. | 44 // Accessed only on the UI thread. |
44 base::LazyInstance<std::map<FilePath, bool> > g_default_plugin_state = | 45 base::LazyInstance<std::map<FilePath, bool> > g_default_plugin_state = |
45 LAZY_INSTANCE_INITIALIZER; | 46 LAZY_INSTANCE_INITIALIZER; |
46 | 47 |
47 } // namespace | 48 } // namespace |
48 | 49 |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 const std::set<string16>& disabled_exception_patterns, | 466 const std::set<string16>& disabled_exception_patterns, |
466 const std::set<string16>& enabled_patterns) { | 467 const std::set<string16>& enabled_patterns) { |
467 policy_disabled_plugin_patterns_ = disabled_patterns; | 468 policy_disabled_plugin_patterns_ = disabled_patterns; |
468 policy_disabled_plugin_exception_patterns_ = disabled_exception_patterns; | 469 policy_disabled_plugin_exception_patterns_ = disabled_exception_patterns; |
469 policy_enabled_plugin_patterns_ = enabled_patterns; | 470 policy_enabled_plugin_patterns_ = enabled_patterns; |
470 } | 471 } |
471 | 472 |
472 webkit::npapi::PluginList* PluginPrefs::GetPluginList() { | 473 webkit::npapi::PluginList* PluginPrefs::GetPluginList() { |
473 if (plugin_list_) | 474 if (plugin_list_) |
474 return plugin_list_; | 475 return plugin_list_; |
475 return PluginService::GetInstance()->plugin_list(); | 476 return PluginService::GetInstance()->GetPluginList(); |
476 } | 477 } |
477 | 478 |
478 void PluginPrefs::GetPreferencesDataOnFileThread() { | 479 void PluginPrefs::GetPreferencesDataOnFileThread() { |
479 std::vector<webkit::npapi::PluginGroup> groups; | 480 std::vector<webkit::npapi::PluginGroup> groups; |
480 | 481 |
481 webkit::npapi::PluginList* plugin_list = GetPluginList(); | 482 webkit::npapi::PluginList* plugin_list = GetPluginList(); |
482 plugin_list->GetPluginGroups(false, &groups); | 483 plugin_list->GetPluginGroups(false, &groups); |
483 | 484 |
484 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 485 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
485 base::Bind(&PluginPrefs::OnUpdatePreferences, this, groups)); | 486 base::Bind(&PluginPrefs::OnUpdatePreferences, this, groups)); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 } | 533 } |
533 } | 534 } |
534 | 535 |
535 void PluginPrefs::NotifyPluginStatusChanged() { | 536 void PluginPrefs::NotifyPluginStatusChanged() { |
536 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 537 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
537 content::NotificationService::current()->Notify( | 538 content::NotificationService::current()->Notify( |
538 chrome::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED, | 539 chrome::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED, |
539 content::Source<Profile>(profile_), | 540 content::Source<Profile>(profile_), |
540 content::NotificationService::NoDetails()); | 541 content::NotificationService::NoDetails()); |
541 } | 542 } |
OLD | NEW |