blob: ed074e083e60ab3c3f16b6a69e19ce315248fa83 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Defines the Chrome Extensions Clear API functions, which entail
// clearing browsing data, and clearing the browser's cache (which, let's be
// honest, are the same thing), as specified in
// chrome/common/extensions/api/extension_api.json.
#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_CLEAR_API_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_CLEAR_API_H_
#pragma once
#include <string>
#include "chrome/browser/browsing_data_remover.h"
#include "chrome/browser/extensions/extension_function.h"
namespace base {
class DictionaryValue;
}
class PluginPrefs;
// This serves as a base class from which the browsing data API functions will
// inherit. Each needs to be an observer of BrowsingDataRemover events, and each
// will handle those events in the same way (by calling the passed-in callback
// function).
//
// Each child class must implement GetRemovalMask(), which returns the bitmask
// of data types to remove.
class BrowsingDataExtensionFunction : public AsyncExtensionFunction,
public BrowsingDataRemover::Observer {
public:
// BrowsingDataRemover::Observer interface method.
virtual void OnBrowsingDataRemoverDone() OVERRIDE;
// AsyncExtensionFunction interface method.
virtual bool RunImpl() OVERRIDE;
protected:
// Children should override this method to provide the proper removal mask
// based on the API call they represent.
virtual int GetRemovalMask() const = 0;
private:
// Updates the removal bitmask according to whether removing LSO data is
// supported or not.
void CheckRemovingLSODataSupported(scoped_refptr<PluginPrefs> plugin_prefs);
// Called when we're ready to start removing data.
void StartRemoving();
BrowsingDataRemover::TimePeriod period_;
int removal_mask_;
};
class ClearBrowsingDataFunction : public BrowsingDataExtensionFunction {
public:
ClearBrowsingDataFunction() {}
virtual ~ClearBrowsingDataFunction() {}
protected:
// BrowsingDataExtensionFunction interface method.
virtual int GetRemovalMask() const OVERRIDE;
DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.browsingData")
};
class ClearCacheFunction : public BrowsingDataExtensionFunction {
public:
ClearCacheFunction() {}
virtual ~ClearCacheFunction() {}
protected:
// BrowsingDataTypeExtensionFunction interface method.
virtual int GetRemovalMask() const OVERRIDE;
DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.cache")
};
class ClearCookiesFunction : public BrowsingDataExtensionFunction {
public:
ClearCookiesFunction() {}
virtual ~ClearCookiesFunction() {}
protected:
// BrowsingDataTypeExtensionFunction interface method.
virtual int GetRemovalMask() const OVERRIDE;
DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.cookies")
};
class ClearDownloadsFunction : public BrowsingDataExtensionFunction {
public:
ClearDownloadsFunction() {}
virtual ~ClearDownloadsFunction() {}
protected:
// BrowsingDataTypeExtensionFunction interface method.
virtual int GetRemovalMask() const OVERRIDE;
DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.downloads")
};
class ClearFormDataFunction : public BrowsingDataExtensionFunction {
public:
ClearFormDataFunction() {}
virtual ~ClearFormDataFunction() {}
protected:
// BrowsingDataTypeExtensionFunction interface method.
virtual int GetRemovalMask() const OVERRIDE;
DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.formData")
};
class ClearHistoryFunction : public BrowsingDataExtensionFunction {
public:
ClearHistoryFunction() {}
virtual ~ClearHistoryFunction() {}
protected:
// BrowsingDataTypeExtensionFunction interface method.
virtual int GetRemovalMask() const OVERRIDE;
DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.history")
};
class ClearPasswordsFunction : public BrowsingDataExtensionFunction {
public:
ClearPasswordsFunction() {}
virtual ~ClearPasswordsFunction() {}
protected:
// BrowsingDataTypeExtensionFunction interface method.
virtual int GetRemovalMask() const OVERRIDE;
DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.passwords")
};
#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_CLEAR_API_H_
|