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> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
9 #include "base/sequenced_task_runner_helpers.h" | 11 #include "base/sequenced_task_runner_helpers.h" |
10 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
11 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
12 #include "base/version.h" | 14 #include "base/version.h" |
13 #include "content/browser/plugin_process_host.h" | 15 #include "content/browser/plugin_process_host.h" |
14 #include "content/browser/plugin_service_impl.h" | 16 #include "content/browser/plugin_service_impl.h" |
15 #include "content/browser/renderer_host/pepper/pepper_file_message_filter.h" | 17 #include "content/browser/renderer_host/pepper/pepper_file_message_filter.h" |
16 #include "content/common/child_process_host_impl.h" | 18 #include "content/common/child_process_host_impl.h" |
17 #include "content/common/plugin_messages.h" | 19 #include "content/common/plugin_messages.h" |
18 #include "content/public/browser/browser_context.h" | 20 #include "content/public/browser/browser_context.h" |
19 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
20 #include "content/public/common/pepper_plugin_info.h" | 22 #include "content/public/common/pepper_plugin_info.h" |
21 #include "ppapi/proxy/ppapi_messages.h" | 23 #include "ppapi/proxy/ppapi_messages.h" |
22 #include "webkit/plugins/npapi/plugin_utils.h" | 24 #include "webkit/plugins/npapi/plugin_utils.h" |
| 25 #include "webkit/plugins/plugin_constants.h" |
23 | 26 |
24 namespace content { | 27 namespace content { |
25 | 28 |
26 namespace { | 29 namespace { |
27 | 30 |
28 const char kFlashMimeType[] = "application/x-shockwave-flash"; | |
29 // The minimum Flash Player version that implements NPP_ClearSiteData. | 31 // The minimum Flash Player version that implements NPP_ClearSiteData. |
30 const char kMinFlashVersion[] = "10.3"; | 32 const char kMinFlashVersion[] = "10.3"; |
31 const int64 kRemovalTimeoutMs = 10000; | 33 const int64 kRemovalTimeoutMs = 10000; |
32 const uint64 kClearAllData = 0; | 34 const uint64 kClearAllData = 0; |
33 | 35 |
34 } // namespace | 36 } // namespace |
35 | 37 |
36 // static | 38 // static |
37 PluginDataRemover* PluginDataRemover::Create(BrowserContext* browser_context) { | 39 PluginDataRemover* PluginDataRemover::Create(BrowserContext* browser_context) { |
38 return new PluginDataRemoverImpl(browser_context); | 40 return new PluginDataRemoverImpl(browser_context); |
39 } | 41 } |
40 | 42 |
41 // static | 43 // static |
42 void PluginDataRemover::GetSupportedPlugins( | 44 void PluginDataRemover::GetSupportedPlugins( |
43 std::vector<webkit::WebPluginInfo>* supported_plugins) { | 45 std::vector<webkit::WebPluginInfo>* supported_plugins) { |
44 bool allow_wildcard = false; | 46 bool allow_wildcard = false; |
45 std::vector<webkit::WebPluginInfo> plugins; | 47 std::vector<webkit::WebPluginInfo> plugins; |
46 PluginService::GetInstance()->GetPluginInfoArray( | 48 PluginService::GetInstance()->GetPluginInfoArray( |
47 GURL(), kFlashMimeType, allow_wildcard, &plugins, NULL); | 49 GURL(), kFlashPluginSwfMimeType, allow_wildcard, &plugins, NULL); |
48 Version min_version(kMinFlashVersion); | 50 Version min_version(kMinFlashVersion); |
49 for (std::vector<webkit::WebPluginInfo>::iterator it = plugins.begin(); | 51 for (std::vector<webkit::WebPluginInfo>::iterator it = plugins.begin(); |
50 it != plugins.end(); ++it) { | 52 it != plugins.end(); ++it) { |
51 Version version; | 53 Version version; |
52 webkit::npapi::CreateVersionFromString(it->version, &version); | 54 webkit::npapi::CreateVersionFromString(it->version, &version); |
53 if (version.IsValid() && min_version.CompareTo(version) == -1) | 55 if (version.IsValid() && min_version.CompareTo(version) == -1) |
54 supported_plugins->push_back(*it); | 56 supported_plugins->push_back(*it); |
55 } | 57 } |
56 } | 58 } |
57 | 59 |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 // The name of the plugin. Use only on the I/O thread. | 288 // The name of the plugin. Use only on the I/O thread. |
287 std::string plugin_name_; | 289 std::string plugin_name_; |
288 | 290 |
289 // The channel is NULL until we have opened a connection to the plug-in | 291 // The channel is NULL until we have opened a connection to the plug-in |
290 // process. | 292 // process. |
291 scoped_ptr<IPC::Channel> channel_; | 293 scoped_ptr<IPC::Channel> channel_; |
292 }; | 294 }; |
293 | 295 |
294 | 296 |
295 PluginDataRemoverImpl::PluginDataRemoverImpl(BrowserContext* browser_context) | 297 PluginDataRemoverImpl::PluginDataRemoverImpl(BrowserContext* browser_context) |
296 : mime_type_(kFlashMimeType), | 298 : mime_type_(kFlashPluginSwfMimeType), |
297 browser_context_(browser_context) { | 299 browser_context_(browser_context) { |
298 } | 300 } |
299 | 301 |
300 PluginDataRemoverImpl::~PluginDataRemoverImpl() { | 302 PluginDataRemoverImpl::~PluginDataRemoverImpl() { |
301 } | 303 } |
302 | 304 |
303 base::WaitableEvent* PluginDataRemoverImpl::StartRemoving( | 305 base::WaitableEvent* PluginDataRemoverImpl::StartRemoving( |
304 base::Time begin_time) { | 306 base::Time begin_time) { |
305 DCHECK(!context_.get()); | 307 DCHECK(!context_.get()); |
306 context_ = new Context(begin_time, browser_context_); | 308 context_ = new Context(begin_time, browser_context_); |
307 context_->Init(mime_type_); | 309 context_->Init(mime_type_); |
308 return context_->event(); | 310 return context_->event(); |
309 } | 311 } |
310 | 312 |
311 } // namespace content | 313 } // namespace content |
OLD | NEW |