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 <list> |
9 #include <set> | 9 #include <set> |
10 | 10 |
11 #include "base/containers/hash_tables.h" | 11 #include "base/containers/hash_tables.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/scoped_vector.h" | 16 #include "base/memory/scoped_vector.h" |
17 #include "base/supports_user_data.h" | 17 #include "base/supports_user_data.h" |
18 #include "components/history/core/browser/android/android_cache_database.h" | 18 #include "components/history/core/browser/android/android_cache_database.h" |
19 #include "components/history/core/browser/android/android_history_types.h" | 19 #include "components/history/core/browser/android/android_history_types.h" |
20 #include "components/history/core/browser/android/sql_handler.h" | 20 #include "components/history/core/browser/android/sql_handler.h" |
21 | 21 |
22 namespace history { | 22 namespace history { |
23 | 23 |
24 class AndroidProviderBackend; | 24 class AndroidProviderBackend; |
25 class AndroidURLsSQLHandler; | 25 class AndroidURLsSQLHandler; |
26 class HistoryBackend; | 26 class HistoryBackend; |
| 27 class HistoryBackendClient; |
27 class HistoryBackendNotifier; | 28 class HistoryBackendNotifier; |
28 class HistoryClient; | |
29 class HistoryDatabase; | 29 class HistoryDatabase; |
30 class ThumbnailDatabase; | 30 class ThumbnailDatabase; |
31 | 31 |
32 // This class provides the query/insert/update/remove methods to implement | 32 // This class provides the query/insert/update/remove methods to implement |
33 // android.provider.Browser.BookmarkColumns and | 33 // android.provider.Browser.BookmarkColumns and |
34 // android.provider.Browser.SearchColumns API. | 34 // android.provider.Browser.SearchColumns API. |
35 // | 35 // |
36 // When used it: | 36 // When used it: |
37 // a. The android_urls table is created in history database if it doesn't | 37 // a. The android_urls table is created in history database if it doesn't |
38 // exists. | 38 // exists. |
39 // b. The android_cache database is created. | 39 // b. The android_cache database is created. |
40 // c. The bookmark_cache table is created. | 40 // c. The bookmark_cache table is created. |
41 // | 41 // |
42 // Android_urls and android_cache database is only updated before the related | 42 // Android_urls and android_cache database is only updated before the related |
43 // methods are accessed. A data change will not triger the update. | 43 // methods are accessed. A data change will not triger the update. |
44 // | 44 // |
45 // The android_cache database is deleted when shutdown. | 45 // The android_cache database is deleted when shutdown. |
46 class AndroidProviderBackend : public base::SupportsUserData::Data { | 46 class AndroidProviderBackend : public base::SupportsUserData::Data { |
47 public: | 47 public: |
48 AndroidProviderBackend(const base::FilePath& cache_db_name, | 48 AndroidProviderBackend(const base::FilePath& cache_db_name, |
49 HistoryDatabase* history_db, | 49 HistoryDatabase* history_db, |
50 ThumbnailDatabase* thumbnail_db, | 50 ThumbnailDatabase* thumbnail_db, |
51 HistoryClient* history_client, | 51 HistoryBackendClient* backend_client, |
52 HistoryBackendNotifier* notifier); | 52 HistoryBackendNotifier* notifier); |
53 | 53 |
54 ~AndroidProviderBackend() override; | 54 ~AndroidProviderBackend() override; |
55 | 55 |
56 static const void* GetUserDataKey(); | 56 static const void* GetUserDataKey(); |
57 | 57 |
58 static AndroidProviderBackend* FromHistoryBackend( | 58 static AndroidProviderBackend* FromHistoryBackend( |
59 HistoryBackend* history_backend); | 59 HistoryBackend* history_backend); |
60 | 60 |
61 // Bookmarks ---------------------------------------------------------------- | 61 // Bookmarks ---------------------------------------------------------------- |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 // Android cache database filename. | 332 // Android cache database filename. |
333 const base::FilePath android_cache_db_filename_; | 333 const base::FilePath android_cache_db_filename_; |
334 | 334 |
335 // The history db's connection. | 335 // The history db's connection. |
336 sql::Connection* db_; | 336 sql::Connection* db_; |
337 | 337 |
338 HistoryDatabase* history_db_; | 338 HistoryDatabase* history_db_; |
339 | 339 |
340 ThumbnailDatabase* thumbnail_db_; | 340 ThumbnailDatabase* thumbnail_db_; |
341 | 341 |
342 HistoryClient* history_client_; | 342 HistoryBackendClient* backend_client_; |
343 | 343 |
344 // Whether AndroidProviderBackend has been initialized. | 344 // Whether AndroidProviderBackend has been initialized. |
345 bool initialized_; | 345 bool initialized_; |
346 | 346 |
347 HistoryBackendNotifier* notifier_; | 347 HistoryBackendNotifier* notifier_; |
348 | 348 |
349 DISALLOW_COPY_AND_ASSIGN(AndroidProviderBackend); | 349 DISALLOW_COPY_AND_ASSIGN(AndroidProviderBackend); |
350 }; | 350 }; |
351 | 351 |
352 } // namespace history | 352 } // namespace history |
353 | 353 |
354 #endif // CHROME_BROWSER_HISTORY_ANDROID_ANDROID_PROVIDER_BACKEND_H_ | 354 #endif // CHROME_BROWSER_HISTORY_ANDROID_ANDROID_PROVIDER_BACKEND_H_ |
OLD | NEW |