| 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 #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ |
| 6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 using FetchCallback = | 42 using FetchCallback = |
| 43 base::Callback<void(const std::list<LocalStorageInfo>&)>; | 43 base::Callback<void(const std::list<LocalStorageInfo>&)>; |
| 44 | 44 |
| 45 explicit BrowsingDataLocalStorageHelper(Profile* profile); | 45 explicit BrowsingDataLocalStorageHelper(Profile* profile); |
| 46 | 46 |
| 47 // Starts the fetching process, which will notify its completion via | 47 // Starts the fetching process, which will notify its completion via |
| 48 // callback. This must be called only in the UI thread. | 48 // callback. This must be called only in the UI thread. |
| 49 virtual void StartFetching(const FetchCallback& callback); | 49 virtual void StartFetching(const FetchCallback& callback); |
| 50 | 50 |
| 51 // Deletes the local storage for the |origin|. | 51 // Deletes the local storage for the |origin_url|. |
| 52 virtual void DeleteOrigin(const GURL& origin); | 52 virtual void DeleteOrigin(const GURL& origin_url); |
| 53 | 53 |
| 54 protected: | 54 protected: |
| 55 friend class base::RefCounted<BrowsingDataLocalStorageHelper>; | 55 friend class base::RefCounted<BrowsingDataLocalStorageHelper>; |
| 56 virtual ~BrowsingDataLocalStorageHelper(); | 56 virtual ~BrowsingDataLocalStorageHelper(); |
| 57 | 57 |
| 58 content::DOMStorageContext* dom_storage_context_; // Owned by the profile | 58 content::DOMStorageContext* dom_storage_context_; // Owned by the profile |
| 59 | 59 |
| 60 private: | 60 private: |
| 61 DISALLOW_COPY_AND_ASSIGN(BrowsingDataLocalStorageHelper); | 61 DISALLOW_COPY_AND_ASSIGN(BrowsingDataLocalStorageHelper); |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 // This class is a thin wrapper around BrowsingDataLocalStorageHelper that does | 64 // This class is a thin wrapper around BrowsingDataLocalStorageHelper that does |
| 65 // not fetch its information from the local storage tracker, but gets them | 65 // not fetch its information from the local storage tracker, but gets them |
| 66 // passed as a parameter during construction. | 66 // passed as a parameter during construction. |
| 67 class CannedBrowsingDataLocalStorageHelper | 67 class CannedBrowsingDataLocalStorageHelper |
| 68 : public BrowsingDataLocalStorageHelper { | 68 : public BrowsingDataLocalStorageHelper { |
| 69 public: | 69 public: |
| 70 explicit CannedBrowsingDataLocalStorageHelper(Profile* profile); | 70 explicit CannedBrowsingDataLocalStorageHelper(Profile* profile); |
| 71 | 71 |
| 72 // Add a local storage to the set of canned local storages that is returned | 72 // Add a local storage to the set of canned local storages that is returned |
| 73 // by this helper. | 73 // by this helper. |
| 74 void AddLocalStorage(const GURL& origin); | 74 void AddLocalStorage(const GURL& origin_url); |
| 75 | 75 |
| 76 // Clear the list of canned local storages. | 76 // Clear the list of canned local storages. |
| 77 void Reset(); | 77 void Reset(); |
| 78 | 78 |
| 79 // True if no local storages are currently stored. | 79 // True if no local storages are currently stored. |
| 80 bool empty() const; | 80 bool empty() const; |
| 81 | 81 |
| 82 // Returns the number of local storages currently stored. | 82 // Returns the number of local storages currently stored. |
| 83 size_t GetLocalStorageCount() const; | 83 size_t GetLocalStorageCount() const; |
| 84 | 84 |
| 85 // Returns the set of origins that use local storage. | 85 // Returns the set of origins that use local storage. |
| 86 const std::set<GURL>& GetLocalStorageInfo() const; | 86 const std::set<GURL>& GetLocalStorageInfo() const; |
| 87 | 87 |
| 88 // BrowsingDataLocalStorageHelper implementation. | 88 // BrowsingDataLocalStorageHelper implementation. |
| 89 void StartFetching(const FetchCallback& callback) override; | 89 void StartFetching(const FetchCallback& callback) override; |
| 90 void DeleteOrigin(const GURL& origin) override; | 90 void DeleteOrigin(const GURL& origin_url) override; |
| 91 | 91 |
| 92 private: | 92 private: |
| 93 ~CannedBrowsingDataLocalStorageHelper() override; | 93 ~CannedBrowsingDataLocalStorageHelper() override; |
| 94 | 94 |
| 95 std::set<GURL> pending_local_storage_info_; | 95 std::set<GURL> pending_local_storage_info_; |
| 96 std::multimap<GURL, GURL> pending_origins_to_pending_suborigins_; | 96 std::multimap<GURL, GURL> pending_origins_to_pending_suborigins_; |
| 97 | 97 |
| 98 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataLocalStorageHelper); | 98 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataLocalStorageHelper); |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ | 101 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ |
| OLD | NEW |