| 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" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 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 bool PluginDataRemover::IsSupported(webkit::WebPluginInfo* plugin) { | 42 void PluginDataRemover::GetSupportedPlugins( |
| 43 std::vector<webkit::WebPluginInfo>* supported_plugins) { |
| 43 bool allow_wildcard = false; | 44 bool allow_wildcard = false; |
| 44 std::vector<webkit::WebPluginInfo> plugins; | 45 std::vector<webkit::WebPluginInfo> plugins; |
| 45 PluginService::GetInstance()->GetPluginInfoArray( | 46 PluginService::GetInstance()->GetPluginInfoArray( |
| 46 GURL(), kFlashMimeType, allow_wildcard, &plugins, NULL); | 47 GURL(), kFlashMimeType, allow_wildcard, &plugins, NULL); |
| 47 std::vector<webkit::WebPluginInfo>::iterator plugin_it = plugins.begin(); | |
| 48 if (plugin_it == plugins.end()) | |
| 49 return false; | |
| 50 scoped_ptr<Version> version( | |
| 51 webkit::npapi::PluginGroup::CreateVersionFromString(plugin_it->version)); | |
| 52 scoped_ptr<Version> min_version( | 48 scoped_ptr<Version> min_version( |
| 53 Version::GetVersionFromString(kMinFlashVersion)); | 49 Version::GetVersionFromString(kMinFlashVersion)); |
| 54 bool rv = version.get() && min_version->CompareTo(*version) == -1; | 50 for (std::vector<webkit::WebPluginInfo>::iterator it = plugins.begin(); |
| 55 if (rv) | 51 it != plugins.end(); ++it) { |
| 56 *plugin = *plugin_it; | 52 scoped_ptr<Version> version( |
| 57 return rv; | 53 webkit::npapi::PluginGroup::CreateVersionFromString(it->version)); |
| 54 if (version.get() && min_version->CompareTo(*version) == -1) |
| 55 supported_plugins->push_back(*it); |
| 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::Channel::Listener, | 62 public IPC::Channel::Listener, |
| 64 public base::RefCountedThreadSafe<Context, | 63 public base::RefCountedThreadSafe<Context, |
| 65 BrowserThread::DeleteOnIOThread> { | 64 BrowserThread::DeleteOnIOThread> { |
| 66 public: | 65 public: |
| 67 Context(base::Time begin_time, BrowserContext* browser_context) | 66 Context(base::Time begin_time, BrowserContext* browser_context) |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 | 296 |
| 298 base::WaitableEvent* PluginDataRemoverImpl::StartRemoving( | 297 base::WaitableEvent* PluginDataRemoverImpl::StartRemoving( |
| 299 base::Time begin_time) { | 298 base::Time begin_time) { |
| 300 DCHECK(!context_.get()); | 299 DCHECK(!context_.get()); |
| 301 context_ = new Context(begin_time, browser_context_); | 300 context_ = new Context(begin_time, browser_context_); |
| 302 context_->Init(mime_type_); | 301 context_->Init(mime_type_); |
| 303 return context_->event(); | 302 return context_->event(); |
| 304 } | 303 } |
| 305 | 304 |
| 306 } // namespace content | 305 } // namespace content |
| OLD | NEW |