| 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> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 11 #include "base/sequenced_task_runner_helpers.h" | 11 #include "base/sequenced_task_runner_helpers.h" |
| 12 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "base/version.h" | 14 #include "base/version.h" |
| 15 #include "content/browser/plugin_process_host.h" | 15 #include "content/browser/plugin_process_host.h" |
| 16 #include "content/browser/plugin_service_impl.h" | 16 #include "content/browser/plugin_service_impl.h" |
| 17 #include "content/browser/renderer_host/pepper/pepper_flash_file_message_filter.
h" | 17 #include "content/browser/renderer_host/pepper/pepper_flash_file_message_filter.
h" |
| 18 #include "content/common/child_process_host_impl.h" | 18 #include "content/common/child_process_host_impl.h" |
| 19 #include "content/common/plugin_messages.h" | 19 #include "content/common/plugin_process_messages.h" |
| 20 #include "content/public/browser/browser_context.h" | 20 #include "content/public/browser/browser_context.h" |
| 21 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 22 #include "content/public/common/pepper_plugin_info.h" | 22 #include "content/public/common/pepper_plugin_info.h" |
| 23 #include "ppapi/proxy/ppapi_messages.h" | 23 #include "ppapi/proxy/ppapi_messages.h" |
| 24 #include "webkit/plugins/npapi/plugin_utils.h" | 24 #include "webkit/plugins/npapi/plugin_utils.h" |
| 25 #include "webkit/plugins/plugin_constants.h" | 25 #include "webkit/plugins/plugin_constants.h" |
| 26 | 26 |
| 27 namespace content { | 27 namespace content { |
| 28 | 28 |
| 29 namespace { | 29 namespace { |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 if (!channel_handle.name.empty()) | 170 if (!channel_handle.name.empty()) |
| 171 ConnectToChannel(channel_handle, true); | 171 ConnectToChannel(channel_handle, true); |
| 172 | 172 |
| 173 // Balancing the AddRef call. | 173 // Balancing the AddRef call. |
| 174 Release(); | 174 Release(); |
| 175 } | 175 } |
| 176 | 176 |
| 177 // IPC::Listener methods. | 177 // IPC::Listener methods. |
| 178 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { | 178 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { |
| 179 IPC_BEGIN_MESSAGE_MAP(Context, message) | 179 IPC_BEGIN_MESSAGE_MAP(Context, message) |
| 180 IPC_MESSAGE_HANDLER(PluginHostMsg_ClearSiteDataResult, | 180 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ClearSiteDataResult, |
| 181 OnClearSiteDataResult) | 181 OnClearSiteDataResult) |
| 182 IPC_MESSAGE_HANDLER(PpapiHostMsg_ClearSiteDataResult, | 182 IPC_MESSAGE_HANDLER(PpapiHostMsg_ClearSiteDataResult, |
| 183 OnPpapiClearSiteDataResult) | 183 OnPpapiClearSiteDataResult) |
| 184 IPC_MESSAGE_UNHANDLED_ERROR() | 184 IPC_MESSAGE_UNHANDLED_ERROR() |
| 185 IPC_END_MESSAGE_MAP() | 185 IPC_END_MESSAGE_MAP() |
| 186 | 186 |
| 187 return true; | 187 return true; |
| 188 } | 188 } |
| 189 | 189 |
| 190 virtual void OnChannelError() OVERRIDE { | 190 virtual void OnChannelError() OVERRIDE { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 } | 236 } |
| 237 | 237 |
| 238 uint64 max_age = begin_time_.is_null() ? | 238 uint64 max_age = begin_time_.is_null() ? |
| 239 std::numeric_limits<uint64>::max() : | 239 std::numeric_limits<uint64>::max() : |
| 240 (base::Time::Now() - begin_time_).InSeconds(); | 240 (base::Time::Now() - begin_time_).InSeconds(); |
| 241 | 241 |
| 242 IPC::Message* msg; | 242 IPC::Message* msg; |
| 243 if (is_ppapi) { | 243 if (is_ppapi) { |
| 244 msg = CreatePpapiClearSiteDataMsg(max_age); | 244 msg = CreatePpapiClearSiteDataMsg(max_age); |
| 245 } else { | 245 } else { |
| 246 msg = new PluginMsg_ClearSiteData(std::string(), kClearAllData, max_age); | 246 msg = new PluginProcessMsg_ClearSiteData( |
| 247 std::string(), kClearAllData, max_age); |
| 247 } | 248 } |
| 248 if (!channel_->Send(msg)) { | 249 if (!channel_->Send(msg)) { |
| 249 NOTREACHED() << "Couldn't send ClearSiteData message"; | 250 NOTREACHED() << "Couldn't send ClearSiteData message"; |
| 250 SignalDone(); | 251 SignalDone(); |
| 251 return; | 252 return; |
| 252 } | 253 } |
| 253 } | 254 } |
| 254 | 255 |
| 255 // Handles the PpapiHostMsg_ClearSiteDataResult message by delegating to the | 256 // Handles the PpapiHostMsg_ClearSiteDataResult message by delegating to the |
| 256 // PluginHostMsg_ClearSiteDataResult handler. | 257 // PluginProcessHostMsg_ClearSiteDataResult handler. |
| 257 void OnPpapiClearSiteDataResult(uint32 request_id, bool success) { | 258 void OnPpapiClearSiteDataResult(uint32 request_id, bool success) { |
| 258 DCHECK_EQ(0u, request_id); | 259 DCHECK_EQ(0u, request_id); |
| 259 OnClearSiteDataResult(success); | 260 OnClearSiteDataResult(success); |
| 260 } | 261 } |
| 261 | 262 |
| 262 // Handles the PluginHostMsg_ClearSiteDataResult message. | 263 // Handles the PluginProcessHostMsg_ClearSiteDataResult message. |
| 263 void OnClearSiteDataResult(bool success) { | 264 void OnClearSiteDataResult(bool success) { |
| 264 LOG_IF(ERROR, !success) << "ClearSiteData returned error"; | 265 LOG_IF(ERROR, !success) << "ClearSiteData returned error"; |
| 265 UMA_HISTOGRAM_TIMES("ClearPluginData.time", | 266 UMA_HISTOGRAM_TIMES("ClearPluginData.time", |
| 266 base::Time::Now() - remove_start_time_); | 267 base::Time::Now() - remove_start_time_); |
| 267 SignalDone(); | 268 SignalDone(); |
| 268 } | 269 } |
| 269 | 270 |
| 270 // Signals that we are finished with removing data (successful or not). This | 271 // Signals that we are finished with removing data (successful or not). This |
| 271 // method is safe to call multiple times. | 272 // method is safe to call multiple times. |
| 272 void SignalDone() { | 273 void SignalDone() { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 | 311 |
| 311 base::WaitableEvent* PluginDataRemoverImpl::StartRemoving( | 312 base::WaitableEvent* PluginDataRemoverImpl::StartRemoving( |
| 312 base::Time begin_time) { | 313 base::Time begin_time) { |
| 313 DCHECK(!context_.get()); | 314 DCHECK(!context_.get()); |
| 314 context_ = new Context(begin_time, browser_context_); | 315 context_ = new Context(begin_time, browser_context_); |
| 315 context_->Init(mime_type_); | 316 context_->Init(mime_type_); |
| 316 return context_->event(); | 317 return context_->event(); |
| 317 } | 318 } |
| 318 | 319 |
| 319 } // namespace content | 320 } // namespace content |
| OLD | NEW |