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

Side by Side Diff: chrome/browser/plugin_data_remover.h

Issue 5715001: Clean up PluginDataRemover. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: plugingroup Created 10 years 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_PLUGIN_DATA_REMOVER_H_ 5 #ifndef CHROME_BROWSER_PLUGIN_DATA_REMOVER_H_
6 #define CHROME_BROWSER_PLUGIN_DATA_REMOVER_H_ 6 #define CHROME_BROWSER_PLUGIN_DATA_REMOVER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/ref_counted.h" 9 #include "base/ref_counted.h"
10 #include "base/scoped_ptr.h"
11 #include "base/task.h"
10 #include "base/time.h" 12 #include "base/time.h"
11 #include "chrome/browser/plugin_process_host.h" 13 #include "ipc/ipc_channel.h"
12 #include "ipc/ipc_channel_proxy.h"
13 #include "ipc/ipc_message.h"
14 14
15 class Task; 15 class Task;
16 16
17 namespace base { 17 namespace base {
18 class MessageLoopProxy; 18 class MessageLoopProxy;
19 } 19 }
20 20
21 class PluginDataRemover : public PluginProcessHost::Client, 21 namespace IPC {
22 public IPC::Channel::Listener { 22 class ChannelHandle;
23 }
24
25 class PluginDataRemover : IPC::Channel::Listener {
23 public: 26 public:
24 PluginDataRemover(); 27 PluginDataRemover();
25 ~PluginDataRemover(); 28 ~PluginDataRemover();
26 29
27 // Starts removing plug-in data stored since |begin_time| and calls 30 // Starts removing plug-in data stored since |begin_time|. If |done_task| is
28 // |done_task| on the current thread when finished. 31 // not NULL, it is run on the current thread when removing has finished.
29 void StartRemoving(base::Time begin_time, Task* done_task); 32 void StartRemoving(base::Time begin_time, Task* done_task);
30 33
31 // PluginProcessHost::Client methods 34 // Returns whether there is a plug-in installed that supports removing
32 virtual int ID(); 35 // LSO data. Because this method possibly has to load the plug-in list, it
33 virtual bool OffTheRecord(); 36 // should only be called on the FILE thread.
34 virtual void SetPluginInfo(const WebPluginInfo& info); 37 static bool IsSupported();
35 virtual void OnChannelOpened(const IPC::ChannelHandle& handle); 38
36 virtual void OnError(); 39 bool is_removing() { return is_removing_; }
40
41 // Sets the task to run when removing has finished. Takes ownership of
42 // the passed task.
43 void set_done_task(Task* task) { done_task_.reset(task); }
44
45 private:
46 class Internal;
47
48 void OnChannelOpened(const IPC::ChannelHandle& handle);
49 void OnClearSiteDataResult(bool success);
50 void SignalDone();
37 51
38 // IPC::ChannelProxy::MessageFilter methods 52 // IPC::ChannelProxy::MessageFilter methods
39 virtual void OnMessageReceived(const IPC::Message& message); 53 virtual void OnMessageReceived(const IPC::Message& message);
40 virtual void OnChannelError(); 54 virtual void OnChannelError();
41 55
42 private:
43 void SignalDone();
44 void SignalError();
45 void OnClearSiteDataResult(bool success);
46 void OnTimeout();
47
48 scoped_refptr<base::MessageLoopProxy> message_loop_; 56 scoped_refptr<base::MessageLoopProxy> message_loop_;
57 bool is_removing_;
49 scoped_ptr<Task> done_task_; 58 scoped_ptr<Task> done_task_;
59 // The point in time when we start removing data.
60 base::Time remove_start_time_;
61 // The point in time from which on we remove data.
50 base::Time begin_time_; 62 base::Time begin_time_;
63 scoped_refptr<Internal> internal_;
51 // We own the channel, but it's used on the IO thread, so it needs to be 64 // We own the channel, but it's used on the IO thread, so it needs to be
52 // deleted there as well. 65 // deleted there as well.
53 IPC::Channel* channel_; 66 IPC::Channel* channel_;
54 ScopedRunnableMethodFactory<PluginDataRemover> method_factory_;
55 }; 67 };
56 68
57 #endif // CHROME_BROWSER_PLUGIN_DATA_REMOVER_H_ 69 #endif // CHROME_BROWSER_PLUGIN_DATA_REMOVER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/plugin_data_remover.cc » ('j') | chrome/browser/plugin_data_remover.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698