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 <list> | 8 #include <list> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 }; | 68 }; |
69 | 69 |
70 // This class is a thin wrapper around BrowsingDataLocalStorageHelper that does | 70 // This class is a thin wrapper around BrowsingDataLocalStorageHelper that does |
71 // not fetch its information from the local storage tracker, but gets them | 71 // not fetch its information from the local storage tracker, but gets them |
72 // passed as a parameter during construction. | 72 // passed as a parameter during construction. |
73 class CannedBrowsingDataLocalStorageHelper | 73 class CannedBrowsingDataLocalStorageHelper |
74 : public BrowsingDataLocalStorageHelper { | 74 : public BrowsingDataLocalStorageHelper { |
75 public: | 75 public: |
76 explicit CannedBrowsingDataLocalStorageHelper(Profile* profile); | 76 explicit CannedBrowsingDataLocalStorageHelper(Profile* profile); |
77 | 77 |
78 // Return a copy of the local storage helper. Only one consumer can use the | |
79 // StartFetching method at a time, so we need to create a copy of the helper | |
80 // every time we instantiate a cookies tree model for it. | |
81 CannedBrowsingDataLocalStorageHelper* Clone(); | |
82 | |
83 // Add a local storage to the set of canned local storages that is returned | 78 // Add a local storage to the set of canned local storages that is returned |
84 // by this helper. | 79 // by this helper. |
85 void AddLocalStorage(const GURL& origin); | 80 void AddLocalStorage(const GURL& origin); |
86 | 81 |
87 // Clear the list of canned local storages. | 82 // Clear the list of canned local storages. |
88 void Reset(); | 83 void Reset(); |
89 | 84 |
90 // True if no local storages are currently stored. | 85 // True if no local storages are currently stored. |
91 bool empty() const; | 86 bool empty() const; |
92 | 87 |
93 // Returns the number of local storages currently stored. | 88 // Returns the number of local storages currently stored. |
94 size_t GetLocalStorageCount() const; | 89 size_t GetLocalStorageCount() const; |
95 | 90 |
96 // Returns the set of origins that use local storage. | 91 // Returns the set of origins that use local storage. |
97 const std::set<GURL>& GetLocalStorageInfo() const; | 92 const std::set<GURL>& GetLocalStorageInfo() const; |
98 | 93 |
99 // BrowsingDataLocalStorageHelper implementation. | 94 // BrowsingDataLocalStorageHelper implementation. |
100 virtual void StartFetching( | 95 virtual void StartFetching( |
101 const base::Callback<void(const std::list<LocalStorageInfo>&)>& callback) | 96 const base::Callback<void(const std::list<LocalStorageInfo>&)>& callback) |
102 OVERRIDE; | 97 OVERRIDE; |
103 virtual void DeleteOrigin(const GURL& origin) OVERRIDE; | 98 virtual void DeleteOrigin(const GURL& origin) OVERRIDE; |
104 | 99 |
105 private: | 100 private: |
106 virtual ~CannedBrowsingDataLocalStorageHelper(); | 101 virtual ~CannedBrowsingDataLocalStorageHelper(); |
107 | 102 |
108 std::set<GURL> pending_local_storage_info_; | 103 std::set<GURL> pending_local_storage_info_; |
109 | 104 |
110 Profile* profile_; | |
111 | |
112 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataLocalStorageHelper); | 105 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataLocalStorageHelper); |
113 }; | 106 }; |
114 | 107 |
115 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ | 108 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ |
OLD | NEW |