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 <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
8 #include <list> | 11 #include <list> |
9 #include <set> | 12 #include <set> |
10 #include <string> | 13 #include <string> |
11 | 14 |
12 #include "base/basictypes.h" | |
13 #include "base/callback_forward.h" | 15 #include "base/callback_forward.h" |
| 16 #include "base/macros.h" |
14 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
15 #include "base/time/time.h" | 18 #include "base/time/time.h" |
16 #include "storage/browser/database/database_tracker.h" | 19 #include "storage/browser/database/database_tracker.h" |
17 #include "storage/common/database/database_identifier.h" | 20 #include "storage/common/database/database_identifier.h" |
18 #include "url/gurl.h" | 21 #include "url/gurl.h" |
19 | 22 |
20 class Profile; | 23 class Profile; |
21 | 24 |
22 // This class fetches database information in the FILE thread, and notifies | 25 // This class fetches database information in the FILE thread, and notifies |
23 // the UI thread upon completion. | 26 // the UI thread upon completion. |
24 // A client of this class need to call StartFetching from the UI thread to | 27 // A client of this class need to call StartFetching from the UI thread to |
25 // initiate the flow, and it'll be notified by the callback in its UI | 28 // initiate the flow, and it'll be notified by the callback in its UI |
26 // thread at some later point. | 29 // thread at some later point. |
27 class BrowsingDataDatabaseHelper | 30 class BrowsingDataDatabaseHelper |
28 : public base::RefCountedThreadSafe<BrowsingDataDatabaseHelper> { | 31 : public base::RefCountedThreadSafe<BrowsingDataDatabaseHelper> { |
29 public: | 32 public: |
30 // Contains detailed information about a web database. | 33 // Contains detailed information about a web database. |
31 struct DatabaseInfo { | 34 struct DatabaseInfo { |
32 DatabaseInfo(const storage::DatabaseIdentifier& identifier, | 35 DatabaseInfo(const storage::DatabaseIdentifier& identifier, |
33 const std::string& database_name, | 36 const std::string& database_name, |
34 const std::string& description, | 37 const std::string& description, |
35 int64 size, | 38 int64_t size, |
36 base::Time last_modified); | 39 base::Time last_modified); |
37 ~DatabaseInfo(); | 40 ~DatabaseInfo(); |
38 | 41 |
39 storage::DatabaseIdentifier identifier; | 42 storage::DatabaseIdentifier identifier; |
40 std::string database_name; | 43 std::string database_name; |
41 std::string description; | 44 std::string description; |
42 int64 size; | 45 int64_t size; |
43 base::Time last_modified; | 46 base::Time last_modified; |
44 }; | 47 }; |
45 | 48 |
46 using FetchCallback = base::Callback<void(const std::list<DatabaseInfo>&)>; | 49 using FetchCallback = base::Callback<void(const std::list<DatabaseInfo>&)>; |
47 | 50 |
48 explicit BrowsingDataDatabaseHelper(Profile* profile); | 51 explicit BrowsingDataDatabaseHelper(Profile* profile); |
49 | 52 |
50 // Starts the fetching process, which will notify its completion via | 53 // Starts the fetching process, which will notify its completion via |
51 // callback. | 54 // callback. |
52 // This must be called only in the UI thread. | 55 // This must be called only in the UI thread. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 123 |
121 private: | 124 private: |
122 ~CannedBrowsingDataDatabaseHelper() override; | 125 ~CannedBrowsingDataDatabaseHelper() override; |
123 | 126 |
124 std::set<PendingDatabaseInfo> pending_database_info_; | 127 std::set<PendingDatabaseInfo> pending_database_info_; |
125 | 128 |
126 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataDatabaseHelper); | 129 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataDatabaseHelper); |
127 }; | 130 }; |
128 | 131 |
129 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_DATABASE_HELPER_H_ | 132 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_DATABASE_HELPER_H_ |
OLD | NEW |