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 <list> | 9 #include <list> |
10 #include <set> | 10 #include <set> |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // Requests a single local storage file to be deleted in the WEBKIT thread. | 77 // Requests a single local storage file to be deleted in the WEBKIT thread. |
78 virtual void DeleteLocalStorageFile(const FilePath& file_path); | 78 virtual void DeleteLocalStorageFile(const FilePath& file_path); |
79 | 79 |
80 protected: | 80 protected: |
81 friend class base::RefCountedThreadSafe<BrowsingDataLocalStorageHelper>; | 81 friend class base::RefCountedThreadSafe<BrowsingDataLocalStorageHelper>; |
82 virtual ~BrowsingDataLocalStorageHelper(); | 82 virtual ~BrowsingDataLocalStorageHelper(); |
83 | 83 |
84 // Notifies the completion callback in the UI thread. | 84 // Notifies the completion callback in the UI thread. |
85 void NotifyInUIThread(); | 85 void NotifyInUIThread(); |
86 | 86 |
87 scoped_refptr<content::DOMStorageContext> dom_storage_context_; | 87 // Owned by the profile |
| 88 content::DOMStorageContext* dom_storage_context_; |
88 | 89 |
89 // This only mutates on the UI thread. | 90 // This only mutates on the UI thread. |
90 base::Callback<void(const std::list<LocalStorageInfo>&)> completion_callback_; | 91 base::Callback<void(const std::list<LocalStorageInfo>&)> completion_callback_; |
91 | 92 |
92 // Indicates whether or not we're currently fetching information: | 93 // Indicates whether or not we're currently fetching information: |
93 // it's true when StartFetching() is called in the UI thread, and it's reset | 94 // it's true when StartFetching() is called in the UI thread, and it's reset |
94 // after we notified the callback in the UI thread. | 95 // after we notified the callback in the UI thread. |
95 // This only mutates on the UI thread. | 96 // This only mutates on the UI thread. |
96 bool is_fetching_; | 97 bool is_fetching_; |
97 | 98 |
98 // This only mutates in the WEBKIT thread. | 99 // This only mutates in the WEBKIT thread. |
99 std::list<LocalStorageInfo> local_storage_info_; | 100 std::list<LocalStorageInfo> local_storage_info_; |
100 | 101 |
101 private: | 102 private: |
102 // Enumerates all local storage files in a sequenced task. | 103 // Called back with the all the local storage files. |
103 void FetchLocalStorageInfoHelper(); | 104 void GetAllStorageFilesCallback(const std::vector<FilePath>& files); |
104 // Delete a single local storage file in a sequenced task. | 105 // Get the file info on the file thread. |
105 void DeleteLocalStorageFileHelper(const FilePath& file_path); | 106 void FetchLocalStorageInfo(const std::vector<FilePath>& files); |
106 | 107 |
107 DISALLOW_COPY_AND_ASSIGN(BrowsingDataLocalStorageHelper); | 108 DISALLOW_COPY_AND_ASSIGN(BrowsingDataLocalStorageHelper); |
108 }; | 109 }; |
109 | 110 |
110 // This class is a thin wrapper around BrowsingDataLocalStorageHelper that does | 111 // This class is a thin wrapper around BrowsingDataLocalStorageHelper that does |
111 // not fetch its information from the local storage tracker, but gets them | 112 // not fetch its information from the local storage tracker, but gets them |
112 // passed as a parameter during construction. | 113 // passed as a parameter during construction. |
113 class CannedBrowsingDataLocalStorageHelper | 114 class CannedBrowsingDataLocalStorageHelper |
114 : public BrowsingDataLocalStorageHelper { | 115 : public BrowsingDataLocalStorageHelper { |
115 public: | 116 public: |
(...skipping 27 matching lines...) Expand all Loading... |
143 void ConvertPendingInfo(); | 144 void ConvertPendingInfo(); |
144 | 145 |
145 std::set<GURL> pending_local_storage_info_; | 146 std::set<GURL> pending_local_storage_info_; |
146 | 147 |
147 Profile* profile_; | 148 Profile* profile_; |
148 | 149 |
149 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataLocalStorageHelper); | 150 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataLocalStorageHelper); |
150 }; | 151 }; |
151 | 152 |
152 #endif // CHROME_BROWSER_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ | 153 #endif // CHROME_BROWSER_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ |
OLD | NEW |