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_INDEXED_DB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_INDEXED_DB_HELPER_H_ |
6 #define CHROME_BROWSER_BROWSING_DATA_INDEXED_DB_HELPER_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_INDEXED_DB_HELPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 17 matching lines...) Expand all Loading... |
28 : public base::RefCountedThreadSafe<BrowsingDataIndexedDBHelper> { | 28 : public base::RefCountedThreadSafe<BrowsingDataIndexedDBHelper> { |
29 public: | 29 public: |
30 // Contains detailed information about an indexed database. | 30 // Contains detailed information about an indexed database. |
31 struct IndexedDBInfo { | 31 struct IndexedDBInfo { |
32 IndexedDBInfo( | 32 IndexedDBInfo( |
33 const std::string& protocol, | 33 const std::string& protocol, |
34 const std::string& host, | 34 const std::string& host, |
35 unsigned short port, | 35 unsigned short port, |
36 const std::string& database_identifier, | 36 const std::string& database_identifier, |
37 const std::string& origin, | 37 const std::string& origin, |
38 const std::string& database_name, | |
39 const FilePath& file_path, | 38 const FilePath& file_path, |
40 int64 size, | 39 int64 size, |
41 base::Time last_modified) | 40 base::Time last_modified) |
42 : protocol(protocol), | 41 : protocol(protocol), |
43 host(host), | 42 host(host), |
44 port(port), | 43 port(port), |
45 database_identifier(database_identifier), | 44 database_identifier(database_identifier), |
46 origin(origin), | 45 origin(origin), |
47 database_name(database_name), | |
48 file_path(file_path), | 46 file_path(file_path), |
49 size(size), | 47 size(size), |
50 last_modified(last_modified) { | 48 last_modified(last_modified) { |
51 } | 49 } |
52 | 50 |
53 bool IsFileSchemeData() { | 51 bool IsFileSchemeData() { |
54 return protocol == chrome::kFileScheme; | 52 return protocol == chrome::kFileScheme; |
55 } | 53 } |
56 | 54 |
57 std::string protocol; | 55 std::string protocol; |
58 std::string host; | 56 std::string host; |
59 unsigned short port; | 57 unsigned short port; |
60 std::string database_identifier; | 58 std::string database_identifier; |
61 std::string origin; | 59 std::string origin; |
62 std::string database_name; | |
63 FilePath file_path; | 60 FilePath file_path; |
64 int64 size; | 61 int64 size; |
65 base::Time last_modified; | 62 base::Time last_modified; |
66 }; | 63 }; |
67 | 64 |
68 // Create a BrowsingDataIndexedDBHelper instance for the indexed databases | 65 // Create a BrowsingDataIndexedDBHelper instance for the indexed databases |
69 // stored in |profile|'s user data directory. | 66 // stored in |profile|'s user data directory. |
70 static BrowsingDataIndexedDBHelper* Create(Profile* profile); | 67 static BrowsingDataIndexedDBHelper* Create(Profile* profile); |
71 | 68 |
72 // Starts the fetching process, which will notify its completion via | 69 // Starts the fetching process, which will notify its completion via |
(...skipping 17 matching lines...) Expand all Loading... |
90 // not fetch its information from the indexed database tracker, but gets them | 87 // not fetch its information from the indexed database tracker, but gets them |
91 // passed as a parameter. | 88 // passed as a parameter. |
92 class CannedBrowsingDataIndexedDBHelper | 89 class CannedBrowsingDataIndexedDBHelper |
93 : public BrowsingDataIndexedDBHelper { | 90 : public BrowsingDataIndexedDBHelper { |
94 public: | 91 public: |
95 explicit CannedBrowsingDataIndexedDBHelper(Profile* profile); | 92 explicit CannedBrowsingDataIndexedDBHelper(Profile* profile); |
96 | 93 |
97 // Add a indexed database to the set of canned indexed databases that is | 94 // Add a indexed database to the set of canned indexed databases that is |
98 // returned by this helper. | 95 // returned by this helper. |
99 void AddIndexedDB(const GURL& origin, | 96 void AddIndexedDB(const GURL& origin, |
100 const string16& name, | |
101 const string16& description); | 97 const string16& description); |
102 | 98 |
103 // Clear the list of canned indexed databases. | 99 // Clear the list of canned indexed databases. |
104 void Reset(); | 100 void Reset(); |
105 | 101 |
106 // True if no indexed databases are currently stored. | 102 // True if no indexed databases are currently stored. |
107 bool empty() const; | 103 bool empty() const; |
108 | 104 |
109 // BrowsingDataIndexedDBHelper methods. | 105 // BrowsingDataIndexedDBHelper methods. |
110 virtual void StartFetching( | 106 virtual void StartFetching( |
111 Callback1<const std::vector<IndexedDBInfo>& >::Type* callback); | 107 Callback1<const std::vector<IndexedDBInfo>& >::Type* callback); |
112 virtual void CancelNotification() {} | 108 virtual void CancelNotification() {} |
113 virtual void DeleteIndexedDBFile(const FilePath& file_path) {} | 109 virtual void DeleteIndexedDBFile(const FilePath& file_path) {} |
114 | 110 |
115 private: | 111 private: |
116 virtual ~CannedBrowsingDataIndexedDBHelper(); | 112 virtual ~CannedBrowsingDataIndexedDBHelper(); |
117 | 113 |
118 Profile* profile_; | 114 Profile* profile_; |
119 | 115 |
120 std::vector<IndexedDBInfo> indexed_db_info_; | 116 std::vector<IndexedDBInfo> indexed_db_info_; |
121 | 117 |
122 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataIndexedDBHelper); | 118 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataIndexedDBHelper); |
123 }; | 119 }; |
124 | 120 |
125 #endif // CHROME_BROWSER_BROWSING_DATA_INDEXED_DB_HELPER_H_ | 121 #endif // CHROME_BROWSER_BROWSING_DATA_INDEXED_DB_HELPER_H_ |
OLD | NEW |