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

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

Issue 12213066: Use base namespace for FilePath in content/browser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
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 <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"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 base::TimeDelta::FromMilliseconds(kRemovalTimeoutMs)); 86 base::TimeDelta::FromMilliseconds(kRemovalTimeoutMs));
87 } 87 }
88 88
89 void InitOnIOThread(const std::string& mime_type) { 89 void InitOnIOThread(const std::string& mime_type) {
90 PluginServiceImpl* plugin_service = PluginServiceImpl::GetInstance(); 90 PluginServiceImpl* plugin_service = PluginServiceImpl::GetInstance();
91 91
92 // Get the plugin file path. 92 // Get the plugin file path.
93 std::vector<webkit::WebPluginInfo> plugins; 93 std::vector<webkit::WebPluginInfo> plugins;
94 plugin_service->GetPluginInfoArray( 94 plugin_service->GetPluginInfoArray(
95 GURL(), mime_type, false, &plugins, NULL); 95 GURL(), mime_type, false, &plugins, NULL);
96 FilePath plugin_path; 96 base::FilePath plugin_path;
97 if (!plugins.empty()) // May be empty for some tests. 97 if (!plugins.empty()) // May be empty for some tests.
98 plugin_path = plugins[0].path; 98 plugin_path = plugins[0].path;
99 99
100 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 100 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
101 remove_start_time_ = base::Time::Now(); 101 remove_start_time_ = base::Time::Now();
102 is_removing_ = true; 102 is_removing_ = true;
103 // Balanced in On[Ppapi]ChannelOpened or OnError. Exactly one them will 103 // Balanced in On[Ppapi]ChannelOpened or OnError. Exactly one them will
104 // eventually be called, so we need to keep this object around until then. 104 // eventually be called, so we need to keep this object around until then.
105 AddRef(); 105 AddRef();
106 106
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 195 }
196 196
197 base::WaitableEvent* event() { return event_.get(); } 197 base::WaitableEvent* event() { return event_.get(); }
198 198
199 private: 199 private:
200 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; 200 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>;
201 friend class base::DeleteHelper<Context>; 201 friend class base::DeleteHelper<Context>;
202 virtual ~Context() {} 202 virtual ~Context() {}
203 203
204 IPC::Message* CreatePpapiClearSiteDataMsg(uint64 max_age) { 204 IPC::Message* CreatePpapiClearSiteDataMsg(uint64 max_age) {
205 FilePath profile_path = 205 base::FilePath profile_path =
206 PepperFlashFileMessageFilter::GetDataDirName(browser_context_path_); 206 PepperFlashFileMessageFilter::GetDataDirName(browser_context_path_);
207 // TODO(vtl): This "duplicates" logic in webkit/plugins/ppapi/file_path.cc 207 // TODO(vtl): This "duplicates" logic in webkit/plugins/ppapi/file_path.cc
208 // (which prepends the plugin name to the relative part of the path 208 // (which prepends the plugin name to the relative part of the path
209 // instead, with the absolute, profile-dependent part being enforced by 209 // instead, with the absolute, profile-dependent part being enforced by
210 // the browser). 210 // the browser).
211 #if defined(OS_WIN) 211 #if defined(OS_WIN)
212 FilePath plugin_data_path = 212 base::FilePath plugin_data_path =
213 profile_path.Append(FilePath(UTF8ToUTF16(plugin_name_))); 213 profile_path.Append(base::FilePath(UTF8ToUTF16(plugin_name_)));
214 #else 214 #else
215 FilePath plugin_data_path = profile_path.Append(FilePath(plugin_name_)); 215 base::FilePath plugin_data_path =
216 profile_path.Append(base::FilePath(plugin_name_));
216 #endif // defined(OS_WIN) 217 #endif // defined(OS_WIN)
217 return new PpapiMsg_ClearSiteData(0u, plugin_data_path, std::string(), 218 return new PpapiMsg_ClearSiteData(0u, plugin_data_path, std::string(),
218 kClearAllData, max_age); 219 kClearAllData, max_age);
219 } 220 }
220 221
221 // Connects the client side of a newly opened plug-in channel. 222 // Connects the client side of a newly opened plug-in channel.
222 void ConnectToChannel(const IPC::ChannelHandle& handle, bool is_ppapi) { 223 void ConnectToChannel(const IPC::ChannelHandle& handle, bool is_ppapi) {
223 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 224 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
224 225
225 // If we timed out, don't bother connecting. 226 // If we timed out, don't bother connecting.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 279
279 scoped_ptr<base::WaitableEvent> event_; 280 scoped_ptr<base::WaitableEvent> event_;
280 // The point in time when we start removing data. 281 // The point in time when we start removing data.
281 base::Time remove_start_time_; 282 base::Time remove_start_time_;
282 // The point in time from which on we remove data. 283 // The point in time from which on we remove data.
283 base::Time begin_time_; 284 base::Time begin_time_;
284 bool is_removing_; 285 bool is_removing_;
285 286
286 // Path for the current profile. Must be retrieved on the UI thread from the 287 // Path for the current profile. Must be retrieved on the UI thread from the
287 // browser context when we start so we can use it later on the I/O thread. 288 // browser context when we start so we can use it later on the I/O thread.
288 FilePath browser_context_path_; 289 base::FilePath browser_context_path_;
289 290
290 // The resource context for the profile. Use only on the I/O thread. 291 // The resource context for the profile. Use only on the I/O thread.
291 ResourceContext* resource_context_; 292 ResourceContext* resource_context_;
292 293
293 // The name of the plugin. Use only on the I/O thread. 294 // The name of the plugin. Use only on the I/O thread.
294 std::string plugin_name_; 295 std::string plugin_name_;
295 296
296 // The channel is NULL until we have opened a connection to the plug-in 297 // The channel is NULL until we have opened a connection to the plug-in
297 // process. 298 // process.
298 scoped_ptr<IPC::Channel> channel_; 299 scoped_ptr<IPC::Channel> channel_;
(...skipping 10 matching lines...) Expand all
309 310
310 base::WaitableEvent* PluginDataRemoverImpl::StartRemoving( 311 base::WaitableEvent* PluginDataRemoverImpl::StartRemoving(
311 base::Time begin_time) { 312 base::Time begin_time) {
312 DCHECK(!context_.get()); 313 DCHECK(!context_.get());
313 context_ = new Context(begin_time, browser_context_); 314 context_ = new Context(begin_time, browser_context_);
314 context_->Init(mime_type_); 315 context_->Init(mime_type_);
315 return context_->event(); 316 return context_->event();
316 } 317 }
317 318
318 } // namespace content 319 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/plugin_browsertest.cc ('k') | content/browser/plugin_data_remover_impl_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698