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

Side by Side Diff: chrome/browser/extensions/api/browsing_data/browsing_data_api.h

Issue 2298493003: [Extensions] Convert some ChromeSyncExtensionFunctions (Closed)
Patch Set: fix Created 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 BrowsingData API functions, which entail 5 // Defines the Chrome Extensions BrowsingData 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 the extension API JSON. 7 // honest, are the same thing), as specified in the extension API JSON.
8 8
9 #ifndef CHROME_BROWSER_EXTENSIONS_API_BROWSING_DATA_BROWSING_DATA_API_H_ 9 #ifndef CHROME_BROWSER_EXTENSIONS_API_BROWSING_DATA_BROWSING_DATA_API_H_
10 #define CHROME_BROWSER_EXTENSIONS_API_BROWSING_DATA_BROWSING_DATA_API_H_ 10 #define CHROME_BROWSER_EXTENSIONS_API_BROWSING_DATA_BROWSING_DATA_API_H_
11 11
12 #include <string> 12 #include <string>
13 13
14 #include "base/scoped_observer.h" 14 #include "base/scoped_observer.h"
15 #include "chrome/browser/browsing_data/browsing_data_remover.h" 15 #include "chrome/browser/browsing_data/browsing_data_remover.h"
16 #include "chrome/browser/extensions/chrome_extension_function.h" 16 #include "chrome/browser/extensions/chrome_extension_function.h"
17 17
18 class PluginPrefs; 18 class PluginPrefs;
19 class PrefService;
19 20
20 namespace extension_browsing_data_api_constants { 21 namespace extension_browsing_data_api_constants {
21 22
22 // Parameter name keys. 23 // Parameter name keys.
23 extern const char kDataRemovalPermittedKey[]; 24 extern const char kDataRemovalPermittedKey[];
24 extern const char kDataToRemoveKey[]; 25 extern const char kDataToRemoveKey[];
25 extern const char kOptionsKey[]; 26 extern const char kOptionsKey[];
26 27
27 // Type keys. 28 // Type keys.
28 extern const char kAppCacheKey[]; 29 extern const char kAppCacheKey[];
(...skipping 18 matching lines...) Expand all
47 extern const char kSinceKey[]; 48 extern const char kSinceKey[];
48 extern const char kUnprotectedWebKey[]; 49 extern const char kUnprotectedWebKey[];
49 50
50 // Errors! 51 // Errors!
51 extern const char kBadDataTypeDetails[]; 52 extern const char kBadDataTypeDetails[];
52 extern const char kDeleteProhibitedError[]; 53 extern const char kDeleteProhibitedError[];
53 extern const char kOneAtATimeError[]; 54 extern const char kOneAtATimeError[];
54 55
55 } // namespace extension_browsing_data_api_constants 56 } // namespace extension_browsing_data_api_constants
56 57
57 class BrowsingDataSettingsFunction : public ChromeSyncExtensionFunction { 58 class BrowsingDataSettingsFunction : public UIThreadExtensionFunction {
58 public: 59 public:
59 DECLARE_EXTENSION_FUNCTION("browsingData.settings", BROWSINGDATA_SETTINGS) 60 DECLARE_EXTENSION_FUNCTION("browsingData.settings", BROWSINGDATA_SETTINGS)
60 61
61 // ExtensionFunction: 62 // ExtensionFunction:
62 bool RunSync() override; 63 ResponseAction Run() override;
63 64
64 protected: 65 protected:
65 ~BrowsingDataSettingsFunction() override {} 66 ~BrowsingDataSettingsFunction() override {}
66 67
67 private: 68 private:
68 // Sets a boolean value in the |selected_dict| with the |data_type| as a key, 69 // Sets a boolean value in the |selected_dict| with the |data_type| as a key,
69 // indicating whether the data type is both selected and permitted to be 70 // indicating whether the data type is both selected and permitted to be
70 // removed; and a value in the |permitted_dict| with the |data_type| as a 71 // removed; and a value in the |permitted_dict| with the |data_type| as a
71 // key, indicating only whether the data type is permitted to be removed. 72 // key, indicating only whether the data type is permitted to be removed.
72 void SetDetails(base::DictionaryValue* selected_dict, 73 void SetDetails(base::DictionaryValue* selected_dict,
73 base::DictionaryValue* permitted_dict, 74 base::DictionaryValue* permitted_dict,
74 const char* data_type, 75 const char* data_type,
75 bool is_selected); 76 bool is_selected);
77
78 PrefService* prefs_ = nullptr;
76 }; 79 };
77 80
78 // This serves as a base class from which the browsing data API removal 81 // This serves as a base class from which the browsing data API removal
79 // functions will inherit. Each needs to be an observer of BrowsingDataRemover 82 // functions will inherit. Each needs to be an observer of BrowsingDataRemover
80 // events, and each will handle those events in the same way (by calling the 83 // events, and each will handle those events in the same way (by calling the
81 // passed-in callback function). 84 // passed-in callback function).
82 // 85 //
83 // Each child class must implement GetRemovalMask(), which returns the bitmask 86 // Each child class must implement GetRemovalMask(), which returns the bitmask
84 // of data types to remove. 87 // of data types to remove.
85 class BrowsingDataRemoverFunction : public ChromeAsyncExtensionFunction, 88 class BrowsingDataRemoverFunction : public ChromeAsyncExtensionFunction,
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 BROWSINGDATA_REMOVEWEBSQL) 300 BROWSINGDATA_REMOVEWEBSQL)
298 301
299 protected: 302 protected:
300 ~BrowsingDataRemoveWebSQLFunction() override {} 303 ~BrowsingDataRemoveWebSQLFunction() override {}
301 304
302 // BrowsingDataRemoverFunction: 305 // BrowsingDataRemoverFunction:
303 int GetRemovalMask() override; 306 int GetRemovalMask() override;
304 }; 307 };
305 308
306 #endif // CHROME_BROWSER_EXTENSIONS_API_BROWSING_DATA_BROWSING_DATA_API_H_ 309 #endif // CHROME_BROWSER_EXTENSIONS_API_BROWSING_DATA_BROWSING_DATA_API_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/browser/browser_api.cc ('k') | chrome/browser/extensions/api/browsing_data/browsing_data_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698