OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 DISALLOW_COPY_AND_ASSIGN(BrowsingDataDatabaseHelper); | 102 DISALLOW_COPY_AND_ASSIGN(BrowsingDataDatabaseHelper); |
103 }; | 103 }; |
104 | 104 |
105 // This class is a thin wrapper around BrowsingDataDatabaseHelper that does not | 105 // This class is a thin wrapper around BrowsingDataDatabaseHelper that does not |
106 // fetch its information from the database tracker, but gets them passed as | 106 // fetch its information from the database tracker, but gets them passed as |
107 // a parameter during construction. | 107 // a parameter during construction. |
108 class CannedBrowsingDataDatabaseHelper : public BrowsingDataDatabaseHelper { | 108 class CannedBrowsingDataDatabaseHelper : public BrowsingDataDatabaseHelper { |
109 public: | 109 public: |
110 explicit CannedBrowsingDataDatabaseHelper(Profile* profile); | 110 explicit CannedBrowsingDataDatabaseHelper(Profile* profile); |
111 | 111 |
| 112 // Return a copy of the database helper. Only one consumer can use the |
| 113 // StartFetching method at a time, so we need to create a copy of the helper |
| 114 // everytime we instantiate a cookies tree model for it. |
| 115 CannedBrowsingDataDatabaseHelper* Clone(); |
| 116 |
112 // Add a database to the set of canned databases that is returned by this | 117 // Add a database to the set of canned databases that is returned by this |
113 // helper. | 118 // helper. |
114 void AddDatabase(const GURL& origin, | 119 void AddDatabase(const GURL& origin, |
115 const std::string& name, | 120 const std::string& name, |
116 const std::string& description); | 121 const std::string& description); |
117 | 122 |
118 // Clear the list of canned databases. | 123 // Clear the list of canned databases. |
119 void Reset(); | 124 void Reset(); |
120 | 125 |
121 // True if no databases are currently stored. | 126 // True if no databases are currently stored. |
(...skipping 21 matching lines...) Expand all Loading... |
143 | 148 |
144 // Converts the pending database info structs to database info structs. | 149 // Converts the pending database info structs to database info structs. |
145 void ConvertInfoInWebKitThread(); | 150 void ConvertInfoInWebKitThread(); |
146 | 151 |
147 // Used to protect access to pending_database_info_. | 152 // Used to protect access to pending_database_info_. |
148 mutable base::Lock lock_; | 153 mutable base::Lock lock_; |
149 | 154 |
150 // This may mutate on WEBKIT and UI threads. | 155 // This may mutate on WEBKIT and UI threads. |
151 std::vector<PendingDatabaseInfo> pending_database_info_; | 156 std::vector<PendingDatabaseInfo> pending_database_info_; |
152 | 157 |
| 158 Profile* profile_; |
| 159 |
153 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataDatabaseHelper); | 160 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataDatabaseHelper); |
154 }; | 161 }; |
155 | 162 |
156 #endif // CHROME_BROWSER_BROWSING_DATA_DATABASE_HELPER_H_ | 163 #endif // CHROME_BROWSER_BROWSING_DATA_DATABASE_HELPER_H_ |
OLD | NEW |