| 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 // Contains the history backend wrapper around the in-memory URL database. This | 5 // Contains the history backend wrapper around the in-memory URL database. This |
| 6 // object maintains an in-memory cache of the subset of history required to do | 6 // object maintains an in-memory cache of the subset of history required to do |
| 7 // in-line autocomplete. | 7 // in-line autocomplete. |
| 8 // | 8 // |
| 9 // It is created on the history thread and passed to the main thread where | 9 // It is created on the history thread and passed to the main thread where |
| 10 // operations can be completed synchronously. It listens for notifications | 10 // operations can be completed synchronously. It listens for notifications |
| 11 // from the "regular" history backend and keeps itself in sync. | 11 // from the "regular" history backend and keeps itself in sync. |
| 12 | 12 |
| 13 #ifndef CHROME_BROWSER_HISTORY_IN_MEMORY_HISTORY_BACKEND_H_ | 13 #ifndef CHROME_BROWSER_HISTORY_IN_MEMORY_HISTORY_BACKEND_H_ |
| 14 #define CHROME_BROWSER_HISTORY_IN_MEMORY_HISTORY_BACKEND_H_ | 14 #define CHROME_BROWSER_HISTORY_IN_MEMORY_HISTORY_BACKEND_H_ |
| 15 | 15 |
| 16 #include <string> | 16 #include <string> |
| 17 | 17 |
| 18 #include "base/basictypes.h" | 18 #include "base/basictypes.h" |
| 19 #include "base/gtest_prod_util.h" | 19 #include "base/gtest_prod_util.h" |
| 20 #include "base/memory/scoped_ptr.h" | 20 #include "base/memory/scoped_ptr.h" |
| 21 #include "content/public/browser/notification_observer.h" | 21 #include "content/public/browser/notification_observer.h" |
| 22 #include "content/public/browser/notification_registrar.h" | 22 #include "content/public/browser/notification_registrar.h" |
| 23 | 23 |
| 24 class FilePath; | |
| 25 class GURL; | 24 class GURL; |
| 26 class Profile; | 25 class Profile; |
| 27 | 26 |
| 27 namespace base { |
| 28 class FilePath; |
| 29 } |
| 30 |
| 28 namespace history { | 31 namespace history { |
| 29 | 32 |
| 30 class InMemoryDatabase; | 33 class InMemoryDatabase; |
| 31 class InMemoryURLIndex; | 34 class InMemoryURLIndex; |
| 32 struct KeywordSearchTermDetails; | 35 struct KeywordSearchTermDetails; |
| 33 class URLDatabase; | 36 class URLDatabase; |
| 34 struct URLsDeletedDetails; | 37 struct URLsDeletedDetails; |
| 35 struct URLsModifiedDetails; | 38 struct URLsModifiedDetails; |
| 36 | 39 |
| 37 class InMemoryHistoryBackend : public content::NotificationObserver { | 40 class InMemoryHistoryBackend : public content::NotificationObserver { |
| 38 public: | 41 public: |
| 39 InMemoryHistoryBackend(); | 42 InMemoryHistoryBackend(); |
| 40 virtual ~InMemoryHistoryBackend(); | 43 virtual ~InMemoryHistoryBackend(); |
| 41 | 44 |
| 42 // Initializes the backend from the history database pointed to by the | 45 // Initializes the backend from the history database pointed to by the |
| 43 // full path in |history_filename|. |db| is used for setting up the | 46 // full path in |history_filename|. |db| is used for setting up the |
| 44 // InMemoryDatabase. | 47 // InMemoryDatabase. |
| 45 bool Init(const FilePath& history_filename, URLDatabase* db); | 48 bool Init(const base::FilePath& history_filename, URLDatabase* db); |
| 46 | 49 |
| 47 // Does initialization work when this object is attached to the history | 50 // Does initialization work when this object is attached to the history |
| 48 // system on the main thread. The argument is the profile with which the | 51 // system on the main thread. The argument is the profile with which the |
| 49 // attached history service is under. | 52 // attached history service is under. |
| 50 void AttachToHistoryService(Profile* profile); | 53 void AttachToHistoryService(Profile* profile); |
| 51 | 54 |
| 52 // Returns the underlying database associated with this backend. The current | 55 // Returns the underlying database associated with this backend. The current |
| 53 // autocomplete code was written fro this, but it should probably be removed | 56 // autocomplete code was written fro this, but it should probably be removed |
| 54 // so that it can deal directly with this object, rather than the DB. | 57 // so that it can deal directly with this object, rather than the DB. |
| 55 InMemoryDatabase* db() const { | 58 InMemoryDatabase* db() const { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 83 // The profile that this object is attached. May be NULL before | 86 // The profile that this object is attached. May be NULL before |
| 84 // initialization. | 87 // initialization. |
| 85 Profile* profile_; | 88 Profile* profile_; |
| 86 | 89 |
| 87 DISALLOW_COPY_AND_ASSIGN(InMemoryHistoryBackend); | 90 DISALLOW_COPY_AND_ASSIGN(InMemoryHistoryBackend); |
| 88 }; | 91 }; |
| 89 | 92 |
| 90 } // namespace history | 93 } // namespace history |
| 91 | 94 |
| 92 #endif // CHROME_BROWSER_HISTORY_IN_MEMORY_HISTORY_BACKEND_H_ | 95 #endif // CHROME_BROWSER_HISTORY_IN_MEMORY_HISTORY_BACKEND_H_ |
| OLD | NEW |