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

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

Issue 7387010: Add PluginServiceFilter interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unit test Created 9 years, 3 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
« no previous file with comments | « chrome/browser/pdf_unsupported_feature.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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/time.h" 10 #include "base/time.h"
11 #include "content/browser/plugin_process_host.h" 11 #include "content/browser/plugin_process_host.h"
12 12
13 class PluginPrefs; 13 class PluginPrefs;
14 class Profile;
14 class Task; 15 class Task;
15 16
16 namespace base { 17 namespace base {
17 class MessageLoopProxy; 18 class MessageLoopProxy;
18 class WaitableEvent; 19 class WaitableEvent;
19 } 20 }
20 21
21 class PluginDataRemover : public base::RefCountedThreadSafe<PluginDataRemover>, 22 class PluginDataRemover : public base::RefCountedThreadSafe<PluginDataRemover>,
22 public PluginProcessHost::Client, 23 public PluginProcessHost::Client,
23 public IPC::Channel::Listener { 24 public IPC::Channel::Listener {
24 public: 25 public:
25 PluginDataRemover(); 26 explicit PluginDataRemover(Profile* profile);
26 27
27 // The plug-in whose data should be removed (usually Flash) is specified via 28 // The plug-in whose data should be removed (usually Flash) is specified via
28 // its MIME type. This method sets a different MIME type in order to call a 29 // its MIME type. This method sets a different MIME type in order to call a
29 // different plug-in (for example in tests). 30 // different plug-in (for example in tests).
30 void set_mime_type(const std::string& mime_type) { mime_type_ = mime_type; } 31 void set_mime_type(const std::string& mime_type) { mime_type_ = mime_type; }
31 32
32 // Starts removing plug-in data stored since |begin_time|. 33 // Starts removing plug-in data stored since |begin_time|.
33 base::WaitableEvent* StartRemoving(base::Time begin_time); 34 base::WaitableEvent* StartRemoving(base::Time begin_time);
34 35
35 // Returns whether there is a plug-in installed that supports removing 36 // Returns whether there is a plug-in installed that supports removing
36 // LSO data. Because this method possibly has to load the plug-in list, it 37 // LSO data. Because this method possibly has to load the plug-in list, it
37 // should only be called on the FILE thread. 38 // should only be called on the FILE thread.
38 static bool IsSupported(PluginPrefs* plugin_prefs); 39 static bool IsSupported(PluginPrefs* plugin_prefs);
39 40
40 // Indicates whether we are still in the process of removing plug-in data. 41 // Indicates whether we are still in the process of removing plug-in data.
41 bool is_removing() const { return is_removing_; } 42 bool is_removing() const { return is_removing_; }
42 43
43 // Wait until removing has finished. When the browser is still running (i.e. 44 // Wait until removing has finished. When the browser is still running (i.e.
44 // not during shutdown), you should use a WaitableEventWatcher in combination 45 // not during shutdown), you should use a WaitableEventWatcher in combination
45 // with the WaitableEvent returned by StartRemoving. 46 // with the WaitableEvent returned by StartRemoving.
46 void Wait(); 47 void Wait();
47 48
48 // PluginProcessHost::Client methods. 49 // PluginProcessHost::Client methods.
49 virtual int ID(); 50 virtual int ID();
50 virtual bool OffTheRecord(); 51 virtual bool OffTheRecord();
52 virtual const content::ResourceContext& GetResourceContext();
51 virtual void SetPluginInfo(const webkit::WebPluginInfo& info); 53 virtual void SetPluginInfo(const webkit::WebPluginInfo& info);
52 virtual void OnChannelOpened(const IPC::ChannelHandle& handle); 54 virtual void OnChannelOpened(const IPC::ChannelHandle& handle);
53 virtual void OnError(); 55 virtual void OnError();
54 56
55 // IPC::Channel::Listener methods. 57 // IPC::Channel::Listener methods.
56 virtual bool OnMessageReceived(const IPC::Message& message); 58 virtual bool OnMessageReceived(const IPC::Message& message);
57 virtual void OnChannelError(); 59 virtual void OnChannelError();
58 60
59 private: 61 private:
60 friend class base::RefCountedThreadSafe<PluginDataRemover>; 62 friend class base::RefCountedThreadSafe<PluginDataRemover>;
(...skipping 10 matching lines...) Expand all
71 // Called when a timeout happens in order not to block the client 73 // Called when a timeout happens in order not to block the client
72 // indefinitely. 74 // indefinitely.
73 void OnTimeout(); 75 void OnTimeout();
74 76
75 std::string mime_type_; 77 std::string mime_type_;
76 bool is_removing_; 78 bool is_removing_;
77 // The point in time when we start removing data. 79 // The point in time when we start removing data.
78 base::Time remove_start_time_; 80 base::Time remove_start_time_;
79 // The point in time from which on we remove data. 81 // The point in time from which on we remove data.
80 base::Time begin_time_; 82 base::Time begin_time_;
83 // The resource context for the profile.
84 const content::ResourceContext& context_;
81 scoped_ptr<base::WaitableEvent> event_; 85 scoped_ptr<base::WaitableEvent> event_;
82 // We own the channel, but it's used on the IO thread, so it needs to be 86 // We own the channel, but it's used on the IO thread, so it needs to be
83 // deleted there. It's NULL until we have opened a connection to the plug-in 87 // deleted there. It's NULL until we have opened a connection to the plug-in
84 // process. 88 // process.
85 IPC::Channel* channel_; 89 IPC::Channel* channel_;
86 90
87 DISALLOW_COPY_AND_ASSIGN(PluginDataRemover); 91 DISALLOW_COPY_AND_ASSIGN(PluginDataRemover);
88 }; 92 };
89 93
90 #endif // CHROME_BROWSER_PLUGIN_DATA_REMOVER_H_ 94 #endif // CHROME_BROWSER_PLUGIN_DATA_REMOVER_H_
OLDNEW
« no previous file with comments | « chrome/browser/pdf_unsupported_feature.cc ('k') | chrome/browser/plugin_data_remover.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698