| 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_IN_MEMORY_URL_INDEX_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_ |
| 6 #define CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_ | 6 #define CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <functional> | 9 #include <functional> |
| 10 #include <map> | 10 #include <map> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
| 16 #include "base/file_path.h" | 16 #include "base/file_path.h" |
| 17 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
| 18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
| 19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
| 20 #include "base/string16.h" | 20 #include "base/string16.h" |
| 21 #include "chrome/browser/autocomplete/autocomplete_match.h" | 21 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 22 #include "chrome/browser/autocomplete/history_provider_util.h" | 22 #include "chrome/browser/autocomplete/history_provider_util.h" |
| 23 #include "chrome/browser/cancelable_request.h" | 23 #include "chrome/browser/cancelable_request.h" |
| 24 #include "chrome/browser/history/history.h" | 24 #include "chrome/browser/history/history.h" |
| 25 #include "chrome/browser/history/history_types.h" | 25 #include "chrome/browser/history/history_types.h" |
| 26 #include "chrome/browser/history/in_memory_url_index_types.h" | 26 #include "chrome/browser/history/in_memory_url_index_types.h" |
| 27 #include "chrome/browser/history/scored_history_match.h" |
| 27 #include "content/public/browser/notification_observer.h" | 28 #include "content/public/browser/notification_observer.h" |
| 28 #include "content/public/browser/notification_registrar.h" | 29 #include "content/public/browser/notification_registrar.h" |
| 29 #include "sql/connection.h" | 30 #include "sql/connection.h" |
| 30 | 31 |
| 31 class HistoryQuickProviderTest; | 32 class HistoryQuickProviderTest; |
| 32 class Profile; | 33 class Profile; |
| 33 | 34 |
| 34 namespace base { | 35 namespace base { |
| 35 class Time; | 36 class Time; |
| 36 } | 37 } |
| 37 | 38 |
| 38 namespace in_memory_url_index { | 39 namespace in_memory_url_index { |
| 39 class InMemoryURLIndexCacheItem; | 40 class InMemoryURLIndexCacheItem; |
| 40 } | 41 } |
| 41 | 42 |
| 42 namespace history { | 43 namespace history { |
| 43 | 44 |
| 44 namespace imui = in_memory_url_index; | 45 namespace imui = in_memory_url_index; |
| 45 | 46 |
| 46 class HistoryDatabase; | 47 class HistoryDatabase; |
| 47 class URLIndexPrivateData; | 48 class URLIndexPrivateData; |
| 48 struct URLVisitedDetails; | 49 struct URLVisitedDetails; |
| 49 struct URLsModifiedDetails; | 50 struct URLsModifiedDetails; |
| 50 struct URLsDeletedDetails; | 51 struct URLsDeletedDetails; |
| 51 | 52 |
| 52 // A RefCountedThreadSafe class that manages a bool used for passing around | |
| 53 // success when saving the persistent data for the InMemoryURLIndex in a cache. | |
| 54 class RefCountedBool : public base::RefCountedThreadSafe<RefCountedBool> { | |
| 55 public: | |
| 56 explicit RefCountedBool(bool value) : value_(value) {} | |
| 57 | |
| 58 bool value() const { return value_; } | |
| 59 void set_value(bool value) { value_ = value; } | |
| 60 | |
| 61 private: | |
| 62 friend class base::RefCountedThreadSafe<RefCountedBool>; | |
| 63 virtual ~RefCountedBool(); | |
| 64 | |
| 65 bool value_; | |
| 66 | |
| 67 DISALLOW_COPY_AND_ASSIGN(RefCountedBool); | |
| 68 }; | |
| 69 | |
| 70 // The URL history source. | 53 // The URL history source. |
| 71 // Holds portions of the URL database in memory in an indexed form. Used to | 54 // Holds portions of the URL database in memory in an indexed form. Used to |
| 72 // quickly look up matching URLs for a given query string. Used by | 55 // quickly look up matching URLs for a given query string. Used by |
| 73 // the HistoryURLProvider for inline autocomplete and to provide URL | 56 // the HistoryURLProvider for inline autocomplete and to provide URL |
| 74 // matches to the omnibox. | 57 // matches to the omnibox. |
| 75 // | 58 // |
| 76 // Note about multi-byte codepoints and the data structures in the | 59 // Note about multi-byte codepoints and the data structures in the |
| 77 // InMemoryURLIndex class: One will quickly notice that no effort is made to | 60 // InMemoryURLIndex class: One will quickly notice that no effort is made to |
| 78 // insure that multi-byte character boundaries are detected when indexing the | 61 // insure that multi-byte character boundaries are detected when indexing the |
| 79 // words and characters in the URL history database except when converting | 62 // words and characters in the URL history database except when converting |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 // TODO(mrossetti): Eliminate once the transition to SQLite has been done. | 274 // TODO(mrossetti): Eliminate once the transition to SQLite has been done. |
| 292 // http://crbug.com/83659 | 275 // http://crbug.com/83659 |
| 293 bool needs_to_be_cached_; | 276 bool needs_to_be_cached_; |
| 294 | 277 |
| 295 DISALLOW_COPY_AND_ASSIGN(InMemoryURLIndex); | 278 DISALLOW_COPY_AND_ASSIGN(InMemoryURLIndex); |
| 296 }; | 279 }; |
| 297 | 280 |
| 298 } // namespace history | 281 } // namespace history |
| 299 | 282 |
| 300 #endif // CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_ | 283 #endif // CHROME_BROWSER_HISTORY_IN_MEMORY_URL_INDEX_H_ |
| OLD | NEW |