Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1403)

Side by Side Diff: content/browser/plugin_data_remover_impl.cc

Issue 1549113002: Switch to standard integer types in content/browser/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/plugin_data_remover_impl.h ('k') | content/browser/plugin_loader_posix.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stdint.h>
8
7 #include <limits> 9 #include <limits>
8 10
9 #include "base/bind.h" 11 #include "base/bind.h"
10 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
11 #include "base/sequenced_task_runner_helpers.h" 13 #include "base/sequenced_task_runner_helpers.h"
12 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
13 #include "base/synchronization/waitable_event.h" 15 #include "base/synchronization/waitable_event.h"
14 #include "base/version.h" 16 #include "base/version.h"
17 #include "build/build_config.h"
15 #include "content/browser/plugin_process_host.h" 18 #include "content/browser/plugin_process_host.h"
16 #include "content/browser/plugin_service_impl.h" 19 #include "content/browser/plugin_service_impl.h"
17 #include "content/browser/renderer_host/pepper/pepper_flash_file_message_filter. h" 20 #include "content/browser/renderer_host/pepper/pepper_flash_file_message_filter. h"
18 #include "content/common/child_process_host_impl.h" 21 #include "content/common/child_process_host_impl.h"
19 #include "content/common/plugin_process_messages.h" 22 #include "content/common/plugin_process_messages.h"
20 #include "content/public/browser/browser_context.h" 23 #include "content/public/browser/browser_context.h"
21 #include "content/public/browser/browser_thread.h" 24 #include "content/public/browser/browser_thread.h"
22 #include "content/public/common/child_process_host.h" 25 #include "content/public/common/child_process_host.h"
23 #include "content/public/common/content_constants.h" 26 #include "content/public/common/content_constants.h"
24 #include "content/public/common/pepper_plugin_info.h" 27 #include "content/public/common/pepper_plugin_info.h"
25 #include "ppapi/proxy/ppapi_messages.h" 28 #include "ppapi/proxy/ppapi_messages.h"
26 29
27 namespace content { 30 namespace content {
28 31
29 namespace { 32 namespace {
30 33
31 // The minimum Flash Player version that implements NPP_ClearSiteData. 34 // The minimum Flash Player version that implements NPP_ClearSiteData.
32 const char kMinFlashVersion[] = "10.3"; 35 const char kMinFlashVersion[] = "10.3";
33 const int64 kRemovalTimeoutMs = 10000; 36 const int64_t kRemovalTimeoutMs = 10000;
34 const uint64 kClearAllData = 0; 37 const uint64_t kClearAllData = 0;
35 38
36 } // namespace 39 } // namespace
37 40
38 // static 41 // static
39 PluginDataRemover* PluginDataRemover::Create(BrowserContext* browser_context) { 42 PluginDataRemover* PluginDataRemover::Create(BrowserContext* browser_context) {
40 return new PluginDataRemoverImpl(browser_context); 43 return new PluginDataRemoverImpl(browser_context);
41 } 44 }
42 45
43 // static 46 // static
44 void PluginDataRemover::GetSupportedPlugins( 47 void PluginDataRemover::GetSupportedPlugins(
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 } 196 }
194 } 197 }
195 198
196 base::WaitableEvent* event() { return event_.get(); } 199 base::WaitableEvent* event() { return event_.get(); }
197 200
198 private: 201 private:
199 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; 202 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>;
200 friend class base::DeleteHelper<Context>; 203 friend class base::DeleteHelper<Context>;
201 ~Context() override {} 204 ~Context() override {}
202 205
203 IPC::Message* CreatePpapiClearSiteDataMsg(uint64 max_age) { 206 IPC::Message* CreatePpapiClearSiteDataMsg(uint64_t max_age) {
204 base::FilePath profile_path = 207 base::FilePath profile_path =
205 PepperFlashFileMessageFilter::GetDataDirName(browser_context_path_); 208 PepperFlashFileMessageFilter::GetDataDirName(browser_context_path_);
206 // TODO(vtl): This "duplicates" logic in webkit/plugins/ppapi/file_path.cc 209 // TODO(vtl): This "duplicates" logic in webkit/plugins/ppapi/file_path.cc
207 // (which prepends the plugin name to the relative part of the path 210 // (which prepends the plugin name to the relative part of the path
208 // instead, with the absolute, profile-dependent part being enforced by 211 // instead, with the absolute, profile-dependent part being enforced by
209 // the browser). 212 // the browser).
210 #if defined(OS_WIN) 213 #if defined(OS_WIN)
211 base::FilePath plugin_data_path = 214 base::FilePath plugin_data_path =
212 profile_path.Append(base::FilePath(base::UTF8ToUTF16(plugin_name_))); 215 profile_path.Append(base::FilePath(base::UTF8ToUTF16(plugin_name_)));
213 #else 216 #else
(...skipping 13 matching lines...) Expand all
227 return; 230 return;
228 231
229 DCHECK(!channel_.get()); 232 DCHECK(!channel_.get());
230 channel_ = IPC::Channel::CreateClient(handle, this); 233 channel_ = IPC::Channel::CreateClient(handle, this);
231 if (!channel_->Connect()) { 234 if (!channel_->Connect()) {
232 NOTREACHED() << "Couldn't connect to plugin"; 235 NOTREACHED() << "Couldn't connect to plugin";
233 SignalDone(); 236 SignalDone();
234 return; 237 return;
235 } 238 }
236 239
237 uint64 max_age = begin_time_.is_null() ? 240 uint64_t max_age = begin_time_.is_null()
238 std::numeric_limits<uint64>::max() : 241 ? std::numeric_limits<uint64_t>::max()
239 (base::Time::Now() - begin_time_).InSeconds(); 242 : (base::Time::Now() - begin_time_).InSeconds();
240 243
241 IPC::Message* msg; 244 IPC::Message* msg;
242 if (is_ppapi) { 245 if (is_ppapi) {
243 msg = CreatePpapiClearSiteDataMsg(max_age); 246 msg = CreatePpapiClearSiteDataMsg(max_age);
244 } else { 247 } else {
245 msg = new PluginProcessMsg_ClearSiteData( 248 msg = new PluginProcessMsg_ClearSiteData(
246 std::string(), kClearAllData, max_age); 249 std::string(), kClearAllData, max_age);
247 } 250 }
248 if (!channel_->Send(msg)) { 251 if (!channel_->Send(msg)) {
249 NOTREACHED() << "Couldn't send ClearSiteData message"; 252 NOTREACHED() << "Couldn't send ClearSiteData message";
250 SignalDone(); 253 SignalDone();
251 return; 254 return;
252 } 255 }
253 } 256 }
254 257
255 // Handles the PpapiHostMsg_ClearSiteDataResult message by delegating to the 258 // Handles the PpapiHostMsg_ClearSiteDataResult message by delegating to the
256 // PluginProcessHostMsg_ClearSiteDataResult handler. 259 // PluginProcessHostMsg_ClearSiteDataResult handler.
257 void OnPpapiClearSiteDataResult(uint32 request_id, bool success) { 260 void OnPpapiClearSiteDataResult(uint32_t request_id, bool success) {
258 DCHECK_EQ(0u, request_id); 261 DCHECK_EQ(0u, request_id);
259 OnClearSiteDataResult(success); 262 OnClearSiteDataResult(success);
260 } 263 }
261 264
262 // Handles the PluginProcessHostMsg_ClearSiteDataResult message. 265 // Handles the PluginProcessHostMsg_ClearSiteDataResult message.
263 void OnClearSiteDataResult(bool success) { 266 void OnClearSiteDataResult(bool success) {
264 LOG_IF(ERROR, !success) << "ClearSiteData returned error"; 267 LOG_IF(ERROR, !success) << "ClearSiteData returned error";
265 UMA_HISTOGRAM_TIMES("ClearPluginData.time", 268 UMA_HISTOGRAM_TIMES("ClearPluginData.time",
266 base::Time::Now() - remove_start_time_); 269 base::Time::Now() - remove_start_time_);
267 SignalDone(); 270 SignalDone();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 313
311 base::WaitableEvent* PluginDataRemoverImpl::StartRemoving( 314 base::WaitableEvent* PluginDataRemoverImpl::StartRemoving(
312 base::Time begin_time) { 315 base::Time begin_time) {
313 DCHECK(!context_.get()); 316 DCHECK(!context_.get());
314 context_ = new Context(begin_time, browser_context_); 317 context_ = new Context(begin_time, browser_context_);
315 context_->Init(mime_type_); 318 context_->Init(mime_type_);
316 return context_->event(); 319 return context_->event();
317 } 320 }
318 321
319 } // namespace content 322 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/plugin_data_remover_impl.h ('k') | content/browser/plugin_loader_posix.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698