OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/plugin_data_remover.h" | 5 #include "chrome/browser/plugin_data_remover.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
11 #include "base/synchronization/waitable_event.h" | 11 #include "base/synchronization/waitable_event.h" |
12 #include "base/version.h" | 12 #include "base/version.h" |
13 #include "chrome/browser/plugin_prefs.h" | 13 #include "chrome/browser/plugin_prefs.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
16 #include "content/browser/browser_thread.h" | 16 #include "content/browser/browser_thread.h" |
17 #include "content/browser/plugin_service.h" | 17 #include "content/browser/plugin_service.h" |
18 #include "content/common/plugin_messages.h" | 18 #include "content/common/plugin_messages.h" |
19 #include "webkit/plugins/npapi/plugin_group.h" | 19 #include "webkit/plugins/npapi/plugin_group.h" |
20 #include "webkit/plugins/npapi/plugin_list.h" | |
21 | 20 |
22 #if defined(OS_POSIX) | 21 #if defined(OS_POSIX) |
23 #include "ipc/ipc_channel_posix.h" | 22 #include "ipc/ipc_channel_posix.h" |
24 #endif | 23 #endif |
25 | 24 |
26 namespace { | 25 namespace { |
27 | 26 |
28 const char kFlashMimeType[] = "application/x-shockwave-flash"; | 27 const char kFlashMimeType[] = "application/x-shockwave-flash"; |
29 // The minimum Flash Player version that implements NPP_ClearSiteData. | 28 // The minimum Flash Player version that implements NPP_ClearSiteData. |
30 const char kMinFlashVersion[] = "10.3"; | 29 const char kMinFlashVersion[] = "10.3"; |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 void PluginDataRemover::SignalDone() { | 173 void PluginDataRemover::SignalDone() { |
175 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 174 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
176 if (!is_removing_) | 175 if (!is_removing_) |
177 return; | 176 return; |
178 is_removing_ = false; | 177 is_removing_ = false; |
179 event_->Signal(); | 178 event_->Signal(); |
180 } | 179 } |
181 | 180 |
182 // static | 181 // static |
183 bool PluginDataRemover::IsSupported(PluginPrefs* plugin_prefs) { | 182 bool PluginDataRemover::IsSupported(PluginPrefs* plugin_prefs) { |
184 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | |
185 bool allow_wildcard = false; | 183 bool allow_wildcard = false; |
186 std::vector<webkit::WebPluginInfo> plugins; | 184 std::vector<webkit::WebPluginInfo> plugins; |
187 webkit::npapi::PluginList::Singleton()->GetPluginInfoArray( | 185 PluginService::GetInstance()->GetPluginInfoArray( |
188 GURL(), kFlashMimeType, allow_wildcard, NULL, &plugins, NULL); | 186 GURL(), kFlashMimeType, allow_wildcard, &plugins, NULL); |
189 std::vector<webkit::WebPluginInfo>::iterator plugin = plugins.begin(); | 187 std::vector<webkit::WebPluginInfo>::iterator plugin = plugins.begin(); |
190 if (plugin == plugins.end()) | 188 if (plugin == plugins.end()) |
191 return false; | 189 return false; |
192 scoped_ptr<Version> version( | 190 scoped_ptr<Version> version( |
193 webkit::npapi::PluginGroup::CreateVersionFromString(plugin->version)); | 191 webkit::npapi::PluginGroup::CreateVersionFromString(plugin->version)); |
194 scoped_ptr<Version> min_version(Version::GetVersionFromString( | 192 scoped_ptr<Version> min_version(Version::GetVersionFromString( |
195 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 193 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
196 switches::kMinClearSiteDataFlashVersion))); | 194 switches::kMinClearSiteDataFlashVersion))); |
197 if (!min_version.get()) | 195 if (!min_version.get()) |
198 min_version.reset(Version::GetVersionFromString(kMinFlashVersion)); | 196 min_version.reset(Version::GetVersionFromString(kMinFlashVersion)); |
199 return plugin_prefs->IsPluginEnabled(*plugin) && | 197 return plugin_prefs->IsPluginEnabled(*plugin) && |
200 version.get() && | 198 version.get() && |
201 min_version->CompareTo(*version) == -1; | 199 min_version->CompareTo(*version) == -1; |
202 } | 200 } |
OLD | NEW |