OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Defines the Chrome Extensions Clear API functions, which entail |
| 6 // clearing browsing data, and clearing the browser's cache (which, let's be |
| 7 // honest, are the same thing), as specified in |
| 8 // chrome/common/extensions/api/extension_api.json. |
| 9 |
| 10 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_CLEAR_API_H_ |
| 11 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_CLEAR_API_H_ |
| 12 #pragma once |
| 13 |
| 14 #include <string> |
| 15 |
| 16 #include "chrome/browser/browsing_data_remover.h" |
| 17 #include "chrome/browser/extensions/extension_function.h" |
| 18 |
| 19 namespace base { |
| 20 class DictionaryValue; |
| 21 } |
| 22 |
| 23 // 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 |
| 25 // will handle those events in the same way (by calling the passed-in callback |
| 26 // function). |
| 27 // |
| 28 // Each child class must implement GetRemovalMask(), which returns the bitmask |
| 29 // of data types to remove. |
| 30 class BrowsingDataExtensionFunction : public AsyncExtensionFunction, |
| 31 public BrowsingDataRemover::Observer { |
| 32 public: |
| 33 // BrowsingDataRemover::Observer interface method. |
| 34 virtual void OnBrowsingDataRemoverDone() OVERRIDE; |
| 35 |
| 36 // AsyncExtensionFunction interface method. |
| 37 virtual bool RunImpl() OVERRIDE; |
| 38 |
| 39 protected: |
| 40 // Children should override this method to provide the proper removal mask |
| 41 // based on the API call they represent. |
| 42 virtual int GetRemovalMask() const = 0; |
| 43 }; |
| 44 |
| 45 class ClearBrowsingDataFunction : public BrowsingDataExtensionFunction { |
| 46 public: |
| 47 ClearBrowsingDataFunction() {} |
| 48 virtual ~ClearBrowsingDataFunction() {} |
| 49 |
| 50 protected: |
| 51 // BrowsingDataExtensionFunction interface method. |
| 52 virtual int GetRemovalMask() const OVERRIDE; |
| 53 |
| 54 DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.browsingData") |
| 55 }; |
| 56 |
| 57 class ClearCacheFunction : public BrowsingDataExtensionFunction { |
| 58 public: |
| 59 ClearCacheFunction() {} |
| 60 virtual ~ClearCacheFunction() {} |
| 61 |
| 62 protected: |
| 63 // BrowsingDataTypeExtensionFunction interface method. |
| 64 virtual int GetRemovalMask() const OVERRIDE; |
| 65 |
| 66 DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.cache") |
| 67 }; |
| 68 |
| 69 class ClearCookiesFunction : public BrowsingDataExtensionFunction { |
| 70 public: |
| 71 ClearCookiesFunction() {} |
| 72 virtual ~ClearCookiesFunction() {} |
| 73 |
| 74 protected: |
| 75 // BrowsingDataTypeExtensionFunction interface method. |
| 76 virtual int GetRemovalMask() const OVERRIDE; |
| 77 |
| 78 DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.cookies") |
| 79 }; |
| 80 |
| 81 class ClearDownloadsFunction : public BrowsingDataExtensionFunction { |
| 82 public: |
| 83 ClearDownloadsFunction() {} |
| 84 virtual ~ClearDownloadsFunction() {} |
| 85 |
| 86 protected: |
| 87 // BrowsingDataTypeExtensionFunction interface method. |
| 88 virtual int GetRemovalMask() const OVERRIDE; |
| 89 |
| 90 DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.downloads") |
| 91 }; |
| 92 |
| 93 class ClearFormDataFunction : public BrowsingDataExtensionFunction { |
| 94 public: |
| 95 ClearFormDataFunction() {} |
| 96 virtual ~ClearFormDataFunction() {} |
| 97 |
| 98 protected: |
| 99 // BrowsingDataTypeExtensionFunction interface method. |
| 100 virtual int GetRemovalMask() const OVERRIDE; |
| 101 |
| 102 DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.formData") |
| 103 }; |
| 104 |
| 105 class ClearHistoryFunction : public BrowsingDataExtensionFunction { |
| 106 public: |
| 107 ClearHistoryFunction() {} |
| 108 virtual ~ClearHistoryFunction() {} |
| 109 |
| 110 protected: |
| 111 // BrowsingDataTypeExtensionFunction interface method. |
| 112 virtual int GetRemovalMask() const OVERRIDE; |
| 113 |
| 114 DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.history") |
| 115 }; |
| 116 |
| 117 class ClearPasswordsFunction : public BrowsingDataExtensionFunction { |
| 118 public: |
| 119 ClearPasswordsFunction() {} |
| 120 virtual ~ClearPasswordsFunction() {} |
| 121 |
| 122 protected: |
| 123 // BrowsingDataTypeExtensionFunction interface method. |
| 124 virtual int GetRemovalMask() const OVERRIDE; |
| 125 |
| 126 DECLARE_EXTENSION_FUNCTION_NAME("experimental.clear.passwords") |
| 127 }; |
| 128 |
| 129 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_CLEAR_API_H_ |
OLD | NEW |