| 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 "chrome/browser/pepper_flash_settings_manager.h" | 5 #include "chrome/browser/pepper_flash_settings_manager.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/sequenced_task_runner_helpers.h" | 13 #include "base/sequenced_task_runner_helpers.h" |
| 14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 15 #include "chrome/browser/plugins/plugin_prefs.h" | 15 #include "chrome/browser/plugins/plugin_prefs.h" |
| 16 #include "chrome/browser/prefs/pref_registry_syncable.h" |
| 16 #include "chrome/browser/prefs/pref_service.h" | 17 #include "chrome/browser/prefs/pref_service.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
| 19 #include "content/public/browser/browser_context.h" | 20 #include "content/public/browser/browser_context.h" |
| 20 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 21 #include "content/public/browser/pepper_flash_settings_helper.h" | 22 #include "content/public/browser/pepper_flash_settings_helper.h" |
| 22 #include "content/public/browser/plugin_service.h" | 23 #include "content/public/browser/plugin_service.h" |
| 23 #include "content/public/common/content_constants.h" | 24 #include "content/public/common/content_constants.h" |
| 24 #include "googleurl/src/gurl.h" | 25 #include "googleurl/src/gurl.h" |
| 25 #include "ipc/ipc_channel.h" | 26 #include "ipc/ipc_channel.h" |
| (...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 920 if (webkit::IsPepperPlugin(*iter) && plugin_prefs->IsPluginEnabled(*iter)) { | 921 if (webkit::IsPepperPlugin(*iter) && plugin_prefs->IsPluginEnabled(*iter)) { |
| 921 if (plugin_info) | 922 if (plugin_info) |
| 922 *plugin_info = *iter; | 923 *plugin_info = *iter; |
| 923 return true; | 924 return true; |
| 924 } | 925 } |
| 925 } | 926 } |
| 926 return false; | 927 return false; |
| 927 } | 928 } |
| 928 | 929 |
| 929 // static | 930 // static |
| 930 void PepperFlashSettingsManager::RegisterUserPrefs(PrefServiceSyncable* prefs) { | 931 void PepperFlashSettingsManager::RegisterUserPrefs( |
| 931 prefs->RegisterBooleanPref(prefs::kDeauthorizeContentLicenses, | 932 PrefRegistrySyncable* registry) { |
| 932 false, | 933 registry->RegisterBooleanPref(prefs::kDeauthorizeContentLicenses, |
| 933 PrefServiceSyncable::UNSYNCABLE_PREF); | 934 false, |
| 935 PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 934 | 936 |
| 935 prefs->RegisterBooleanPref(prefs::kPepperFlashSettingsEnabled, | 937 registry->RegisterBooleanPref(prefs::kPepperFlashSettingsEnabled, |
| 936 true, | 938 true, |
| 937 PrefServiceSyncable::UNSYNCABLE_PREF); | 939 PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 938 } | 940 } |
| 939 | 941 |
| 940 uint32 PepperFlashSettingsManager::DeauthorizeContentLicenses() { | 942 uint32 PepperFlashSettingsManager::DeauthorizeContentLicenses() { |
| 941 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 943 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 942 | 944 |
| 943 EnsureCoreExists(); | 945 EnsureCoreExists(); |
| 944 uint32 id = GetNextRequestId(); | 946 uint32 id = GetNextRequestId(); |
| 945 core_->DeauthorizeContentLicenses(id); | 947 core_->DeauthorizeContentLicenses(id); |
| 946 return id; | 948 return id; |
| 947 } | 949 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1012 } | 1014 } |
| 1013 | 1015 |
| 1014 void PepperFlashSettingsManager::OnError(Core* core) { | 1016 void PepperFlashSettingsManager::OnError(Core* core) { |
| 1015 DCHECK(core); | 1017 DCHECK(core); |
| 1016 if (core != core_.get()) | 1018 if (core != core_.get()) |
| 1017 return; | 1019 return; |
| 1018 | 1020 |
| 1019 core_->Detach(); | 1021 core_->Detach(); |
| 1020 core_ = NULL; | 1022 core_ = NULL; |
| 1021 } | 1023 } |
| OLD | NEW |