| 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 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "content/public/browser/browser_context.h" | 22 #include "content/public/browser/browser_context.h" |
| 23 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| 24 #include "content/public/browser/pepper_flash_settings_helper.h" | 24 #include "content/public/browser/pepper_flash_settings_helper.h" |
| 25 #include "content/public/browser/plugin_service.h" | 25 #include "content/public/browser/plugin_service.h" |
| 26 #include "content/public/common/content_constants.h" | 26 #include "content/public/common/content_constants.h" |
| 27 #include "content/public/common/webplugininfo.h" | 27 #include "content/public/common/webplugininfo.h" |
| 28 #include "ipc/ipc_channel.h" | 28 #include "ipc/ipc_channel.h" |
| 29 #include "ipc/ipc_listener.h" | 29 #include "ipc/ipc_listener.h" |
| 30 #include "ppapi/proxy/ppapi_messages.h" | 30 #include "ppapi/proxy/ppapi_messages.h" |
| 31 #include "url/gurl.h" | 31 #include "url/gurl.h" |
| 32 #include "webkit/plugins/plugin_constants.h" | |
| 33 | 32 |
| 34 using content::BrowserThread; | 33 using content::BrowserThread; |
| 35 | 34 |
| 36 class PepperFlashSettingsManager::Core | 35 class PepperFlashSettingsManager::Core |
| 37 : public IPC::Listener, | 36 : public IPC::Listener, |
| 38 public base::RefCountedThreadSafe<Core, BrowserThread::DeleteOnIOThread> { | 37 public base::RefCountedThreadSafe<Core, BrowserThread::DeleteOnIOThread> { |
| 39 public: | 38 public: |
| 40 Core(base::WeakPtr<PepperFlashSettingsManager> manager, | 39 Core(base::WeakPtr<PepperFlashSettingsManager> manager, |
| 41 content::BrowserContext* browser_context); | 40 content::BrowserContext* browser_context); |
| 42 | 41 |
| (...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 bool PepperFlashSettingsManager::IsPepperFlashInUse( | 947 bool PepperFlashSettingsManager::IsPepperFlashInUse( |
| 949 PluginPrefs* plugin_prefs, | 948 PluginPrefs* plugin_prefs, |
| 950 content::WebPluginInfo* plugin_info) { | 949 content::WebPluginInfo* plugin_info) { |
| 951 if (!plugin_prefs) | 950 if (!plugin_prefs) |
| 952 return false; | 951 return false; |
| 953 | 952 |
| 954 content::PluginService* plugin_service = | 953 content::PluginService* plugin_service = |
| 955 content::PluginService::GetInstance(); | 954 content::PluginService::GetInstance(); |
| 956 std::vector<content::WebPluginInfo> plugins; | 955 std::vector<content::WebPluginInfo> plugins; |
| 957 plugin_service->GetPluginInfoArray( | 956 plugin_service->GetPluginInfoArray( |
| 958 GURL(), kFlashPluginSwfMimeType, false, &plugins, NULL); | 957 GURL(), content::kFlashPluginSwfMimeType, false, &plugins, NULL); |
| 959 | 958 |
| 960 for (std::vector<content::WebPluginInfo>::iterator iter = plugins.begin(); | 959 for (std::vector<content::WebPluginInfo>::iterator iter = plugins.begin(); |
| 961 iter != plugins.end(); ++iter) { | 960 iter != plugins.end(); ++iter) { |
| 962 if (iter->is_pepper_plugin() && plugin_prefs->IsPluginEnabled(*iter)) { | 961 if (iter->is_pepper_plugin() && plugin_prefs->IsPluginEnabled(*iter)) { |
| 963 if (plugin_info) | 962 if (plugin_info) |
| 964 *plugin_info = *iter; | 963 *plugin_info = *iter; |
| 965 return true; | 964 return true; |
| 966 } | 965 } |
| 967 } | 966 } |
| 968 return false; | 967 return false; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 } | 1062 } |
| 1064 | 1063 |
| 1065 void PepperFlashSettingsManager::OnError(Core* core) { | 1064 void PepperFlashSettingsManager::OnError(Core* core) { |
| 1066 DCHECK(core); | 1065 DCHECK(core); |
| 1067 if (core != core_.get()) | 1066 if (core != core_.get()) |
| 1068 return; | 1067 return; |
| 1069 | 1068 |
| 1070 core_->Detach(); | 1069 core_->Detach(); |
| 1071 core_ = NULL; | 1070 core_ = NULL; |
| 1072 } | 1071 } |
| OLD | NEW |