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

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

Issue 8590016: Move the PluginDataRemover class to content, and remove the chrome pieces from it. This class rea... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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
« no previous file with comments | « chrome/browser/extensions/extension_clear_api.cc ('k') | chrome/browser/plugin_data_remover.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_PLUGIN_DATA_REMOVER_H_
6 #define CHROME_BROWSER_PLUGIN_DATA_REMOVER_H_
7 #pragma once
8
9 #include "base/memory/ref_counted.h"
10 #include "base/time.h"
11 #include "content/browser/plugin_process_host.h"
12
13 class PluginPrefs;
14 class Profile;
15 class Task;
16
17 namespace base {
18 class MessageLoopProxy;
19 class WaitableEvent;
20 }
21
22 class PluginDataRemover : public base::RefCountedThreadSafe<PluginDataRemover>,
23 public PluginProcessHost::Client,
24 public IPC::Channel::Listener {
25 public:
26 explicit PluginDataRemover(Profile* profile);
27
28 // The plug-in whose data should be removed (usually Flash) is specified via
29 // its MIME type. This method sets a different MIME type in order to call a
30 // different plug-in (for example in tests).
31 void set_mime_type(const std::string& mime_type) { mime_type_ = mime_type; }
32
33 // Starts removing plug-in data stored since |begin_time|.
34 base::WaitableEvent* StartRemoving(base::Time begin_time);
35
36 // Returns whether there is a plug-in installed that supports removing
37 // LSO data. This method will use cached plugin data. Call
38 // PluginService::GetPlugins() if the latest data is needed.
39 static bool IsSupported(PluginPrefs* plugin_prefs);
40
41 // Indicates whether we are still in the process of removing plug-in data.
42 bool is_removing() const { return is_removing_; }
43
44 // Wait until removing has finished. When the browser is still running (i.e.
45 // not during shutdown), you should use a WaitableEventWatcher in combination
46 // with the WaitableEvent returned by StartRemoving.
47 void Wait();
48
49 // PluginProcessHost::Client methods.
50 virtual int ID() OVERRIDE;
51 virtual bool OffTheRecord() OVERRIDE;
52 virtual const content::ResourceContext& GetResourceContext() OVERRIDE;
53 virtual void SetPluginInfo(const webkit::WebPluginInfo& info) OVERRIDE;
54 virtual void OnFoundPluginProcessHost(PluginProcessHost* host) OVERRIDE;
55 virtual void OnSentPluginChannelRequest() OVERRIDE;
56 virtual void OnChannelOpened(const IPC::ChannelHandle& handle) OVERRIDE;
57 virtual void OnError() OVERRIDE;
58
59 // IPC::Channel::Listener methods.
60 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
61 virtual void OnChannelError() OVERRIDE;
62
63 private:
64 friend class base::RefCountedThreadSafe<PluginDataRemover>;
65 friend class PluginDataRemoverTest;
66 virtual ~PluginDataRemover();
67
68 // Signals that we are finished with removing data (successful or not). This
69 // method is safe to call multiple times.
70 void SignalDone();
71 // Connects the client side of a newly opened plug-in channel.
72 void ConnectToChannel(const IPC::ChannelHandle& handle);
73 // Handles the PluginHostMsg_ClearSiteDataResult message.
74 void OnClearSiteDataResult(bool success);
75 // Called when a timeout happens in order not to block the client
76 // indefinitely.
77 void OnTimeout();
78
79 std::string mime_type_;
80 bool is_removing_;
81 // The point in time when we start removing data.
82 base::Time remove_start_time_;
83 // The point in time from which on we remove data.
84 base::Time begin_time_;
85 // The resource context for the profile.
86 const content::ResourceContext& context_;
87 scoped_ptr<base::WaitableEvent> event_;
88 // We own the channel, but it's used on the IO thread, so it needs to be
89 // deleted there. It's NULL until we have opened a connection to the plug-in
90 // process.
91 IPC::Channel* channel_;
92
93 DISALLOW_COPY_AND_ASSIGN(PluginDataRemover);
94 };
95
96 #endif // CHROME_BROWSER_PLUGIN_DATA_REMOVER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_clear_api.cc ('k') | chrome/browser/plugin_data_remover.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698