Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Side by Side Diff: chrome/browser/history/android/android_provider_backend.h

Issue 285233012: Abstract history dependencies on bookmarks through HistoryClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <set> 8 #include <set>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/scoped_vector.h" 15 #include "base/memory/scoped_vector.h"
16 #include "chrome/browser/history/android/android_cache_database.h" 16 #include "chrome/browser/history/android/android_cache_database.h"
17 #include "chrome/browser/history/android/android_history_types.h" 17 #include "chrome/browser/history/android/android_history_types.h"
18 #include "chrome/browser/history/android/sql_handler.h" 18 #include "chrome/browser/history/android/sql_handler.h"
19 #include "chrome/browser/history/history_backend.h" 19 #include "chrome/browser/history/history_backend.h"
20 #include "chrome/browser/history/history_notifications.h" 20 #include "chrome/browser/history/history_notifications.h"
21 #include "sql/statement.h" 21 #include "sql/statement.h"
22 #include "sql/transaction.h" 22 #include "sql/transaction.h"
23 23
24 class BookmarkService;
25
26 namespace history { 24 namespace history {
27 25
28 class AndroidProviderBackend; 26 class AndroidProviderBackend;
29 class AndroidURLsSQLHandler; 27 class AndroidURLsSQLHandler;
28 class HistoryClient;
30 class HistoryDatabase; 29 class HistoryDatabase;
31 class ThumbnailDatabase; 30 class ThumbnailDatabase;
32 31
33 // This class provides the query/insert/update/remove methods to implement 32 // This class provides the query/insert/update/remove methods to implement
34 // android.provider.Browser.BookmarkColumns and 33 // android.provider.Browser.BookmarkColumns and
35 // android.provider.Browser.SearchColumns API. 34 // android.provider.Browser.SearchColumns API.
36 // 35 //
37 // When used it: 36 // When used it:
38 // 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
39 // exists. 38 // exists.
40 // b. The android_cache database is created. 39 // b. The android_cache database is created.
41 // c. The bookmark_cache table is created. 40 // c. The bookmark_cache table is created.
42 // 41 //
43 // 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
44 // methods are accessed. A data change will not triger the update. 43 // methods are accessed. A data change will not triger the update.
45 // 44 //
46 // The android_cache database is deleted when shutdown. 45 // The android_cache database is deleted when shutdown.
47 class AndroidProviderBackend { 46 class AndroidProviderBackend {
48 public: 47 public:
49 AndroidProviderBackend(const base::FilePath& cache_db_name, 48 AndroidProviderBackend(const base::FilePath& cache_db_name,
50 HistoryDatabase* history_db, 49 HistoryDatabase* history_db,
51 ThumbnailDatabase* thumbnail_db, 50 ThumbnailDatabase* thumbnail_db,
52 BookmarkService* bookmark_service, 51 HistoryClient* history_client_,
53 HistoryBackend::Delegate* delegate); 52 HistoryBackend::Delegate* delegate);
54 53
55 ~AndroidProviderBackend(); 54 ~AndroidProviderBackend();
56 55
57 // Bookmarks ---------------------------------------------------------------- 56 // Bookmarks ----------------------------------------------------------------
58 // 57 //
59 // Runs the given query and returns the result on success, NULL on error or 58 // Runs the given query and returns the result on success, NULL on error or
60 // the |projections| is empty. 59 // the |projections| is empty.
61 // 60 //
62 // |projections| is the vector of the result columns. 61 // |projections| is the vector of the result columns.
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 // Android cache database filename. 343 // Android cache database filename.
345 const base::FilePath android_cache_db_filename_; 344 const base::FilePath android_cache_db_filename_;
346 345
347 // The history db's connection. 346 // The history db's connection.
348 sql::Connection* db_; 347 sql::Connection* db_;
349 348
350 HistoryDatabase* history_db_; 349 HistoryDatabase* history_db_;
351 350
352 ThumbnailDatabase* thumbnail_db_; 351 ThumbnailDatabase* thumbnail_db_;
353 352
354 BookmarkService* bookmark_service_; 353 HistoryClient* history_client_;
355 354
356 // Whether AndroidProviderBackend has been initialized. 355 // Whether AndroidProviderBackend has been initialized.
357 bool initialized_; 356 bool initialized_;
358 357
359 HistoryBackend::Delegate* delegate_; 358 HistoryBackend::Delegate* delegate_;
360 359
361 DISALLOW_COPY_AND_ASSIGN(AndroidProviderBackend); 360 DISALLOW_COPY_AND_ASSIGN(AndroidProviderBackend);
362 }; 361 };
363 362
364 } // namespace history 363 } // namespace history
365 364
366 #endif // CHROME_BROWSER_HISTORY_ANDROID_ANDROID_PROVIDER_BACKEND_H_ 365 #endif // CHROME_BROWSER_HISTORY_ANDROID_ANDROID_PROVIDER_BACKEND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698