| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/pepper_flash_settings_manager.h" |
| 6 |
| 7 #include <vector> |
| 8 |
| 9 #include "chrome/browser/plugin_prefs.h" |
| 10 #include "chrome/browser/prefs/pref_service.h" |
| 11 #include "chrome/common/pref_names.h" |
| 12 #include "content/public/browser/plugin_service.h" |
| 13 #include "googleurl/src/gurl.h" |
| 14 #include "webkit/plugins/plugin_constants.h" |
| 15 #include "webkit/plugins/webplugininfo.h" |
| 16 |
| 17 // static |
| 18 bool PepperFlashSettingsManager::IsPepperFlashInUse( |
| 19 PluginPrefs* plugin_prefs, |
| 20 webkit::WebPluginInfo* plugin_info) { |
| 21 if (!plugin_prefs) |
| 22 return false; |
| 23 |
| 24 content::PluginService* plugin_service = |
| 25 content::PluginService::GetInstance(); |
| 26 std::vector<webkit::WebPluginInfo> plugins; |
| 27 plugin_service->GetPluginInfoArray( |
| 28 GURL(), kFlashPluginSwfMimeType, false, &plugins, NULL); |
| 29 |
| 30 for (std::vector<webkit::WebPluginInfo>::iterator iter = plugins.begin(); |
| 31 iter != plugins.end(); ++iter) { |
| 32 if (webkit::IsPepperPlugin(*iter) && plugin_prefs->IsPluginEnabled(*iter)) { |
| 33 if (plugin_info) |
| 34 *plugin_info = *iter; |
| 35 return true; |
| 36 } |
| 37 } |
| 38 return false; |
| 39 } |
| 40 |
| 41 // static |
| 42 void PepperFlashSettingsManager::RegisterUserPrefs(PrefService* prefs) { |
| 43 prefs->RegisterBooleanPref(prefs::kDeauthorizeContentLicenses, |
| 44 false, |
| 45 PrefService::UNSYNCABLE_PREF); |
| 46 |
| 47 prefs->RegisterBooleanPref(prefs::kPepperFlashSettingsEnabled, |
| 48 true, |
| 49 PrefService::UNSYNCABLE_PREF); |
| 50 } |
| OLD | NEW |