| 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_INDEXED_DB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_INDEXED_DB_HELPER_H_ |
| 6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_INDEXED_DB_HELPER_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_INDEXED_DB_HELPER_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/file_path.h" | 14 #include "base/file_path.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
| 17 #include "base/time.h" | 17 #include "base/time.h" |
| 18 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
| 19 | 19 |
| 20 class Profile; | 20 class Profile; |
| 21 | 21 |
| 22 namespace content { |
| 23 class IndexedDBContext; |
| 24 } |
| 25 |
| 22 // BrowsingDataIndexedDBHelper is an interface for classes dealing with | 26 // BrowsingDataIndexedDBHelper is an interface for classes dealing with |
| 23 // aggregating and deleting browsing data stored in indexed databases. A | 27 // aggregating and deleting browsing data stored in indexed databases. A |
| 24 // client of this class need to call StartFetching from the UI thread to | 28 // 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 thread at | 29 // initiate the flow, and it'll be notified by the callback in its UI thread at |
| 26 // some later point. | 30 // some later point. |
| 27 class BrowsingDataIndexedDBHelper | 31 class BrowsingDataIndexedDBHelper |
| 28 : public base::RefCountedThreadSafe<BrowsingDataIndexedDBHelper> { | 32 : public base::RefCountedThreadSafe<BrowsingDataIndexedDBHelper> { |
| 29 public: | 33 public: |
| 30 // Contains detailed information about an indexed database. | 34 // Contains detailed information about an indexed database. |
| 31 struct IndexedDBInfo { | 35 struct IndexedDBInfo { |
| 32 IndexedDBInfo( | 36 IndexedDBInfo( |
| 33 const GURL& origin, | 37 const GURL& origin, |
| 34 int64 size, | 38 int64 size, |
| 35 base::Time last_modified); | 39 base::Time last_modified); |
| 36 ~IndexedDBInfo(); | 40 ~IndexedDBInfo(); |
| 37 | 41 |
| 38 GURL origin; | 42 GURL origin; |
| 39 int64 size; | 43 int64 size; |
| 40 base::Time last_modified; | 44 base::Time last_modified; |
| 41 }; | 45 }; |
| 42 | 46 |
| 43 // Create a BrowsingDataIndexedDBHelper instance for the indexed databases | 47 // Create a BrowsingDataIndexedDBHelper instance for the indexed databases |
| 44 // stored in |profile|'s user data directory. | 48 // stored in |profile|'s user data directory. |
| 45 static BrowsingDataIndexedDBHelper* Create(Profile* profile); | 49 static BrowsingDataIndexedDBHelper* Create( |
| 50 content::IndexedDBContext* context); |
| 46 | 51 |
| 47 // Starts the fetching process, which will notify its completion via | 52 // Starts the fetching process, which will notify its completion via |
| 48 // callback. | 53 // callback. |
| 49 // This must be called only in the UI thread. | 54 // This must be called only in the UI thread. |
| 50 virtual void StartFetching( | 55 virtual void StartFetching( |
| 51 const base::Callback<void(const std::list<IndexedDBInfo>&)>& | 56 const base::Callback<void(const std::list<IndexedDBInfo>&)>& |
| 52 callback) = 0; | 57 callback) = 0; |
| 53 // Requests a single indexed database to be deleted in the WEBKIT thread. | 58 // Requests a single indexed database to be deleted in the WEBKIT thread. |
| 54 virtual void DeleteIndexedDB(const GURL& origin) = 0; | 59 virtual void DeleteIndexedDB(const GURL& origin) = 0; |
| 55 | 60 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 // Indicates whether or not we're currently fetching information: | 141 // Indicates whether or not we're currently fetching information: |
| 137 // it's true when StartFetching() is called in the UI thread, and it's reset | 142 // it's true when StartFetching() is called in the UI thread, and it's reset |
| 138 // after we notified the callback in the UI thread. | 143 // after we notified the callback in the UI thread. |
| 139 // This only mutates on the UI thread. | 144 // This only mutates on the UI thread. |
| 140 bool is_fetching_; | 145 bool is_fetching_; |
| 141 | 146 |
| 142 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataIndexedDBHelper); | 147 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataIndexedDBHelper); |
| 143 }; | 148 }; |
| 144 | 149 |
| 145 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_INDEXED_DB_HELPER_H_ | 150 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_INDEXED_DB_HELPER_H_ |
| OLD | NEW |