diff options
author | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-19 16:42:13 +0000 |
---|---|---|
committer | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-19 16:42:13 +0000 |
commit | e57b0db08bc0f73d4f42f485ea1ed9070969c18f (patch) | |
tree | 10a3187bae462c9d2926c85e828303ce76f79f4b /chrome/browser/history | |
parent | d9c320a8f7ff01a475a831924797001f54443a85 (diff) | |
download | chromium_src-e57b0db08bc0f73d4f42f485ea1ed9070969c18f.zip chromium_src-e57b0db08bc0f73d4f42f485ea1ed9070969c18f.tar.gz chromium_src-e57b0db08bc0f73d4f42f485ea1ed9070969c18f.tar.bz2 |
Move data types used in the importer process to common/, in preparation for import to run out of process.
BUG= 18774
TEST= none.
Review URL: http://codereview.chromium.org/2106015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47675 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/history')
-rw-r--r-- | chrome/browser/history/history_types.cc | 22 | ||||
-rw-r--r-- | chrome/browser/history/history_types.h | 152 |
2 files changed, 2 insertions, 172 deletions
diff --git a/chrome/browser/history/history_types.cc b/chrome/browser/history/history_types.cc index aadd0af..887abdb 100644 --- a/chrome/browser/history/history_types.cc +++ b/chrome/browser/history/history_types.cc @@ -12,28 +12,6 @@ using base::Time; namespace history { -// URLRow ---------------------------------------------------------------------- - -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_); - std::swap(favicon_id_, other->favicon_id_); -} - -void URLRow::Initialize() { - id_ = 0; - visit_count_ = false; - typed_count_ = false; - last_visit_ = Time(); - hidden_ = false; - favicon_id_ = 0; -} - // VisitRow -------------------------------------------------------------------- VisitRow::VisitRow() diff --git a/chrome/browser/history/history_types.h b/chrome/browser/history/history_types.h index c3fb5c6..45c4c20 100644 --- a/chrome/browser/history/history_types.h +++ b/chrome/browser/history/history_types.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -16,6 +16,7 @@ #include "chrome/browser/history/snippet.h" #include "chrome/common/page_transition_types.h" #include "chrome/common/ref_counted_util.h" +#include "chrome/common/url_row_type.h" #include "googleurl/src/gurl.h" namespace history { @@ -34,143 +35,8 @@ typedef std::vector<GURL> RedirectList; typedef int64 StarID; // Unique identifier for star entries. typedef int64 UIStarID; // Identifier for star entries that come from the UI. typedef int64 DownloadID; // Identifier for a download. -typedef int64 FavIconID; // For FavIcons. typedef int64 SegmentID; // URL segments for the most visited view. -// 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() { - Initialize(); - } - - explicit URLRow(const GURL& url) : url_(url) { - // Initialize will not set the URL, so our initialization above will stay. - Initialize(); - } - - // 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) : 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; - } - - virtual ~URLRow() {} - - URLID id() const { return id_; } - const GURL& url() const { return url_; } - - const std::wstring& title() const { - return title_; - } - void set_title(const std::wstring& 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; - } - } - - 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. - 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; - } - - // ID of the favicon. A value of 0 means the favicon isn't known yet. - FavIconID favicon_id() const { return favicon_id_; } - void set_favicon_id(FavIconID favicon_id) { - favicon_id_ = favicon_id; - } - - // Swaps the contents of this URLRow with another, which allows it to be - // destructively copied without memory allocations. - // (Virtual because it's overridden by URLResult.) - virtual 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. Immutable except for the database which sets it - // when it pulls them out. - 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_; - - std::wstring 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_; - - // The ID of the favicon for this url. - FavIconID favicon_id_; - - // We support the implicit copy constuctor and operator=. -}; - // VisitRow ------------------------------------------------------------------- typedef int64 VisitID; @@ -223,20 +89,6 @@ class VisitRow { // We pass around vectors of visits a lot typedef std::vector<VisitRow> VisitVector; -// Favicons ------------------------------------------------------------------- - -// Used by the importer to set favicons for imported bookmarks. -struct ImportedFavIconUsage { - // The URL of the favicon. - GURL favicon_url; - - // The raw png-encoded data. - std::vector<unsigned char> png_data; - - // The list of URLs using this favicon. - std::set<GURL> urls; -}; - // PageVisit ------------------------------------------------------------------ // Represents a simplified version of a visit for external users. Normally, |