OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_DATABASE_HELPER_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_DATABASE_HELPER_H_ |
6 #define CHROME_BROWSER_BROWSING_DATA_DATABASE_HELPER_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_DATABASE_HELPER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
12 #include "base/task.h" | 12 #include "base/task.h" |
| 13 #include "webkit/database/database_tracker.h" |
13 | 14 |
14 class Profile; | 15 class Profile; |
15 | 16 |
16 // This class fetches database information in the FILE thread, and notifies the | 17 // This class fetches database information in the FILE thread, and notifies the |
17 // UI thread upon completion. | 18 // UI thread upon completion. |
18 // A client of this class need to call StartFetching from the UI thread to | 19 // A client of this class need to call StartFetching from the UI thread to |
19 // initiate the flow, and it'll be notified by the callback in its UI | 20 // initiate the flow, and it'll be notified by the callback in its UI |
20 // thread at some later point. | 21 // thread at some later point. |
21 // The client must call CancelNotification() if it's destroyed before the | 22 // The client must call CancelNotification() if it's destroyed before the |
22 // callback is notified. | 23 // callback is notified. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // Enumerates all databases. This must be called in the FILE thread. | 76 // Enumerates all databases. This must be called in the FILE thread. |
76 void FetchDatabaseInfoInFileThread(); | 77 void FetchDatabaseInfoInFileThread(); |
77 | 78 |
78 // Notifies the completion callback. This must be called in the UI thread. | 79 // Notifies the completion callback. This must be called in the UI thread. |
79 void NotifyInUIThread(); | 80 void NotifyInUIThread(); |
80 | 81 |
81 // Delete a single database file. This must be called in the FILE thread. | 82 // Delete a single database file. This must be called in the FILE thread. |
82 void DeleteDatabaseInFileThread(const std::string& origin, | 83 void DeleteDatabaseInFileThread(const std::string& origin, |
83 const std::string& name); | 84 const std::string& name); |
84 | 85 |
85 Profile* profile_; | 86 scoped_refptr<webkit_database::DatabaseTracker> tracker_; |
86 | 87 |
87 // This only mutates on the UI thread. | 88 // This only mutates on the UI thread. |
88 scoped_ptr<Callback1<const std::vector<DatabaseInfo>& >::Type > | 89 scoped_ptr<Callback1<const std::vector<DatabaseInfo>& >::Type > |
89 completion_callback_; | 90 completion_callback_; |
90 | 91 |
91 // Indicates whether or not we're currently fetching information: | 92 // Indicates whether or not we're currently fetching information: |
92 // it's true when StartFetching() is called in the UI thread, and it's reset | 93 // it's true when StartFetching() is called in the UI thread, and it's reset |
93 // after we notify the callback in the UI thread. | 94 // after we notify the callback in the UI thread. |
94 // This only mutates on the UI thread. | 95 // This only mutates on the UI thread. |
95 bool is_fetching_; | 96 bool is_fetching_; |
96 | 97 |
97 // This only mutates in the FILE thread. | 98 // This only mutates in the FILE thread. |
98 std::vector<DatabaseInfo> database_info_; | 99 std::vector<DatabaseInfo> database_info_; |
99 | 100 |
100 DISALLOW_COPY_AND_ASSIGN(BrowsingDataDatabaseHelper); | 101 DISALLOW_COPY_AND_ASSIGN(BrowsingDataDatabaseHelper); |
101 }; | 102 }; |
102 | 103 |
103 #endif // CHROME_BROWSER_BROWSING_DATA_DATABASE_HELPER_H_ | 104 #endif // CHROME_BROWSER_BROWSING_DATA_DATABASE_HELPER_H_ |
OLD | NEW |