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

Side by Side Diff: chrome/browser/extensions/extension_clear_api.h

Issue 8223004: Check whether clearing LSO data is supported in clients of the BrowsingDataRemover. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unit test Created 9 years, 2 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) 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 // Defines the Chrome Extensions Clear API functions, which entail 5 // Defines the Chrome Extensions Clear API functions, which entail
6 // clearing browsing data, and clearing the browser's cache (which, let's be 6 // clearing browsing data, and clearing the browser's cache (which, let's be
7 // honest, are the same thing), as specified in 7 // honest, are the same thing), as specified in
8 // chrome/common/extensions/api/extension_api.json. 8 // chrome/common/extensions/api/extension_api.json.
9 9
10 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_CLEAR_API_H_ 10 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_CLEAR_API_H_
11 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_CLEAR_API_H_ 11 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_CLEAR_API_H_
12 #pragma once 12 #pragma once
13 13
14 #include <string> 14 #include <string>
15 15
16 #include "chrome/browser/browsing_data_remover.h" 16 #include "chrome/browser/browsing_data_remover.h"
17 #include "chrome/browser/extensions/extension_function.h" 17 #include "chrome/browser/extensions/extension_function.h"
18 18
19 namespace base { 19 namespace base {
20 class DictionaryValue; 20 class DictionaryValue;
21 } 21 }
22 22
23 class PluginPrefs;
24
23 // This serves as a base class from which the browsing data API functions will 25 // This serves as a base class from which the browsing data API functions will
24 // inherit. Each needs to be an observer of BrowsingDataRemover events, and each 26 // inherit. Each needs to be an observer of BrowsingDataRemover events, and each
25 // will handle those events in the same way (by calling the passed-in callback 27 // will handle those events in the same way (by calling the passed-in callback
26 // function). 28 // function).
27 // 29 //
28 // Each child class must implement GetRemovalMask(), which returns the bitmask 30 // Each child class must implement GetRemovalMask(), which returns the bitmask
29 // of data types to remove. 31 // of data types to remove.
30 class BrowsingDataExtensionFunction : public AsyncExtensionFunction, 32 class BrowsingDataExtensionFunction : public AsyncExtensionFunction,
31 public BrowsingDataRemover::Observer { 33 public BrowsingDataRemover::Observer {
32 public: 34 public:
33 // BrowsingDataRemover::Observer interface method. 35 // BrowsingDataRemover::Observer interface method.
34 virtual void OnBrowsingDataRemoverDone() OVERRIDE; 36 virtual void OnBrowsingDataRemoverDone() OVERRIDE;
35 37
36 // AsyncExtensionFunction interface method. 38 // AsyncExtensionFunction interface method.
37 virtual bool RunImpl() OVERRIDE; 39 virtual bool RunImpl() OVERRIDE;
38 40
39 protected: 41 protected:
40 // Children should override this method to provide the proper removal mask 42 // Children should override this method to provide the proper removal mask
41 // based on the API call they represent. 43 // based on the API call they represent.
42 virtual int GetRemovalMask() const = 0; 44 virtual int GetRemovalMask() const = 0;
45
46 private:
47 // Updates the removal bitmask according to whether removing LSO data is
48 // supported or not.
49 void CheckRemovingLSODataSupported(scoped_refptr<PluginPrefs> plugin_prefs);
50
51 // Called when we're ready to start removing data.
52 void StartRemoving();
53
54 BrowsingDataRemover::TimePeriod period_;
55 int removal_mask_;
43 }; 56 };
44 57
45 class ClearBrowsingDataFunction : public BrowsingDataExtensionFunction { 58 class ClearBrowsingDataFunction : public BrowsingDataExtensionFunction {
46 public: 59 public:
47 ClearBrowsingDataFunction() {} 60 ClearBrowsingDataFunction() {}
48 virtual ~ClearBrowsingDataFunction() {} 61 virtual ~ClearBrowsingDataFunction() {}
49 62
50 protected: 63 protected:
51 // BrowsingDataExtensionFunction interface method. 64 // BrowsingDataExtensionFunction interface method.
52 virtual int GetRemovalMask() const OVERRIDE; 65 virtual int GetRemovalMask() const OVERRIDE;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 virtual ~ClearPasswordsFunction() {} 133 virtual ~ClearPasswordsFunction() {}
121 134
122 protected: 135 protected:
123 // BrowsingDataTypeExtensionFunction interface method. 136 // BrowsingDataTypeExtensionFunction interface method.
124 virtual int GetRemovalMask() const OVERRIDE; 137 virtual int GetRemovalMask() const OVERRIDE;
125 138
126 DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.passwords") 139 DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.passwords")
127 }; 140 };
128 141
129 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_CLEAR_API_H_ 142 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_CLEAR_API_H_
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data_remover_unittest.cc ('k') | chrome/browser/extensions/extension_clear_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698