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_DATABASE_HELPER_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_DATABASE_HELPER_H_ |
6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_DATABASE_HELPER_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_DATABASE_HELPER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 12 matching lines...) Expand all Loading... |
23 // This class fetches database information in the FILE thread, and notifies | 23 // This class fetches database information in the FILE thread, and notifies |
24 // the UI thread upon completion. | 24 // the UI thread upon completion. |
25 // A client of this class need to call StartFetching from the UI thread to | 25 // A client of this class need to call StartFetching from the UI thread to |
26 // initiate the flow, and it'll be notified by the callback in its UI | 26 // initiate the flow, and it'll be notified by the callback in its UI |
27 // thread at some later point. | 27 // thread at some later point. |
28 class BrowsingDataDatabaseHelper | 28 class BrowsingDataDatabaseHelper |
29 : public base::RefCountedThreadSafe<BrowsingDataDatabaseHelper> { | 29 : public base::RefCountedThreadSafe<BrowsingDataDatabaseHelper> { |
30 public: | 30 public: |
31 // Contains detailed information about a web database. | 31 // Contains detailed information about a web database. |
32 struct DatabaseInfo { | 32 struct DatabaseInfo { |
33 DatabaseInfo(const webkit_database::DatabaseIdentifier& identifier, | 33 DatabaseInfo(const storage::DatabaseIdentifier& identifier, |
34 const std::string& database_name, | 34 const std::string& database_name, |
35 const std::string& description, | 35 const std::string& description, |
36 int64 size, | 36 int64 size, |
37 base::Time last_modified); | 37 base::Time last_modified); |
38 ~DatabaseInfo(); | 38 ~DatabaseInfo(); |
39 | 39 |
40 webkit_database::DatabaseIdentifier identifier; | 40 storage::DatabaseIdentifier identifier; |
41 std::string database_name; | 41 std::string database_name; |
42 std::string description; | 42 std::string description; |
43 int64 size; | 43 int64 size; |
44 base::Time last_modified; | 44 base::Time last_modified; |
45 }; | 45 }; |
46 | 46 |
47 explicit BrowsingDataDatabaseHelper(Profile* profile); | 47 explicit BrowsingDataDatabaseHelper(Profile* profile); |
48 | 48 |
49 // Starts the fetching process, which will notify its completion via | 49 // Starts the fetching process, which will notify its completion via |
50 // callback. | 50 // callback. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 bool is_fetching_; | 82 bool is_fetching_; |
83 | 83 |
84 private: | 84 private: |
85 // Enumerates all databases. This must be called in the FILE thread. | 85 // Enumerates all databases. This must be called in the FILE thread. |
86 void FetchDatabaseInfoOnFileThread(); | 86 void FetchDatabaseInfoOnFileThread(); |
87 | 87 |
88 // Delete a single database file. This must be called in the FILE thread. | 88 // Delete a single database file. This must be called in the FILE thread. |
89 void DeleteDatabaseOnFileThread(const std::string& origin, | 89 void DeleteDatabaseOnFileThread(const std::string& origin, |
90 const std::string& name); | 90 const std::string& name); |
91 | 91 |
92 scoped_refptr<webkit_database::DatabaseTracker> tracker_; | 92 scoped_refptr<storage::DatabaseTracker> tracker_; |
93 | 93 |
94 DISALLOW_COPY_AND_ASSIGN(BrowsingDataDatabaseHelper); | 94 DISALLOW_COPY_AND_ASSIGN(BrowsingDataDatabaseHelper); |
95 }; | 95 }; |
96 | 96 |
97 // This class is a thin wrapper around BrowsingDataDatabaseHelper that does not | 97 // This class is a thin wrapper around BrowsingDataDatabaseHelper that does not |
98 // fetch its information from the database tracker, but gets them passed as | 98 // fetch its information from the database tracker, but gets them passed as |
99 // a parameter during construction. | 99 // a parameter during construction. |
100 class CannedBrowsingDataDatabaseHelper : public BrowsingDataDatabaseHelper { | 100 class CannedBrowsingDataDatabaseHelper : public BrowsingDataDatabaseHelper { |
101 public: | 101 public: |
102 struct PendingDatabaseInfo { | 102 struct PendingDatabaseInfo { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 virtual ~CannedBrowsingDataDatabaseHelper(); | 149 virtual ~CannedBrowsingDataDatabaseHelper(); |
150 | 150 |
151 std::set<PendingDatabaseInfo> pending_database_info_; | 151 std::set<PendingDatabaseInfo> pending_database_info_; |
152 | 152 |
153 Profile* profile_; | 153 Profile* profile_; |
154 | 154 |
155 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataDatabaseHelper); | 155 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataDatabaseHelper); |
156 }; | 156 }; |
157 | 157 |
158 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_DATABASE_HELPER_H_ | 158 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_DATABASE_HELPER_H_ |
OLD | NEW |