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_HISTORY_ANDROID_ANDROID_PROVIDER_BACKEND_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_ANDROID_ANDROID_PROVIDER_BACKEND_H_ |
6 #define CHROME_BROWSER_HISTORY_ANDROID_ANDROID_PROVIDER_BACKEND_H_ | 6 #define CHROME_BROWSER_HISTORY_ANDROID_ANDROID_PROVIDER_BACKEND_H_ |
7 | 7 |
| 8 #include <list> |
8 #include <set> | 9 #include <set> |
9 | 10 |
10 #include "base/containers/hash_tables.h" | 11 #include "base/containers/hash_tables.h" |
11 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
12 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
15 #include "base/memory/scoped_vector.h" | 16 #include "base/memory/scoped_vector.h" |
16 #include "chrome/browser/history/android/android_cache_database.h" | 17 #include "chrome/browser/history/android/android_cache_database.h" |
17 #include "chrome/browser/history/android/android_history_types.h" | 18 #include "chrome/browser/history/android/android_history_types.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 bool DeleteSearchTerms(const std::string& selection, | 140 bool DeleteSearchTerms(const std::string& selection, |
140 const std::vector<base::string16>& selection_args, | 141 const std::vector<base::string16>& selection_args, |
141 int * deleted_count); | 142 int * deleted_count); |
142 | 143 |
143 private: | 144 private: |
144 friend class AndroidProviderBackendTest; | 145 friend class AndroidProviderBackendTest; |
145 | 146 |
146 FRIEND_TEST_ALL_PREFIXES(AndroidProviderBackendTest, UpdateTables); | 147 FRIEND_TEST_ALL_PREFIXES(AndroidProviderBackendTest, UpdateTables); |
147 FRIEND_TEST_ALL_PREFIXES(AndroidProviderBackendTest, UpdateSearchTermTable); | 148 FRIEND_TEST_ALL_PREFIXES(AndroidProviderBackendTest, UpdateSearchTermTable); |
148 | 149 |
149 class HistoryNotifications { | 150 typedef std::list<base::Closure> HistoryNotifications; |
150 public: | |
151 HistoryNotifications(); | |
152 ~HistoryNotifications(); | |
153 | |
154 void PushBack(int type, scoped_ptr<HistoryDetails> detail); | |
155 int PopBackType(); | |
156 scoped_ptr<HistoryDetails> PopBackDetails(); | |
157 | |
158 bool empty() const { return types_.empty(); } | |
159 | |
160 private: | |
161 std::vector<int> types_; | |
162 ScopedVector<HistoryDetails> details_; | |
163 | |
164 DISALLOW_COPY_AND_ASSIGN(HistoryNotifications); | |
165 }; | |
166 | 151 |
167 // The scoped transaction for AndroidProviderBackend. | 152 // The scoped transaction for AndroidProviderBackend. |
168 // | 153 // |
169 // The new transactions are started automatically in both history and | 154 // The new transactions are started automatically in both history and |
170 // thumbnail database and could be a nesting transaction, if so, rolling back | 155 // thumbnail database and could be a nesting transaction, if so, rolling back |
171 // of this transaction will cause the exsting and subsequent nesting | 156 // of this transaction will cause the exsting and subsequent nesting |
172 // transactions failed. | 157 // transactions failed. |
173 // | 158 // |
174 // Commit() is used to commit the transaction, otherwise the transaction will | 159 // Commit() is used to commit the transaction, otherwise the transaction will |
175 // be rolled back when the object is out of scope. This transaction could | 160 // be rolled back when the object is out of scope. This transaction could |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 bool initialized_; | 341 bool initialized_; |
357 | 342 |
358 HistoryBackend::Delegate* delegate_; | 343 HistoryBackend::Delegate* delegate_; |
359 | 344 |
360 DISALLOW_COPY_AND_ASSIGN(AndroidProviderBackend); | 345 DISALLOW_COPY_AND_ASSIGN(AndroidProviderBackend); |
361 }; | 346 }; |
362 | 347 |
363 } // namespace history | 348 } // namespace history |
364 | 349 |
365 #endif // CHROME_BROWSER_HISTORY_ANDROID_ANDROID_PROVIDER_BACKEND_H_ | 350 #endif // CHROME_BROWSER_HISTORY_ANDROID_ANDROID_PROVIDER_BACKEND_H_ |
OLD | NEW |