| 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 "content/browser/plugin_data_remover_impl.h" | 5 #include "content/browser/plugin_data_remover_impl.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 11 #include "base/sequenced_task_runner_helpers.h" | 11 #include "base/sequenced_task_runner_helpers.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/synchronization/waitable_event.h" | 13 #include "base/synchronization/waitable_event.h" |
| 14 #include "base/version.h" | 14 #include "base/version.h" |
| 15 #include "content/browser/plugin_process_host.h" | 15 #include "content/browser/plugin_process_host.h" |
| 16 #include "content/browser/plugin_service_impl.h" | 16 #include "content/browser/plugin_service_impl.h" |
| 17 #include "content/browser/renderer_host/pepper/pepper_flash_file_message_filter.
h" | 17 #include "content/browser/renderer_host/pepper/pepper_flash_file_message_filter.
h" |
| 18 #include "content/common/child_process_host_impl.h" | 18 #include "content/common/child_process_host_impl.h" |
| 19 #include "content/common/plugin_process_messages.h" | 19 #include "content/common/plugin_process_messages.h" |
| 20 #include "content/public/browser/browser_context.h" | 20 #include "content/public/browser/browser_context.h" |
| 21 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 22 #include "content/public/common/pepper_plugin_info.h" | 22 #include "content/public/common/pepper_plugin_info.h" |
| 23 #include "ppapi/proxy/ppapi_messages.h" | 23 #include "ppapi/proxy/ppapi_messages.h" |
| 24 #include "webkit/plugins/npapi/plugin_utils.h" | |
| 25 #include "webkit/plugins/plugin_constants.h" | 24 #include "webkit/plugins/plugin_constants.h" |
| 26 | 25 |
| 27 namespace content { | 26 namespace content { |
| 28 | 27 |
| 29 namespace { | 28 namespace { |
| 30 | 29 |
| 31 // The minimum Flash Player version that implements NPP_ClearSiteData. | 30 // The minimum Flash Player version that implements NPP_ClearSiteData. |
| 32 const char kMinFlashVersion[] = "10.3"; | 31 const char kMinFlashVersion[] = "10.3"; |
| 33 const int64 kRemovalTimeoutMs = 10000; | 32 const int64 kRemovalTimeoutMs = 10000; |
| 34 const uint64 kClearAllData = 0; | 33 const uint64 kClearAllData = 0; |
| 35 | 34 |
| 36 } // namespace | 35 } // namespace |
| 37 | 36 |
| 38 // static | 37 // static |
| 39 PluginDataRemover* PluginDataRemover::Create(BrowserContext* browser_context) { | 38 PluginDataRemover* PluginDataRemover::Create(BrowserContext* browser_context) { |
| 40 return new PluginDataRemoverImpl(browser_context); | 39 return new PluginDataRemoverImpl(browser_context); |
| 41 } | 40 } |
| 42 | 41 |
| 43 // static | 42 // static |
| 44 void PluginDataRemover::GetSupportedPlugins( | 43 void PluginDataRemover::GetSupportedPlugins( |
| 45 std::vector<webkit::WebPluginInfo>* supported_plugins) { | 44 std::vector<webkit::WebPluginInfo>* supported_plugins) { |
| 46 bool allow_wildcard = false; | 45 bool allow_wildcard = false; |
| 47 std::vector<webkit::WebPluginInfo> plugins; | 46 std::vector<webkit::WebPluginInfo> plugins; |
| 48 PluginService::GetInstance()->GetPluginInfoArray( | 47 PluginService::GetInstance()->GetPluginInfoArray( |
| 49 GURL(), kFlashPluginSwfMimeType, allow_wildcard, &plugins, NULL); | 48 GURL(), kFlashPluginSwfMimeType, allow_wildcard, &plugins, NULL); |
| 50 Version min_version(kMinFlashVersion); | 49 Version min_version(kMinFlashVersion); |
| 51 for (std::vector<webkit::WebPluginInfo>::iterator it = plugins.begin(); | 50 for (std::vector<webkit::WebPluginInfo>::iterator it = plugins.begin(); |
| 52 it != plugins.end(); ++it) { | 51 it != plugins.end(); ++it) { |
| 53 Version version; | 52 Version version; |
| 54 webkit::npapi::CreateVersionFromString(it->version, &version); | 53 webkit::WebPluginInfo::CreateVersionFromString(it->version, &version); |
| 55 if (version.IsValid() && min_version.CompareTo(version) == -1) | 54 if (version.IsValid() && min_version.CompareTo(version) == -1) |
| 56 supported_plugins->push_back(*it); | 55 supported_plugins->push_back(*it); |
| 57 } | 56 } |
| 58 } | 57 } |
| 59 | 58 |
| 60 class PluginDataRemoverImpl::Context | 59 class PluginDataRemoverImpl::Context |
| 61 : public PluginProcessHost::Client, | 60 : public PluginProcessHost::Client, |
| 62 public PpapiPluginProcessHost::BrokerClient, | 61 public PpapiPluginProcessHost::BrokerClient, |
| 63 public IPC::Listener, | 62 public IPC::Listener, |
| 64 public base::RefCountedThreadSafe<Context, | 63 public base::RefCountedThreadSafe<Context, |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 | 309 |
| 311 base::WaitableEvent* PluginDataRemoverImpl::StartRemoving( | 310 base::WaitableEvent* PluginDataRemoverImpl::StartRemoving( |
| 312 base::Time begin_time) { | 311 base::Time begin_time) { |
| 313 DCHECK(!context_.get()); | 312 DCHECK(!context_.get()); |
| 314 context_ = new Context(begin_time, browser_context_); | 313 context_ = new Context(begin_time, browser_context_); |
| 315 context_->Init(mime_type_); | 314 context_->Init(mime_type_); |
| 316 return context_->event(); | 315 return context_->event(); |
| 317 } | 316 } |
| 318 | 317 |
| 319 } // namespace content | 318 } // namespace content |
| OLD | NEW |