| OLD | NEW |
| 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_ |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 extern const char kDeleteProhibitedError[]; | 49 extern const char kDeleteProhibitedError[]; |
| 50 extern const char kOneAtATimeError[]; | 50 extern const char kOneAtATimeError[]; |
| 51 | 51 |
| 52 } // namespace extension_browsing_data_api_constants | 52 } // namespace extension_browsing_data_api_constants |
| 53 | 53 |
| 54 class BrowsingDataSettingsFunction : public ChromeSyncExtensionFunction { | 54 class BrowsingDataSettingsFunction : public ChromeSyncExtensionFunction { |
| 55 public: | 55 public: |
| 56 DECLARE_EXTENSION_FUNCTION("browsingData.settings", BROWSINGDATA_SETTINGS) | 56 DECLARE_EXTENSION_FUNCTION("browsingData.settings", BROWSINGDATA_SETTINGS) |
| 57 | 57 |
| 58 // ExtensionFunction: | 58 // ExtensionFunction: |
| 59 virtual bool RunImpl() OVERRIDE; | 59 virtual bool RunSync() OVERRIDE; |
| 60 | 60 |
| 61 protected: | 61 protected: |
| 62 virtual ~BrowsingDataSettingsFunction() {} | 62 virtual ~BrowsingDataSettingsFunction() {} |
| 63 | 63 |
| 64 private: | 64 private: |
| 65 // Sets a boolean value in the |selected_dict| with the |data_type| as a key, | 65 // Sets a boolean value in the |selected_dict| with the |data_type| as a key, |
| 66 // indicating whether the data type is both selected and permitted to be | 66 // indicating whether the data type is both selected and permitted to be |
| 67 // removed; and a value in the |permitted_dict| with the |data_type| as a | 67 // removed; and a value in the |permitted_dict| with the |data_type| as a |
| 68 // key, indicating only whether the data type is permitted to be removed. | 68 // key, indicating only whether the data type is permitted to be removed. |
| 69 void SetDetails(base::DictionaryValue* selected_dict, | 69 void SetDetails(base::DictionaryValue* selected_dict, |
| 70 base::DictionaryValue* permitted_dict, | 70 base::DictionaryValue* permitted_dict, |
| 71 const char* data_type, | 71 const char* data_type, |
| 72 bool is_selected); | 72 bool is_selected); |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 // This serves as a base class from which the browsing data API removal | 75 // This serves as a base class from which the browsing data API removal |
| 76 // functions will inherit. Each needs to be an observer of BrowsingDataRemover | 76 // functions will inherit. Each needs to be an observer of BrowsingDataRemover |
| 77 // events, and each will handle those events in the same way (by calling the | 77 // events, and each will handle those events in the same way (by calling the |
| 78 // passed-in callback function). | 78 // passed-in callback function). |
| 79 // | 79 // |
| 80 // Each child class must implement GetRemovalMask(), which returns the bitmask | 80 // Each child class must implement GetRemovalMask(), which returns the bitmask |
| 81 // of data types to remove. | 81 // of data types to remove. |
| 82 class BrowsingDataRemoverFunction : public ChromeAsyncExtensionFunction, | 82 class BrowsingDataRemoverFunction : public ChromeAsyncExtensionFunction, |
| 83 public BrowsingDataRemover::Observer { | 83 public BrowsingDataRemover::Observer { |
| 84 public: | 84 public: |
| 85 // BrowsingDataRemover::Observer interface method. | 85 // BrowsingDataRemover::Observer interface method. |
| 86 virtual void OnBrowsingDataRemoverDone() OVERRIDE; | 86 virtual void OnBrowsingDataRemoverDone() OVERRIDE; |
| 87 | 87 |
| 88 // ExtensionFunction: | 88 // ExtensionFunction: |
| 89 virtual bool RunImpl() OVERRIDE; | 89 virtual bool RunSync() OVERRIDE; |
| 90 | 90 |
| 91 protected: | 91 protected: |
| 92 virtual ~BrowsingDataRemoverFunction() {} | 92 virtual ~BrowsingDataRemoverFunction() {} |
| 93 | 93 |
| 94 // Children should override this method to provide the proper removal mask | 94 // Children should override this method to provide the proper removal mask |
| 95 // based on the API call they represent. | 95 // based on the API call they represent. |
| 96 virtual int GetRemovalMask() = 0; | 96 virtual int GetRemovalMask() = 0; |
| 97 | 97 |
| 98 private: | 98 private: |
| 99 // Updates the removal bitmask according to whether removing plugin data is | 99 // Updates the removal bitmask according to whether removing plugin data is |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 BROWSINGDATA_REMOVEWEBSQL) | 265 BROWSINGDATA_REMOVEWEBSQL) |
| 266 | 266 |
| 267 protected: | 267 protected: |
| 268 virtual ~BrowsingDataRemoveWebSQLFunction() {} | 268 virtual ~BrowsingDataRemoveWebSQLFunction() {} |
| 269 | 269 |
| 270 // BrowsingDataRemoverFunction: | 270 // BrowsingDataRemoverFunction: |
| 271 virtual int GetRemovalMask() OVERRIDE; | 271 virtual int GetRemovalMask() OVERRIDE; |
| 272 }; | 272 }; |
| 273 | 273 |
| 274 #endif // CHROME_BROWSER_EXTENSIONS_API_BROWSING_DATA_BROWSING_DATA_API_H_ | 274 #endif // CHROME_BROWSER_EXTENSIONS_API_BROWSING_DATA_BROWSING_DATA_API_H_ |
| OLD | NEW |