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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 scoped_ptr<Version> version( | 52 scoped_ptr<Version> version( |
53 webkit::npapi::PluginGroup::CreateVersionFromString(it->version)); | 53 webkit::npapi::PluginGroup::CreateVersionFromString(it->version)); |
54 if (version.get() && min_version->CompareTo(*version) == -1) | 54 if (version.get() && min_version->CompareTo(*version) == -1) |
55 supported_plugins->push_back(*it); | 55 supported_plugins->push_back(*it); |
56 } | 56 } |
57 } | 57 } |
58 | 58 |
59 class PluginDataRemoverImpl::Context | 59 class PluginDataRemoverImpl::Context |
60 : public PluginProcessHost::Client, | 60 : public PluginProcessHost::Client, |
61 public PpapiPluginProcessHost::BrokerClient, | 61 public PpapiPluginProcessHost::BrokerClient, |
62 public IPC::Channel::Listener, | 62 public IPC::Listener, |
63 public base::RefCountedThreadSafe<Context, | 63 public base::RefCountedThreadSafe<Context, |
64 BrowserThread::DeleteOnIOThread> { | 64 BrowserThread::DeleteOnIOThread> { |
65 public: | 65 public: |
66 Context(base::Time begin_time, BrowserContext* browser_context) | 66 Context(base::Time begin_time, BrowserContext* browser_context) |
67 : event_(new base::WaitableEvent(true, false)), | 67 : event_(new base::WaitableEvent(true, false)), |
68 begin_time_(begin_time), | 68 begin_time_(begin_time), |
69 is_removing_(false), | 69 is_removing_(false), |
70 browser_context_path_(browser_context->GetPath()), | 70 browser_context_path_(browser_context->GetPath()), |
71 resource_context_(browser_context->GetResourceContext()), | 71 resource_context_(browser_context->GetResourceContext()), |
72 channel_(NULL) { | 72 channel_(NULL) { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 virtual void OnPpapiChannelOpened( | 165 virtual void OnPpapiChannelOpened( |
166 const IPC::ChannelHandle& channel_handle, | 166 const IPC::ChannelHandle& channel_handle, |
167 int /* child_id */) OVERRIDE { | 167 int /* child_id */) OVERRIDE { |
168 if (!channel_handle.name.empty()) | 168 if (!channel_handle.name.empty()) |
169 ConnectToChannel(channel_handle, true); | 169 ConnectToChannel(channel_handle, true); |
170 | 170 |
171 // Balancing the AddRef call. | 171 // Balancing the AddRef call. |
172 Release(); | 172 Release(); |
173 } | 173 } |
174 | 174 |
175 // IPC::Channel::Listener methods. | 175 // IPC::Listener methods. |
176 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { | 176 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { |
177 IPC_BEGIN_MESSAGE_MAP(Context, message) | 177 IPC_BEGIN_MESSAGE_MAP(Context, message) |
178 IPC_MESSAGE_HANDLER(PluginHostMsg_ClearSiteDataResult, | 178 IPC_MESSAGE_HANDLER(PluginHostMsg_ClearSiteDataResult, |
179 OnClearSiteDataResult) | 179 OnClearSiteDataResult) |
180 IPC_MESSAGE_HANDLER(PpapiHostMsg_ClearSiteDataResult, | 180 IPC_MESSAGE_HANDLER(PpapiHostMsg_ClearSiteDataResult, |
181 OnClearSiteDataResult) | 181 OnClearSiteDataResult) |
182 IPC_MESSAGE_UNHANDLED_ERROR() | 182 IPC_MESSAGE_UNHANDLED_ERROR() |
183 IPC_END_MESSAGE_MAP() | 183 IPC_END_MESSAGE_MAP() |
184 | 184 |
185 return true; | 185 return true; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 | 296 |
297 base::WaitableEvent* PluginDataRemoverImpl::StartRemoving( | 297 base::WaitableEvent* PluginDataRemoverImpl::StartRemoving( |
298 base::Time begin_time) { | 298 base::Time begin_time) { |
299 DCHECK(!context_.get()); | 299 DCHECK(!context_.get()); |
300 context_ = new Context(begin_time, browser_context_); | 300 context_ = new Context(begin_time, browser_context_); |
301 context_->Init(mime_type_); | 301 context_->Init(mime_type_); |
302 return context_->event(); | 302 return context_->event(); |
303 } | 303 } |
304 | 304 |
305 } // namespace content | 305 } // namespace content |
OLD | NEW |