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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/message_loop_proxy.h" | 8 #include "base/message_loop_proxy.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 int PluginDataRemover::ID() { | 80 int PluginDataRemover::ID() { |
81 // Generate a unique identifier for this PluginProcessHostClient. | 81 // Generate a unique identifier for this PluginProcessHostClient. |
82 return ChildProcessInfo::GenerateChildProcessUniqueId(); | 82 return ChildProcessInfo::GenerateChildProcessUniqueId(); |
83 } | 83 } |
84 | 84 |
85 bool PluginDataRemover::OffTheRecord() { | 85 bool PluginDataRemover::OffTheRecord() { |
86 return false; | 86 return false; |
87 } | 87 } |
88 | 88 |
89 void PluginDataRemover::SetPluginInfo( | 89 void PluginDataRemover::SetPluginInfo( |
90 const webkit::npapi::WebPluginInfo& info) { | 90 const webkit::WebPluginInfo& info) { |
91 } | 91 } |
92 | 92 |
93 void PluginDataRemover::OnChannelOpened(const IPC::ChannelHandle& handle) { | 93 void PluginDataRemover::OnChannelOpened(const IPC::ChannelHandle& handle) { |
94 ConnectToChannel(handle); | 94 ConnectToChannel(handle); |
95 // Balancing the AddRef call in StartRemoving. | 95 // Balancing the AddRef call in StartRemoving. |
96 Release(); | 96 Release(); |
97 } | 97 } |
98 | 98 |
99 void PluginDataRemover::ConnectToChannel(const IPC::ChannelHandle& handle) { | 99 void PluginDataRemover::ConnectToChannel(const IPC::ChannelHandle& handle) { |
100 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 100 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 if (!is_removing_) | 161 if (!is_removing_) |
162 return; | 162 return; |
163 is_removing_ = false; | 163 is_removing_ = false; |
164 event_->Signal(); | 164 event_->Signal(); |
165 } | 165 } |
166 | 166 |
167 // static | 167 // static |
168 bool PluginDataRemover::IsSupported() { | 168 bool PluginDataRemover::IsSupported() { |
169 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 169 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
170 bool allow_wildcard = false; | 170 bool allow_wildcard = false; |
171 std::vector<webkit::npapi::WebPluginInfo> plugins; | 171 std::vector<webkit::WebPluginInfo> plugins; |
172 webkit::npapi::PluginList::Singleton()->GetPluginInfoArray( | 172 webkit::npapi::PluginList::Singleton()->GetPluginInfoArray( |
173 GURL(), kFlashMimeType, allow_wildcard, NULL, &plugins, NULL); | 173 GURL(), kFlashMimeType, allow_wildcard, NULL, &plugins, NULL); |
174 std::vector<webkit::npapi::WebPluginInfo>::iterator plugin = plugins.begin(); | 174 std::vector<webkit::WebPluginInfo>::iterator plugin = plugins.begin(); |
175 if (plugin == plugins.end()) | 175 if (plugin == plugins.end()) |
176 return false; | 176 return false; |
177 scoped_ptr<Version> version( | 177 scoped_ptr<Version> version( |
178 webkit::npapi::PluginGroup::CreateVersionFromString(plugin->version)); | 178 webkit::npapi::PluginGroup::CreateVersionFromString(plugin->version)); |
179 scoped_ptr<Version> min_version(Version::GetVersionFromString( | 179 scoped_ptr<Version> min_version(Version::GetVersionFromString( |
180 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 180 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
181 switches::kMinClearSiteDataFlashVersion))); | 181 switches::kMinClearSiteDataFlashVersion))); |
182 if (!min_version.get()) | 182 if (!min_version.get()) |
183 min_version.reset(Version::GetVersionFromString(kMinFlashVersion)); | 183 min_version.reset(Version::GetVersionFromString(kMinFlashVersion)); |
184 return webkit::npapi::IsPluginEnabled(*plugin) && | 184 return webkit::IsPluginEnabled(*plugin) && |
185 version.get() && | 185 version.get() && |
186 min_version->CompareTo(*version) == -1; | 186 min_version->CompareTo(*version) == -1; |
187 } | 187 } |
OLD | NEW |