diff options
45 files changed, 369 insertions, 436 deletions
@@ -68,11 +68,10 @@ 'filepath': 'chrome/browser/chromeos/', }, 'browser_components': { - 'filepath': 'chrome/browser/autofill/' \ - '|chrome/browser/bookmarks/' \ - '|chrome/browser/common/' \ - '|chrome/browser/favicon/' \ - '|chrome/browser/history/' + 'filepath': 'chrome/browser/autofill/|'\ + 'chrome/browser/history/|'\ + 'chrome/browser/bookmarks/|'\ + 'chrome/browser/favicon/', }, 'browser_compositor': { 'filepath': 'ui/compositor/' diff --git a/chrome/browser/autocomplete/extension_app_provider.cc b/chrome/browser/autocomplete/extension_app_provider.cc index f288324..33ffde9 100644 --- a/chrome/browser/autocomplete/extension_app_provider.cc +++ b/chrome/browser/autocomplete/extension_app_provider.cc @@ -9,11 +9,11 @@ #include "base/string16.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/common/url_database/url_database.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_system_factory.h" #include "chrome/browser/history/history.h" #include "chrome/browser/history/history_service_factory.h" +#include "chrome/browser/history/url_database.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/extensions/application_launch.h" #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" diff --git a/chrome/browser/autocomplete/extension_app_provider_unittest.cc b/chrome/browser/autocomplete/extension_app_provider_unittest.cc index 81038a3..ba9cf09 100644 --- a/chrome/browser/autocomplete/extension_app_provider_unittest.cc +++ b/chrome/browser/autocomplete/extension_app_provider_unittest.cc @@ -7,9 +7,9 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/autocomplete/autocomplete_match.h" #include "chrome/browser/autocomplete/extension_app_provider.h" -#include "chrome/browser/common/url_database/url_database.h" #include "chrome/browser/history/history.h" #include "chrome/browser/history/history_service_factory.h" +#include "chrome/browser/history/url_database.h" #include "chrome/test/base/testing_profile.h" #include "content/public/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" @@ -149,3 +149,4 @@ TEST_F(ExtensionAppProviderTest, CreateMatchSanitize) { EXPECT_EQ(ASCIIToUTF16(cases[i].match_contents), match.contents); } } + diff --git a/chrome/browser/autocomplete/history_quick_provider_unittest.cc b/chrome/browser/autocomplete/history_quick_provider_unittest.cc index 8a30889..5a03bc4 100644 --- a/chrome/browser/autocomplete/history_quick_provider_unittest.cc +++ b/chrome/browser/autocomplete/history_quick_provider_unittest.cc @@ -15,10 +15,10 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/autocomplete/autocomplete_provider_listener.h" #include "chrome/browser/autocomplete/autocomplete_result.h" -#include "chrome/browser/common/url_database/url_database.h" #include "chrome/browser/history/history.h" #include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/history/in_memory_url_index.h" +#include "chrome/browser/history/url_database.h" #include "chrome/browser/history/url_index_private_data.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/common/pref_names.h" @@ -498,3 +498,4 @@ TEST_F(HQPOrderingTest, TEAMatch) { RunTest(ASCIIToUTF16("tea"), expected_urls, true, ASCIIToUTF16("www.teamliquid.net")); } + diff --git a/chrome/browser/autocomplete/shortcuts_provider_unittest.cc b/chrome/browser/autocomplete/shortcuts_provider_unittest.cc index be00aff..2ee8632 100644 --- a/chrome/browser/autocomplete/shortcuts_provider_unittest.cc +++ b/chrome/browser/autocomplete/shortcuts_provider_unittest.cc @@ -20,11 +20,11 @@ #include "chrome/browser/autocomplete/autocomplete_match.h" #include "chrome/browser/autocomplete/autocomplete_provider.h" #include "chrome/browser/autocomplete/autocomplete_provider_listener.h" -#include "chrome/browser/common/url_database/url_database.h" #include "chrome/browser/history/history.h" #include "chrome/browser/history/in_memory_url_index.h" #include "chrome/browser/history/shortcuts_backend.h" #include "chrome/browser/history/shortcuts_backend_factory.h" +#include "chrome/browser/history/url_database.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_profile.h" diff --git a/chrome/browser/bookmarks/DEPS b/chrome/browser/bookmarks/DEPS index 17670e3..ca96ebe 100644 --- a/chrome/browser/bookmarks/DEPS +++ b/chrome/browser/bookmarks/DEPS @@ -5,7 +5,6 @@ include_rules = [ "-chrome/browser", "+chrome/browser/api", "+chrome/browser/bookmarks", - "+chrome/browser/common", # TODO(kaiwang): Bring this list to zero. # Do not add to the list of temporarily-allowed dependencies below, diff --git a/chrome/browser/common/DEPS b/chrome/browser/common/DEPS deleted file mode 100644 index 12813f4..0000000 --- a/chrome/browser/common/DEPS +++ /dev/null @@ -1,7 +0,0 @@ -include_rules = [ - # Common is for library/utility code shared by multiple parts of chrome - # browser. So it should not depend on other parts of the browser except API. - "-chrome/browser", - "+chrome/browser/api", - "+chrome/browser/common", -] diff --git a/chrome/browser/common/OWNERS b/chrome/browser/common/OWNERS deleted file mode 100644 index c892b3b..0000000 --- a/chrome/browser/common/OWNERS +++ /dev/null @@ -1,3 +0,0 @@ -erikwright@chromium.org -joi@chromium.org -kaiwang@chromium.org diff --git a/chrome/browser/common/README b/chrome/browser/common/README deleted file mode 100644 index 4c92f7a..0000000 --- a/chrome/browser/common/README +++ /dev/null @@ -1,3 +0,0 @@ -This directory contains library/utility code shared by multiple Browser -Components. It should not depend on other parts of the browser except through -api(chrome/browser/api). diff --git a/chrome/browser/common/url_database/url_database_types.cc b/chrome/browser/common/url_database/url_database_types.cc deleted file mode 100644 index e4a9a3a..0000000 --- a/chrome/browser/common/url_database/url_database_types.cc +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/common/url_database/url_database_types.h" - -#include "base/stl_util.h" - -namespace history { - -// URLRow ---------------------------------------------------------------------- - -URLRow::URLRow() { - Initialize(); -} - -URLRow::URLRow(const GURL& url) : url_(url) { - // Initialize will not set the URL, so our initialization above will stay. - Initialize(); -} - -URLRow::URLRow(const GURL& url, URLID id) : url_(url) { - // Initialize will not set the URL, so our initialization above will stay. - Initialize(); - // Initialize will zero the id_, so set it here. - id_ = id; -} - -URLRow::~URLRow() { -} - -URLRow& URLRow::operator=(const URLRow& other) { - id_ = other.id_; - url_ = other.url_; - title_ = other.title_; - visit_count_ = other.visit_count_; - typed_count_ = other.typed_count_; - last_visit_ = other.last_visit_; - hidden_ = other.hidden_; - return *this; -} - -void URLRow::Swap(URLRow* other) { - std::swap(id_, other->id_); - url_.Swap(&other->url_); - title_.swap(other->title_); - std::swap(visit_count_, other->visit_count_); - std::swap(typed_count_, other->typed_count_); - std::swap(last_visit_, other->last_visit_); - std::swap(hidden_, other->hidden_); -} - -void URLRow::Initialize() { - id_ = 0; - visit_count_ = 0; - typed_count_ = 0; - last_visit_ = base::Time(); - hidden_ = false; -} - -// KeywordSearchTermVisit ----------------------------------------------------- - -KeywordSearchTermVisit::KeywordSearchTermVisit() : visits(0) {} - -KeywordSearchTermVisit::~KeywordSearchTermVisit() {} - -// KeywordSearchTermRow -------------------------------------------------------- - -KeywordSearchTermRow::KeywordSearchTermRow() : keyword_id(0), url_id(0) {} - -KeywordSearchTermRow::~KeywordSearchTermRow() {} - -// Autocomplete thresholds ----------------------------------------------------- - -const int kLowQualityMatchTypedLimit = 1; -const int kLowQualityMatchVisitLimit = 4; -const int kLowQualityMatchAgeLimitInDays = 3; - -base::Time AutocompleteAgeThreshold() { - return (base::Time::Now() - - base::TimeDelta::FromDays(kLowQualityMatchAgeLimitInDays)); -} - -bool RowQualifiesAsSignificant(const URLRow& row, - const base::Time& threshold) { - const base::Time& real_threshold = - threshold.is_null() ? AutocompleteAgeThreshold() : threshold; - return (row.typed_count() >= kLowQualityMatchTypedLimit) || - (row.visit_count() >= kLowQualityMatchVisitLimit) || - (row.last_visit() >= real_threshold); -} - -// IconMapping ---------------------------------------------------------------- - -IconMapping::IconMapping() - : mapping_id(0), - icon_id(0), - icon_type(INVALID_ICON) { -} - -IconMapping::~IconMapping() {} - -} // namespace history diff --git a/chrome/browser/common/url_database/url_database_types.h b/chrome/browser/common/url_database/url_database_types.h deleted file mode 100644 index c50c44d..0000000 --- a/chrome/browser/common/url_database/url_database_types.h +++ /dev/null @@ -1,249 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_COMMON_URL_DATABASE_URL_DATABASE_TYPES_H_ -#define CHROME_BROWSER_COMMON_URL_DATABASE_URL_DATABASE_TYPES_H_ - -#include <vector> - -#include "base/basictypes.h" -#include "base/time.h" -#include "chrome/browser/common/url_database/template_url_id.h" -#include "googleurl/src/gurl.h" - -namespace history { - -typedef int64 FaviconID; // For favicons. -typedef int64 IconMappingID; // For page url and icon mapping. - -// URLRow --------------------------------------------------------------------- - -typedef int64 URLID; - -// Holds all information globally associated with one URL (one row in the -// URL table). -// -// This keeps track of dirty bits, which are currently unused: -// -// TODO(brettw) the dirty bits are broken in a number of respects. First, the -// database will want to update them on a const object, so they need to be -// mutable. -// -// Second, there is a problem copying. If you make a copy of this structure -// (as we allow since we put this into vectors in various places) then the -// dirty bits will not be in sync for these copies. -class URLRow { - public: - URLRow(); - - explicit URLRow(const GURL& url); - - // We need to be able to set the id of a URLRow that's being passed through - // an IPC message. This constructor should probably not be used otherwise. - URLRow(const GURL& url, URLID id); - - virtual ~URLRow(); - URLRow& operator=(const URLRow& other); - - URLID id() const { return id_; } - - // Sets the id of the row. The id should only be manually set when a row has - // been retrieved from the history database or other dataset based on criteria - // other than its id (i.e. by URL) and when the id has not yet been set in the - // row. - void set_id(URLID id) { id_ = id; } - - const GURL& url() const { return url_; } - - const string16& title() const { - return title_; - } - void set_title(const string16& title) { - // The title is frequently set to the same thing, so we don't bother - // updating unless the string has changed. - if (title != title_) { - title_ = title; - } - } - - // The number of times this URL has been visited. This will often match the - // number of entries in the visit table for this URL, but won't always. It's - // really designed for autocomplete ranking, so some "useless" transitions - // from the visit table aren't counted in this tally. - int visit_count() const { - return visit_count_; - } - void set_visit_count(int visit_count) { - visit_count_ = visit_count; - } - - // Number of times the URL was typed in the Omnibox. This "should" match - // the number of TYPED transitions in the visit table. It's used primarily - // for faster autocomplete ranking. If you need to know the actual number of - // TYPED transitions, you should query the visit table since there could be - // something out of sync. - int typed_count() const { - return typed_count_; - } - void set_typed_count(int typed_count) { - typed_count_ = typed_count; - } - - base::Time last_visit() const { - return last_visit_; - } - void set_last_visit(base::Time last_visit) { - last_visit_ = last_visit; - } - - // If this is set, we won't autocomplete this URL. - bool hidden() const { - return hidden_; - } - void set_hidden(bool hidden) { - hidden_ = hidden; - } - - // Helper functor that determines if an URLRow refers to a given URL. - class URLRowHasURL { - public: - explicit URLRowHasURL(const GURL& url) : url_(url) {} - - bool operator()(const URLRow& row) { - return row.url() == url_; - } - - private: - const GURL& url_; - }; - - protected: - // Swaps the contents of this URLRow with another, which allows it to be - // destructively copied without memory allocations. - void Swap(URLRow* other); - - private: - // This class writes directly into this structure and clears our dirty bits - // when reading out of the DB. - friend class URLDatabase; - friend class HistoryBackend; - - // Initializes all values that need initialization to their defaults. - // This excludes objects which autoinitialize such as strings. - void Initialize(); - - // The row ID of this URL from the history database. This is immutable except - // when retrieving the row from the database or when determining if the URL - // referenced by the URLRow already exists in the database. - URLID id_; - - // The URL of this row. Immutable except for the database which sets it - // when it pulls them out. If clients want to change it, they must use - // the constructor to make a new one. - GURL url_; - - string16 title_; - - // Total number of times this URL has been visited. - int visit_count_; - - // Number of times this URL has been manually entered in the URL bar. - int typed_count_; - - // The date of the last visit of this URL, which saves us from having to - // loop up in the visit table for things like autocomplete and expiration. - base::Time last_visit_; - - // Indicates this entry should now be shown in typical UI or queries, this - // is usually for subframes. - bool hidden_; - - // We support the implicit copy constuctor and operator=. -}; - -typedef std::vector<URLRow> URLRows; - -// KeywordSearchTermVisit ----------------------------------------------------- - -// KeywordSearchTermVisit is returned from GetMostRecentKeywordSearchTerms. It -// gives the time and search term of the keyword visit. -struct KeywordSearchTermVisit { - KeywordSearchTermVisit(); - ~KeywordSearchTermVisit(); - - string16 term; // The search term that was used. - int visits; // The visit count. - base::Time time; // The time of the most recent visit. -}; - -// KeywordSearchTermRow -------------------------------------------------------- - -// Used for URLs that have a search term associated with them. -struct KeywordSearchTermRow { - KeywordSearchTermRow(); - ~KeywordSearchTermRow(); - - TemplateURLID keyword_id; // ID of the keyword. - URLID url_id; // ID of the url. - string16 term; // The search term that was used. -}; - -// Autocomplete thresholds ----------------------------------------------------- - -// Constants which specify, when considered altogether, 'significant' -// history items. These are used to filter out insignificant items -// for consideration as autocomplete candidates. -extern const int kLowQualityMatchTypedLimit; -extern const int kLowQualityMatchVisitLimit; -extern const int kLowQualityMatchAgeLimitInDays; - -// Returns the date threshold for considering an history item as significant. -base::Time AutocompleteAgeThreshold(); - -// Return true if |row| qualifies as an autocomplete candidate. If |time_cache| -// is_null() then this function determines a new time threshold each time it is -// called. Since getting system time can be costly (such as for cases where -// this function will be called in a loop over many history items), you can -// provide a non-null |time_cache| by simply initializing |time_cache| with -// AutocompleteAgeThreshold() (or any other desired time in the past). -bool RowQualifiesAsSignificant(const URLRow& row, const base::Time& threshold); - -// Favicons ------------------------------------------------------------------- - -// Defines the icon types. They are also stored in icon_type field of favicons -// table. -// The values of the IconTypes are used to select the priority in which favicon -// data is returned in HistoryBackend and ThumbnailDatabase. Data for the -// largest IconType takes priority if data for multiple IconTypes is available. -enum IconType { - INVALID_ICON = 0x0, - FAVICON = 1 << 0, - TOUCH_ICON = 1 << 1, - TOUCH_PRECOMPOSED_ICON = 1 << 2 -}; - -// Used for the mapping between the page and icon. -struct IconMapping { - IconMapping(); - ~IconMapping(); - - // The unique id of the mapping. - IconMappingID mapping_id; - - // The url of a web page. - GURL page_url; - - // The unique id of the icon. - FaviconID icon_id; - - // The url of the icon. - GURL icon_url; - - // The type of icon. - IconType icon_type; -}; - -} // namespace history - -#endif // CHROME_BROWSER_COMMON_URL_DATABASE_URL_DATABASE_TYPES_H_ diff --git a/chrome/browser/history/DEPS b/chrome/browser/history/DEPS index 166a409..4b56bc9 100644 --- a/chrome/browser/history/DEPS +++ b/chrome/browser/history/DEPS @@ -4,7 +4,6 @@ include_rules = [ # add to the list of exceptions! "-chrome/browser", "+chrome/browser/api", - "+chrome/browser/common", "+chrome/browser/history", # TODO(erikwright): Bring this list to zero. @@ -35,6 +34,7 @@ include_rules = [ "!chrome/browser/profiles/profile_manager.h", "!chrome/browser/profiles/refcounted_profile_keyed_service.h", "!chrome/browser/profiles/refcounted_profile_keyed_service_factory.h", + "!chrome/browser/search_engines/template_url_id.h", "!chrome/browser/ui/profile_error_dialog.h", "!chrome/browser/ui/webui/ntp/most_visited_handler.h", "!chrome/browser/ui/webui/ntp/new_tab_ui.h", diff --git a/chrome/browser/history/android/android_history_types.h b/chrome/browser/history/android/android_history_types.h index a385d6a..843f465 100644 --- a/chrome/browser/history/android/android_history_types.h +++ b/chrome/browser/history/android/android_history_types.h @@ -9,7 +9,7 @@ #include "base/memory/scoped_ptr.h" #include "chrome/browser/history/history_types.h" -#include "chrome/browser/common/url_database/template_url_id.h" +#include "chrome/browser/search_engines/template_url_id.h" #include "sql/statement.h" namespace sql { diff --git a/chrome/browser/history/android/bookmark_model_sql_handler.cc b/chrome/browser/history/android/bookmark_model_sql_handler.cc index 852caae..35cdda3 100644 --- a/chrome/browser/history/android/bookmark_model_sql_handler.cc +++ b/chrome/browser/history/android/bookmark_model_sql_handler.cc @@ -9,7 +9,7 @@ #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_model_factory.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/common/url_database/url_database.h" +#include "chrome/browser/history/url_database.h" #include "chrome/browser/profiles/profile_manager.h" #include "content/public/browser/browser_thread.h" diff --git a/chrome/browser/history/archived_database.h b/chrome/browser/history/archived_database.h index 44ca025..b157f66 100644 --- a/chrome/browser/history/archived_database.h +++ b/chrome/browser/history/archived_database.h @@ -6,7 +6,7 @@ #define CHROME_BROWSER_HISTORY_ARCHIVED_DATABASE_H_ #include "base/basictypes.h" -#include "chrome/browser/common/url_database/url_database.h" +#include "chrome/browser/history/url_database.h" #include "chrome/browser/history/visit_database.h" #include "sql/connection.h" #include "sql/init_status.h" diff --git a/chrome/browser/history/history.h b/chrome/browser/history/history.h index 5a500ce..e2cb324 100644 --- a/chrome/browser/history/history.h +++ b/chrome/browser/history/history.h @@ -16,10 +16,10 @@ #include "base/observer_list_threadsafe.h" #include "base/string16.h" #include "chrome/browser/cancelable_request.h" -#include "chrome/browser/common/url_database/template_url_id.h" #include "chrome/browser/favicon/favicon_service.h" #include "chrome/browser/history/history_types.h" #include "chrome/browser/profiles/refcounted_profile_keyed_service.h" +#include "chrome/browser/search_engines/template_url_id.h" #include "chrome/common/ref_counted_util.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" diff --git a/chrome/browser/history/history_backend.h b/chrome/browser/history/history_backend.h index 59a7836..10c5550 100644 --- a/chrome/browser/history/history_backend.h +++ b/chrome/browser/history/history_backend.h @@ -13,7 +13,6 @@ #include "base/memory/mru_cache.h" #include "base/memory/scoped_ptr.h" #include "chrome/browser/cancelable_request.h" -#include "chrome/browser/common/url_database/template_url_id.h" #include "chrome/browser/history/archived_database.h" #include "chrome/browser/history/expire_history_backend.h" #include "chrome/browser/history/history_database.h" @@ -22,6 +21,7 @@ #include "chrome/browser/history/text_database_manager.h" #include "chrome/browser/history/thumbnail_database.h" #include "chrome/browser/history/visit_tracker.h" +#include "chrome/browser/search_engines/template_url_id.h" #include "sql/init_status.h" #include "ui/base/layout.h" diff --git a/chrome/browser/history/history_database.h b/chrome/browser/history/history_database.h index 6feb1d3..23c73ca 100644 --- a/chrome/browser/history/history_database.h +++ b/chrome/browser/history/history_database.h @@ -9,9 +9,9 @@ #include "base/compiler_specific.h" #include "base/gtest_prod_util.h" #include "build/build_config.h" -#include "chrome/browser/common/url_database/url_database.h" #include "chrome/browser/history/download_database.h" #include "chrome/browser/history/history_types.h" +#include "chrome/browser/history/url_database.h" #include "chrome/browser/history/visit_database.h" #include "chrome/browser/history/visitsegment_database.h" #include "sql/connection.h" diff --git a/chrome/browser/history/history_notifications.h b/chrome/browser/history/history_notifications.h index 069b4e3..d5c6ed1 100644 --- a/chrome/browser/history/history_notifications.h +++ b/chrome/browser/history/history_notifications.h @@ -11,8 +11,8 @@ #include <vector> #include "googleurl/src/gurl.h" -#include "chrome/browser/common/url_database/template_url_id.h" #include "chrome/browser/history/history_types.h" +#include "chrome/browser/search_engines/template_url_id.h" namespace history { diff --git a/chrome/browser/history/history_types.cc b/chrome/browser/history/history_types.cc index dd7c038..7c67d04 100644 --- a/chrome/browser/history/history_types.cc +++ b/chrome/browser/history/history_types.cc @@ -12,6 +12,56 @@ namespace history { +// URLRow ---------------------------------------------------------------------- + +URLRow::URLRow() { + Initialize(); +} + +URLRow::URLRow(const GURL& url) : url_(url) { + // Initialize will not set the URL, so our initialization above will stay. + Initialize(); +} + +URLRow::URLRow(const GURL& url, URLID id) : url_(url) { + // Initialize will not set the URL, so our initialization above will stay. + Initialize(); + // Initialize will zero the id_, so set it here. + id_ = id; +} + +URLRow::~URLRow() { +} + +URLRow& URLRow::operator=(const URLRow& other) { + id_ = other.id_; + url_ = other.url_; + title_ = other.title_; + visit_count_ = other.visit_count_; + typed_count_ = other.typed_count_; + last_visit_ = other.last_visit_; + hidden_ = other.hidden_; + return *this; +} + +void URLRow::Swap(URLRow* other) { + std::swap(id_, other->id_); + url_.Swap(&other->url_); + title_.swap(other->title_); + std::swap(visit_count_, other->visit_count_); + std::swap(typed_count_, other->typed_count_); + std::swap(last_visit_, other->last_visit_); + std::swap(hidden_, other->hidden_); +} + +void URLRow::Initialize() { + id_ = 0; + visit_count_ = 0; + typed_count_ = 0; + last_visit_ = base::Time(); + hidden_ = false; +} + // VisitRow -------------------------------------------------------------------- VisitRow::VisitRow() @@ -219,6 +269,18 @@ void QueryOptions::SetRecentDayRange(int days_ago) { begin_time = end_time - base::TimeDelta::FromDays(days_ago); } +// KeywordSearchTermVisit ----------------------------------------------------- + +KeywordSearchTermVisit::KeywordSearchTermVisit() : visits(0) {} + +KeywordSearchTermVisit::~KeywordSearchTermVisit() {} + +// KeywordSearchTermRow -------------------------------------------------------- + +KeywordSearchTermRow::KeywordSearchTermRow() : keyword_id(0), url_id(0) {} + +KeywordSearchTermRow::~KeywordSearchTermRow() {} + // MostVisitedURL -------------------------------------------------------------- MostVisitedURL::MostVisitedURL() {} @@ -302,6 +364,36 @@ MostVisitedThumbnails::MostVisitedThumbnails() {} MostVisitedThumbnails::~MostVisitedThumbnails() {} +// Autocomplete thresholds ----------------------------------------------------- + +const int kLowQualityMatchTypedLimit = 1; +const int kLowQualityMatchVisitLimit = 4; +const int kLowQualityMatchAgeLimitInDays = 3; + +base::Time AutocompleteAgeThreshold() { + return (base::Time::Now() - + base::TimeDelta::FromDays(kLowQualityMatchAgeLimitInDays)); +} + +bool RowQualifiesAsSignificant(const URLRow& row, + const base::Time& threshold) { + const base::Time& real_threshold = + threshold.is_null() ? AutocompleteAgeThreshold() : threshold; + return (row.typed_count() >= kLowQualityMatchTypedLimit) || + (row.visit_count() >= kLowQualityMatchVisitLimit) || + (row.last_visit() >= real_threshold); +} + +// IconMapping ---------------------------------------------------------------- + +IconMapping::IconMapping() + : mapping_id(0), + icon_id(0), + icon_type(INVALID_ICON) { +} + +IconMapping::~IconMapping() {} + // FaviconBitmapResult -------------------------------------------------------- FaviconBitmapResult::FaviconBitmapResult() diff --git a/chrome/browser/history/history_types.h b/chrome/browser/history/history_types.h index 4e44b4e..d50a634 100644 --- a/chrome/browser/history/history_types.h +++ b/chrome/browser/history/history_types.h @@ -16,9 +16,8 @@ #include "base/stack_container.h" #include "base/string16.h" #include "base/time.h" -#include "chrome/browser/common/url_database/template_url_id.h" -#include "chrome/browser/common/url_database/url_database_types.h" #include "chrome/browser/history/snippet.h" +#include "chrome/browser/search_engines/template_url_id.h" #include "chrome/common/ref_counted_util.h" #include "chrome/common/thumbnail_score.h" #include "content/public/common/page_transition_types.h" @@ -42,8 +41,156 @@ typedef std::map<GURL, scoped_refptr<RefCountedVector<GURL> > > RedirectMap; typedef std::vector<GURL> RedirectList; typedef int64 DownloadID; // Identifier for a download. +typedef int64 FaviconID; // For favicons. typedef int64 FaviconBitmapID; // Identifier for a bitmap in a favicon. typedef int64 SegmentID; // URL segments for the most visited view. +typedef int64 IconMappingID; // For page url and icon mapping. + +// URLRow --------------------------------------------------------------------- + +typedef int64 URLID; + +// Holds all information globally associated with one URL (one row in the +// URL table). +// +// This keeps track of dirty bits, which are currently unused: +// +// TODO(brettw) the dirty bits are broken in a number of respects. First, the +// database will want to update them on a const object, so they need to be +// mutable. +// +// Second, there is a problem copying. If you make a copy of this structure +// (as we allow since we put this into vectors in various places) then the +// dirty bits will not be in sync for these copies. +class URLRow { + public: + URLRow(); + + explicit URLRow(const GURL& url); + + // We need to be able to set the id of a URLRow that's being passed through + // an IPC message. This constructor should probably not be used otherwise. + URLRow(const GURL& url, URLID id); + + virtual ~URLRow(); + URLRow& operator=(const URLRow& other); + + URLID id() const { return id_; } + + // Sets the id of the row. The id should only be manually set when a row has + // been retrieved from the history database or other dataset based on criteria + // other than its id (i.e. by URL) and when the id has not yet been set in the + // row. + void set_id(URLID id) { id_ = id; } + + const GURL& url() const { return url_; } + + const string16& title() const { + return title_; + } + void set_title(const string16& title) { + // The title is frequently set to the same thing, so we don't bother + // updating unless the string has changed. + if (title != title_) { + title_ = title; + } + } + + // The number of times this URL has been visited. This will often match the + // number of entries in the visit table for this URL, but won't always. It's + // really designed for autocomplete ranking, so some "useless" transitions + // from the visit table aren't counted in this tally. + int visit_count() const { + return visit_count_; + } + void set_visit_count(int visit_count) { + visit_count_ = visit_count; + } + + // Number of times the URL was typed in the Omnibox. This "should" match + // the number of TYPED transitions in the visit table. It's used primarily + // for faster autocomplete ranking. If you need to know the actual number of + // TYPED transitions, you should query the visit table since there could be + // something out of sync. + int typed_count() const { + return typed_count_; + } + void set_typed_count(int typed_count) { + typed_count_ = typed_count; + } + + base::Time last_visit() const { + return last_visit_; + } + void set_last_visit(base::Time last_visit) { + last_visit_ = last_visit; + } + + // If this is set, we won't autocomplete this URL. + bool hidden() const { + return hidden_; + } + void set_hidden(bool hidden) { + hidden_ = hidden; + } + + // Helper functor that determines if an URLRow refers to a given URL. + class URLRowHasURL { + public: + explicit URLRowHasURL(const GURL& url) : url_(url) {} + + bool operator()(const URLRow& row) { + return row.url() == url_; + } + + private: + const GURL& url_; + }; + + protected: + // Swaps the contents of this URLRow with another, which allows it to be + // destructively copied without memory allocations. + void Swap(URLRow* other); + + private: + // This class writes directly into this structure and clears our dirty bits + // when reading out of the DB. + friend class URLDatabase; + friend class HistoryBackend; + + // Initializes all values that need initialization to their defaults. + // This excludes objects which autoinitialize such as strings. + void Initialize(); + + // The row ID of this URL from the history database. This is immutable except + // when retrieving the row from the database or when determining if the URL + // referenced by the URLRow already exists in the database. + URLID id_; + + // The URL of this row. Immutable except for the database which sets it + // when it pulls them out. If clients want to change it, they must use + // the constructor to make a new one. + GURL url_; + + string16 title_; + + // Total number of times this URL has been visited. + int visit_count_; + + // Number of times this URL has been manually entered in the URL bar. + int typed_count_; + + // The date of the last visit of this URL, which saves us from having to + // loop up in the visit table for things like autocomplete and expiration. + base::Time last_visit_; + + // Indicates this entry should now be shown in typical UI or queries, this + // is usually for subframes. + bool hidden_; + + // We support the implicit copy constuctor and operator=. +}; +typedef std::vector<URLRow> URLRows; // The enumeration of all possible sources of visits is listed below. // The source will be propagated along with a URL or a visit item @@ -313,6 +460,31 @@ struct QueryOptions { bool body_only; }; +// KeywordSearchTermVisit ----------------------------------------------------- + +// KeywordSearchTermVisit is returned from GetMostRecentKeywordSearchTerms. It +// gives the time and search term of the keyword visit. +struct KeywordSearchTermVisit { + KeywordSearchTermVisit(); + ~KeywordSearchTermVisit(); + + string16 term; // The search term that was used. + int visits; // The visit count. + base::Time time; // The time of the most recent visit. +}; + +// KeywordSearchTermRow -------------------------------------------------------- + +// Used for URLs that have a search term associated with them. +struct KeywordSearchTermRow { + KeywordSearchTermRow(); + ~KeywordSearchTermRow(); + + TemplateURLID keyword_id; // ID of the keyword. + URLID url_id; // ID of the url. + string16 term; // The search term that was used. +}; + // MostVisitedURL -------------------------------------------------------------- // Holds the per-URL information of the most visited query. @@ -480,6 +652,41 @@ base::Time AutocompleteAgeThreshold(); // AutocompleteAgeThreshold() (or any other desired time in the past). bool RowQualifiesAsSignificant(const URLRow& row, const base::Time& threshold); +// Favicons ------------------------------------------------------------------- + +// Defines the icon types. They are also stored in icon_type field of favicons +// table. +// The values of the IconTypes are used to select the priority in which favicon +// data is returned in HistoryBackend and ThumbnailDatabase. Data for the +// largest IconType takes priority if data for multiple IconTypes is available. +enum IconType { + INVALID_ICON = 0x0, + FAVICON = 1 << 0, + TOUCH_ICON = 1 << 1, + TOUCH_PRECOMPOSED_ICON = 1 << 2 +}; + +// Used for the mapping between the page and icon. +struct IconMapping { + IconMapping(); + ~IconMapping(); + + // The unique id of the mapping. + IconMappingID mapping_id; + + // The url of a web page. + GURL page_url; + + // The unique id of the icon. + FaviconID icon_id; + + // The url of the icon. + GURL icon_url; + + // The type of icon. + IconType icon_type; +}; + // Defines a favicon bitmap which best matches the desired DIP size and one of // the desired scale factors. struct FaviconBitmapResult { diff --git a/chrome/browser/history/in_memory_database.h b/chrome/browser/history/in_memory_database.h index a0889ec..17cb6f1 100644 --- a/chrome/browser/history/in_memory_database.h +++ b/chrome/browser/history/in_memory_database.h @@ -6,7 +6,7 @@ #define CHROME_BROWSER_HISTORY_IN_MEMORY_DATABASE_H_ #include "base/basictypes.h" -#include "chrome/browser/common/url_database/url_database.h" +#include "chrome/browser/history/url_database.h" #include "sql/connection.h" class FilePath; diff --git a/chrome/browser/history/in_memory_history_backend.cc b/chrome/browser/history/in_memory_history_backend.cc index 1596310..b0dac72 100644 --- a/chrome/browser/history/in_memory_history_backend.cc +++ b/chrome/browser/history/in_memory_history_backend.cc @@ -11,9 +11,9 @@ #include "base/time.h" #include "base/utf_string_conversions.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/common/url_database/url_database.h" #include "chrome/browser/history/history_notifications.h" #include "chrome/browser/history/in_memory_database.h" +#include "chrome/browser/history/url_database.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_notification_types.h" #include "content/public/browser/notification_details.h" diff --git a/chrome/browser/history/in_memory_url_index.cc b/chrome/browser/history/in_memory_url_index.cc index c070392..68a13ff 100644 --- a/chrome/browser/history/in_memory_url_index.cc +++ b/chrome/browser/history/in_memory_url_index.cc @@ -9,9 +9,9 @@ #include "chrome/browser/api/bookmarks/bookmark_service.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_model_factory.h" -#include "chrome/browser/common/url_database/url_database.h" #include "chrome/browser/history/history_notifications.h" #include "chrome/browser/history/history_service_factory.h" +#include "chrome/browser/history/url_database.h" #include "chrome/browser/history/url_index_private_data.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_notification_types.h" diff --git a/chrome/browser/history/in_memory_url_index_unittest.cc b/chrome/browser/history/in_memory_url_index_unittest.cc index bea2350..834cfd9 100644 --- a/chrome/browser/history/in_memory_url_index_unittest.cc +++ b/chrome/browser/history/in_memory_url_index_unittest.cc @@ -230,7 +230,7 @@ void InMemoryURLIndexTest::SetUp() { // Update the last_visit_time table column // such that it represents a time relative to 'now'. sql::Statement statement(db.GetUniqueStatement( - "SELECT" URL_DATABASE_ROW_FIELDS "FROM urls;")); + "SELECT" HISTORY_URL_ROW_FIELDS "FROM urls;")); ASSERT_TRUE(statement.is_valid()); base::Time time_right_now = base::Time::NowFromSystemTime(); base::TimeDelta day_delta = base::TimeDelta::FromDays(1); diff --git a/chrome/browser/history/text_database_manager.h b/chrome/browser/history/text_database_manager.h index 7ef054d..9e85807 100644 --- a/chrome/browser/history/text_database_manager.h +++ b/chrome/browser/history/text_database_manager.h @@ -14,10 +14,10 @@ #include "base/memory/weak_ptr.h" #include "base/string16.h" #include "base/memory/mru_cache.h" -#include "chrome/browser/common/url_database/url_database.h" #include "chrome/browser/history/history_types.h" #include "chrome/browser/history/text_database.h" #include "chrome/browser/history/query_parser.h" +#include "chrome/browser/history/url_database.h" namespace history { diff --git a/chrome/browser/history/thumbnail_database.cc b/chrome/browser/history/thumbnail_database.cc index 97db9c2..f0e45f9 100644 --- a/chrome/browser/history/thumbnail_database.cc +++ b/chrome/browser/history/thumbnail_database.cc @@ -15,10 +15,10 @@ #include "base/string_util.h" #include "base/time.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/common/url_database/url_database.h" #include "chrome/browser/diagnostics/sqlite_diagnostics.h" #include "chrome/browser/history/history_publisher.h" #include "chrome/browser/history/top_sites.h" +#include "chrome/browser/history/url_database.h" #include "chrome/common/thumbnail_score.h" #include "sql/statement.h" #include "sql/transaction.h" diff --git a/chrome/browser/history/top_sites_database.cc b/chrome/browser/history/top_sites_database.cc index c489f0d..dce0ce4 100644 --- a/chrome/browser/history/top_sites_database.cc +++ b/chrome/browser/history/top_sites_database.cc @@ -11,7 +11,6 @@ #include "chrome/browser/history/top_sites.h" #include "chrome/browser/history/top_sites_database.h" #include "sql/connection.h" -#include "sql/statement.h" #include "sql/transaction.h" namespace history { diff --git a/chrome/browser/history/top_sites_database.h b/chrome/browser/history/top_sites_database.h index 05baafb..313c706 100644 --- a/chrome/browser/history/top_sites_database.h +++ b/chrome/browser/history/top_sites_database.h @@ -10,6 +10,7 @@ #include "base/gtest_prod_util.h" #include "chrome/browser/history/history_types.h" +#include "chrome/browser/history/url_database.h" // For DBCloseScoper. #include "sql/meta_table.h" class FilePath; diff --git a/chrome/browser/history/top_sites_database_unittest.cc b/chrome/browser/history/top_sites_database_unittest.cc index 9564caa..abd681e 100644 --- a/chrome/browser/history/top_sites_database_unittest.cc +++ b/chrome/browser/history/top_sites_database_unittest.cc @@ -6,7 +6,6 @@ #include "base/file_util.h" #include "base/scoped_temp_dir.h" #include "chrome/browser/history/top_sites_database.h" -#include "sql/connection.h" #include "testing/gtest/include/gtest/gtest.h" namespace history { diff --git a/chrome/browser/common/url_database/url_database.cc b/chrome/browser/history/url_database.cc index 80a42d8..5387bc1 100644 --- a/chrome/browser/common/url_database/url_database.cc +++ b/chrome/browser/history/url_database.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/common/url_database/url_database.h" +#include "chrome/browser/history/url_database.h" #include <algorithm> #include <limits> @@ -18,7 +18,7 @@ namespace history { -const char URLDatabase::kURLRowFields[] = URL_DATABASE_ROW_FIELDS; +const char URLDatabase::kURLRowFields[] = HISTORY_URL_ROW_FIELDS; const int URLDatabase::kNumURLRowFields = 9; URLDatabase::URLEnumeratorBase::URLEnumeratorBase() @@ -47,7 +47,7 @@ bool URLDatabase::IconMappingEnumerator::GetNextIconMapping(IconMapping* r) { return false; r->page_url = GURL(statement_.ColumnString(0)); - r->icon_id = statement_.ColumnInt64(1); + r->icon_id = statement_.ColumnInt64(1); return true; } @@ -89,7 +89,7 @@ bool URLDatabase::GetURLRow(URLID url_id, URLRow* info) { // we added any checks. We should eventually be able to remove it // when all inputs are using GURL (which prohibit empty input). sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE, - "SELECT" URL_DATABASE_ROW_FIELDS "FROM urls WHERE id=?")); + "SELECT" HISTORY_URL_ROW_FIELDS "FROM urls WHERE id=?")); statement.BindInt64(0, url_id); if (statement.Step()) { @@ -101,7 +101,7 @@ bool URLDatabase::GetURLRow(URLID url_id, URLRow* info) { bool URLDatabase::GetAllTypedUrls(URLRows* urls) { sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE, - "SELECT" URL_DATABASE_ROW_FIELDS "FROM urls WHERE typed_count > 0")); + "SELECT" HISTORY_URL_ROW_FIELDS "FROM urls WHERE typed_count > 0")); while (statement.Step()) { URLRow info; @@ -113,7 +113,7 @@ bool URLDatabase::GetAllTypedUrls(URLRows* urls) { URLID URLDatabase::GetRowForURL(const GURL& url, history::URLRow* info) { sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE, - "SELECT" URL_DATABASE_ROW_FIELDS "FROM urls WHERE url=?")); + "SELECT" HISTORY_URL_ROW_FIELDS "FROM urls WHERE url=?")); std::string url_string = GURLToDatabaseURL(url); statement.BindString(0, url_string); @@ -145,7 +145,7 @@ URLID URLDatabase::AddURLInternal(const history::URLRow& info, bool is_temporary) { // This function is used to insert into two different tables, so we have to // do some shuffling. Unfortinately, we can't use the macro - // URL_DATABASE_ROW_FIELDS because that specifies the table name which is + // HISTORY_URL_ROW_FIELDS because that specifies the table name which is // invalid in the insert syntax. #define ADDURL_COMMON_SUFFIX \ " (url, title, visit_count, typed_count, "\ @@ -274,13 +274,13 @@ bool URLDatabase::AutocompleteForPrefix(const std::string& prefix, const char* sql; int line; if (typed_only) { - sql = "SELECT" URL_DATABASE_ROW_FIELDS "FROM urls " + sql = "SELECT" HISTORY_URL_ROW_FIELDS "FROM urls " "WHERE url >= ? AND url < ? AND hidden = 0 AND typed_count > 0 " "ORDER BY typed_count DESC, visit_count DESC, last_visit_time DESC " "LIMIT ?"; line = __LINE__; } else { - sql = "SELECT" URL_DATABASE_ROW_FIELDS "FROM urls " + sql = "SELECT" HISTORY_URL_ROW_FIELDS "FROM urls " "WHERE url >= ? AND url < ? AND hidden = 0 " "ORDER BY typed_count DESC, visit_count DESC, last_visit_time DESC " "LIMIT ?"; diff --git a/chrome/browser/common/url_database/url_database.h b/chrome/browser/history/url_database.h index 58345bf..5cf44c2 100644 --- a/chrome/browser/common/url_database/url_database.h +++ b/chrome/browser/history/url_database.h @@ -2,16 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_COMMON_URL_DATABASE_URL_DATABASE_H_ -#define CHROME_BROWSER_COMMON_URL_DATABASE_URL_DATABASE_H_ +#ifndef CHROME_BROWSER_HISTORY_URL_DATABASE_H_ +#define CHROME_BROWSER_HISTORY_URL_DATABASE_H_ #include "base/basictypes.h" -#include "chrome/browser/common/url_database/template_url_id.h" -#include "chrome/browser/common/url_database/url_database_types.h" +#include "chrome/browser/history/history_types.h" +#include "chrome/browser/search_engines/template_url_id.h" #include "sql/statement.h" class GURL; -class IconMapping; namespace sql { class Connection; @@ -19,6 +18,8 @@ class Connection; namespace history { +class VisitDatabase; // For friend statement. + // Encapsulates an SQL database that holds URL info. This is a subset of the // full history data. We split this class' functionality out from the larger // HistoryDatabase class to support maintaining separate databases of URLs with @@ -130,7 +131,7 @@ class URLDatabase { URLEnumerator(); // Retreives the next url. Returns false if no more urls are available - bool GetNextURL(URLRow* r); + bool GetNextURL(history::URLRow* r); private: DISALLOW_COPY_AND_ASSIGN(URLEnumerator); @@ -186,7 +187,7 @@ class URLDatabase { int min_visits, int min_typed, bool allow_base, - URLRow* info); + history::URLRow* info); // Keyword Search Terms ------------------------------------------------------ @@ -221,7 +222,7 @@ class URLDatabase { // Migration ----------------------------------------------------------------- - // Due to a bug we were setting the favicon of about:blank. This forces + // Do to a bug we were setting the favicon of about:blank. This forces // about:blank to have no icon or title. Returns true on success, false if // the favicon couldn't be updated. bool MigrateFromVersion11ToVersion12(); @@ -232,7 +233,9 @@ class URLDatabase { IconMappingEnumerator* enumerator); protected: - // See URL_DATABASE_ROW_FIELDS below. + friend class VisitDatabase; + + // See HISTORY_URL_ROW_FIELDS below. static const char kURLRowFields[]; // The number of fiends in kURLRowFields. If callers need additional @@ -289,8 +292,6 @@ class URLDatabase { DISALLOW_COPY_AND_ASSIGN(URLDatabase); }; -} // namespace history - // The fields and order expected by FillURLRow(). ID is guaranteed to be first // so that DISTINCT can be prepended to get distinct URLs. // @@ -298,8 +299,10 @@ class URLDatabase { // the macro if you want to put this in the middle of an otherwise constant // string, it will save time doing string appends. If you have to build a SQL // string dynamically anyway, use the constant, it will save space. -#define URL_DATABASE_ROW_FIELDS \ +#define HISTORY_URL_ROW_FIELDS \ " urls.id, urls.url, urls.title, urls.visit_count, urls.typed_count, " \ "urls.last_visit_time, urls.hidden " -#endif // CHROME_BROWSER_COMMON_URL_DATABASE_URL_DATABASE_H_ +} // history + +#endif // CHROME_BROWSER_HISTORY_URL_DATABASE_H_ diff --git a/chrome/browser/common/url_database/url_database_unittest.cc b/chrome/browser/history/url_database_unittest.cc index 2c94967..485c940 100644 --- a/chrome/browser/common/url_database/url_database_unittest.cc +++ b/chrome/browser/history/url_database_unittest.cc @@ -8,7 +8,7 @@ #include "base/scoped_temp_dir.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/common/url_database/url_database.h" +#include "chrome/browser/history/url_database.h" #include "sql/connection.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/history/visit_database.cc b/chrome/browser/history/visit_database.cc index 2c564a6..4a1bdd9 100644 --- a/chrome/browser/history/visit_database.cc +++ b/chrome/browser/history/visit_database.cc @@ -11,7 +11,7 @@ #include "base/logging.h" #include "base/string_number_conversions.h" -#include "chrome/browser/common/url_database/url_database.h" +#include "chrome/browser/history/url_database.h" #include "chrome/browser/history/visit_filter.h" #include "chrome/common/url_constants.h" #include "content/public/common/page_transition_types.h" diff --git a/chrome/browser/history/visit_database_unittest.cc b/chrome/browser/history/visit_database_unittest.cc index e510f8f..38c04aa 100644 --- a/chrome/browser/history/visit_database_unittest.cc +++ b/chrome/browser/history/visit_database_unittest.cc @@ -7,7 +7,7 @@ #include "base/path_service.h" #include "base/scoped_temp_dir.h" #include "base/string_util.h" -#include "chrome/browser/common/url_database/url_database.h" +#include "chrome/browser/history/url_database.h" #include "chrome/browser/history/visit_database.h" #include "sql/connection.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/predictors/autocomplete_action_predictor_unittest.cc b/chrome/browser/predictors/autocomplete_action_predictor_unittest.cc index 7a9e5b9..5da0b9a 100644 --- a/chrome/browser/predictors/autocomplete_action_predictor_unittest.cc +++ b/chrome/browser/predictors/autocomplete_action_predictor_unittest.cc @@ -13,10 +13,10 @@ #include "base/time.h" #include "base/utf_string_conversions.h" #include "chrome/browser/autocomplete/autocomplete_match.h" -#include "chrome/browser/common/url_database/url_database.h" #include "chrome/browser/history/history.h" #include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/history/in_memory_database.h" +#include "chrome/browser/history/url_database.h" #include "chrome/browser/prerender/prerender_field_trial.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/base/testing_profile.h" diff --git a/chrome/browser/predictors/resource_prefetch_predictor.cc b/chrome/browser/predictors/resource_prefetch_predictor.cc index 8897d80..892e088 100644 --- a/chrome/browser/predictors/resource_prefetch_predictor.cc +++ b/chrome/browser/predictors/resource_prefetch_predictor.cc @@ -14,11 +14,11 @@ #include "base/string_number_conversions.h" #include "base/stringprintf.h" #include "base/time.h" -#include "chrome/browser/common/url_database/url_database.h" #include "chrome/browser/history/history.h" #include "chrome/browser/history/history_notifications.h" #include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/history/in_memory_database.h" +#include "chrome/browser/history/url_database.h" #include "chrome/browser/predictors/predictor_database.h" #include "chrome/browser/predictors/predictor_database_factory.h" #include "chrome/browser/prerender/prerender_field_trial.h" diff --git a/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc b/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc index 102612f..de0b00a 100644 --- a/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc +++ b/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc @@ -7,11 +7,11 @@ #include "base/message_loop.h" #include "base/memory/scoped_ptr.h" #include "base/time.h" -#include "chrome/browser/common/url_database/url_database.h" #include "chrome/browser/history/history.h" #include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/history/history_types.h" #include "chrome/browser/history/in_memory_database.h" +#include "chrome/browser/history/url_database.h" #include "chrome/browser/predictors/resource_prefetch_predictor.h" #include "chrome/browser/predictors/resource_prefetch_predictor_tables.h" #include "chrome/test/base/testing_profile.h" diff --git a/chrome/browser/search_engines/template_url.h b/chrome/browser/search_engines/template_url.h index 025b88e..4241f52 100644 --- a/chrome/browser/search_engines/template_url.h +++ b/chrome/browser/search_engines/template_url.h @@ -10,7 +10,7 @@ #include "base/gtest_prod_util.h" #include "base/time.h" -#include "chrome/browser/common/url_database/template_url_id.h" +#include "chrome/browser/search_engines/template_url_id.h" #include "googleurl/src/gurl.h" class Profile; diff --git a/chrome/browser/common/url_database/template_url_id.h b/chrome/browser/search_engines/template_url_id.h index 192810e..13dd862 100644 --- a/chrome/browser/common/url_database/template_url_id.h +++ b/chrome/browser/search_engines/template_url_id.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_COMMON_URL_DATABASE_TEMPLATE_URL_ID_H_ -#define CHROME_BROWSER_COMMON_URL_DATABASE_TEMPLATE_URL_ID_H_ +#ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_ID_H_ +#define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_ID_H_ #include "base/basictypes.h" @@ -11,4 +11,4 @@ typedef int64 TemplateURLID; const TemplateURLID kInvalidTemplateURLID = 0; -#endif // CHROME_BROWSER_COMMON_URL_DATABASE_TEMPLATE_URL_ID_H_ +#endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_ID_H_ diff --git a/chrome/browser/search_engines/template_url_service.h b/chrome/browser/search_engines/template_url_service.h index a5a9b4b..3c56c17 100644 --- a/chrome/browser/search_engines/template_url_service.h +++ b/chrome/browser/search_engines/template_url_service.h @@ -15,8 +15,8 @@ #include "base/memory/scoped_ptr.h" #include "base/observer_list.h" #include "chrome/browser/api/prefs/pref_change_registrar.h" -#include "chrome/browser/common/url_database/template_url_id.h" #include "chrome/browser/profiles/profile_keyed_service.h" +#include "chrome/browser/search_engines/template_url_id.h" #include "chrome/browser/webdata/web_data_service.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" diff --git a/chrome/browser/webdata/keyword_table.h b/chrome/browser/webdata/keyword_table.h index e4651ae..1293a4b 100644 --- a/chrome/browser/webdata/keyword_table.h +++ b/chrome/browser/webdata/keyword_table.h @@ -11,8 +11,8 @@ #include "base/compiler_specific.h" #include "base/gtest_prod_util.h" #include "base/string16.h" -#include "chrome/browser/common/url_database/template_url_id.h" #include "chrome/browser/webdata/web_database_table.h" +#include "chrome/browser/search_engines/template_url_id.h" struct TemplateURLData; diff --git a/chrome/browser/webdata/web_data_service.h b/chrome/browser/webdata/web_data_service.h index 6c265c3..e1e6087 100644 --- a/chrome/browser/webdata/web_data_service.h +++ b/chrome/browser/webdata/web_data_service.h @@ -23,8 +23,8 @@ #include "chrome/browser/api/webdata/web_data_results.h" #include "chrome/browser/api/webdata/web_data_service_base.h" #include "chrome/browser/api/webdata/web_data_service_consumer.h" -#include "chrome/browser/common/url_database/template_url_id.h" #include "chrome/browser/search_engines/template_url.h" +#include "chrome/browser/search_engines/template_url_id.h" #include "chrome/browser/webdata/keyword_table.h" #include "content/public/browser/browser_thread.h" #include "sql/init_status.h" diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index a067fc5..0979f60 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -479,11 +479,6 @@ 'browser/command_observer.h', 'browser/command_updater.cc', 'browser/command_updater.h', - 'browser/common/url_database/template_url_id.h', - 'browser/common/url_database/url_database.cc', - 'browser/common/url_database/url_database.h', - 'browser/common/url_database/url_database_types.cc', - 'browser/common/url_database/url_database_types.h', 'browser/component_updater/component_updater_configurator.cc', 'browser/component_updater/component_updater_configurator.h', 'browser/component_updater/component_unpacker.cc', @@ -803,6 +798,8 @@ 'browser/history/top_sites_cache.h', 'browser/history/top_sites_database.cc', 'browser/history/top_sites_database.h', + 'browser/history/url_database.cc', + 'browser/history/url_database.h', 'browser/history/url_index_private_data.cc', 'browser/history/url_index_private_data.h', 'browser/history/visit_database.cc', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index c8e6338..edb3824 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -182,8 +182,8 @@ 'browser/ui/gtk/test/ui_test_utils_gtk.cc', 'browser/ui/panels/base_panel_browser_test.cc', 'browser/ui/panels/base_panel_browser_test.h', - 'browser/ui/panels/test_panel_notification_observer.cc', - 'browser/ui/panels/test_panel_notification_observer.h', + 'browser/ui/panels/test_panel_notification_observer.cc', + 'browser/ui/panels/test_panel_notification_observer.h', 'browser/ui/panels/test_panel_active_state_observer.cc', 'browser/ui/panels/test_panel_active_state_observer.h', 'browser/ui/panels/test_panel_mouse_watcher.cc', @@ -1190,7 +1190,6 @@ 'browser/chromeos/version_loader_unittest.cc', 'browser/chromeos/web_socket_proxy_helper_unittest.cc', 'browser/command_updater_unittest.cc', - 'browser/common/url_database/url_database_unittest.cc', 'browser/component_updater/test/component_installers_unittest.cc', 'browser/component_updater/test/component_updater_service_unittest.cc', 'browser/component_updater/component_updater_interceptor.cc', @@ -1361,6 +1360,7 @@ 'browser/history/thumbnail_database_unittest.cc', 'browser/history/top_sites_database_unittest.cc', 'browser/history/top_sites_unittest.cc', + 'browser/history/url_database_unittest.cc', 'browser/history/visit_database_unittest.cc', 'browser/history/visit_filter_unittest.cc', 'browser/history/visit_tracker_unittest.cc', |