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