OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_LOCAL_STORAGE_HELPER_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ |
6 #define CHROME_BROWSER_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 }; | 103 }; |
104 | 104 |
105 // This class is a thin wrapper around BrowsingDataLocalStorageHelper that does | 105 // This class is a thin wrapper around BrowsingDataLocalStorageHelper that does |
106 // not fetch its information from the local storage tracker, but gets them | 106 // not fetch its information from the local storage tracker, but gets them |
107 // passed as a parameter during construction. | 107 // passed as a parameter during construction. |
108 class CannedBrowsingDataLocalStorageHelper | 108 class CannedBrowsingDataLocalStorageHelper |
109 : public BrowsingDataLocalStorageHelper { | 109 : public BrowsingDataLocalStorageHelper { |
110 public: | 110 public: |
111 explicit CannedBrowsingDataLocalStorageHelper(Profile* profile); | 111 explicit CannedBrowsingDataLocalStorageHelper(Profile* profile); |
112 | 112 |
| 113 // Return a copy of the local storage helper. Only one consumer can use the |
| 114 // StartFetching method at a time, so we need to create a copy of the helper |
| 115 // everytime we instantiate a cookies tree model for it. |
| 116 CannedBrowsingDataLocalStorageHelper* Clone(); |
| 117 |
113 // Add a local storage to the set of canned local storages that is returned | 118 // Add a local storage to the set of canned local storages that is returned |
114 // by this helper. | 119 // by this helper. |
115 void AddLocalStorage(const GURL& origin); | 120 void AddLocalStorage(const GURL& origin); |
116 | 121 |
117 // Clear the list of canned local storages. | 122 // Clear the list of canned local storages. |
118 void Reset(); | 123 void Reset(); |
119 | 124 |
120 // True if no local storages are currently stored. | 125 // True if no local storages are currently stored. |
121 bool empty() const; | 126 bool empty() const; |
122 | 127 |
123 // BrowsingDataLocalStorageHelper methods. | 128 // BrowsingDataLocalStorageHelper methods. |
124 virtual void StartFetching( | 129 virtual void StartFetching( |
125 Callback1<const std::vector<LocalStorageInfo>& >::Type* callback); | 130 Callback1<const std::vector<LocalStorageInfo>& >::Type* callback); |
126 virtual void CancelNotification() {} | 131 virtual void CancelNotification() {} |
127 | 132 |
128 private: | 133 private: |
129 virtual ~CannedBrowsingDataLocalStorageHelper(); | 134 virtual ~CannedBrowsingDataLocalStorageHelper(); |
130 | 135 |
131 // Convert the pending local storage info to local storage info objects. | 136 // Convert the pending local storage info to local storage info objects. |
132 void ConvertPendingInfoInWebKitThread(); | 137 void ConvertPendingInfoInWebKitThread(); |
133 | 138 |
134 // Used to protect access to pending_local_storage_info_. | 139 // Used to protect access to pending_local_storage_info_. |
135 mutable base::Lock lock_; | 140 mutable base::Lock lock_; |
136 | 141 |
137 // May mutate on WEBKIT and UI threads. | 142 // May mutate on WEBKIT and UI threads. |
138 std::vector<GURL> pending_local_storage_info_; | 143 std::vector<GURL> pending_local_storage_info_; |
139 | 144 |
| 145 Profile* profile_; |
| 146 |
140 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataLocalStorageHelper); | 147 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataLocalStorageHelper); |
141 }; | 148 }; |
142 | 149 |
143 #endif // CHROME_BROWSER_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ | 150 #endif // CHROME_BROWSER_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ |
OLD | NEW |