summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-19 16:42:13 +0000
committermirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-19 16:42:13 +0000
commite57b0db08bc0f73d4f42f485ea1ed9070969c18f (patch)
tree10a3187bae462c9d2926c85e828303ce76f79f4b
parentd9c320a8f7ff01a475a831924797001f54443a85 (diff)
downloadchromium_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
-rw-r--r--chrome/browser/cocoa/import_progress_dialog.h2
-rw-r--r--chrome/browser/cocoa/import_settings_dialog.mm5
-rw-r--r--chrome/browser/extensions/extension_bookmarks_module.cc2
-rw-r--r--chrome/browser/first_run_mac.mm2
-rw-r--r--chrome/browser/first_run_win.cc2
-rw-r--r--chrome/browser/gtk/bookmark_bar_gtk.cc2
-rw-r--r--chrome/browser/gtk/first_run_dialog.cc2
-rw-r--r--chrome/browser/gtk/import_dialog_gtk.cc2
-rw-r--r--chrome/browser/gtk/import_progress_dialog_gtk.h2
-rw-r--r--chrome/browser/gtk/options/content_page_gtk.cc2
-rw-r--r--chrome/browser/history/history_types.cc22
-rw-r--r--chrome/browser/history/history_types.h152
-rw-r--r--chrome/browser/importer/firefox2_importer.h2
-rw-r--r--chrome/browser/importer/firefox3_importer.h2
-rw-r--r--chrome/browser/importer/ie_importer.cc2
-rw-r--r--chrome/browser/importer/importer.h2
-rw-r--r--chrome/browser/importer/importer_bridge.h2
-rw-r--r--chrome/browser/importer/importer_list.h5
-rw-r--r--chrome/browser/importer/importer_unittest.cc2
-rw-r--r--chrome/browser/importer/safari_importer.h2
-rw-r--r--chrome/browser/importer/toolbar_importer.h2
-rw-r--r--chrome/browser/views/bookmark_bar_view.cc2
-rw-r--r--chrome/browser/views/importer_view.cc2
-rw-r--r--chrome/browser/views/importing_progress_view.h2
-rw-r--r--chrome/browser/views/options/content_page_view.cc2
-rw-r--r--chrome/chrome_browser.gypi1
-rw-r--r--chrome/chrome_common.gypi3
-rw-r--r--chrome/common/importer_data_types.h (renamed from chrome/browser/importer/importer_data_types.h)6
-rw-r--r--chrome/common/url_row_type.cc31
-rw-r--r--chrome/common/url_row_type.h174
30 files changed, 240 insertions, 201 deletions
diff --git a/chrome/browser/cocoa/import_progress_dialog.h b/chrome/browser/cocoa/import_progress_dialog.h
index 41e401d..85c08c7 100644
--- a/chrome/browser/cocoa/import_progress_dialog.h
+++ b/chrome/browser/cocoa/import_progress_dialog.h
@@ -8,7 +8,7 @@
#import <Cocoa/Cocoa.h>
#include "chrome/browser/importer/importer.h"
-#include "chrome/browser/importer/importer_data_types.h"
+#include "chrome/common/importer_data_types.h"
class ImporterObserverBridge;
diff --git a/chrome/browser/cocoa/import_settings_dialog.mm b/chrome/browser/cocoa/import_settings_dialog.mm
index 09985c5..2020113 100644
--- a/chrome/browser/cocoa/import_settings_dialog.mm
+++ b/chrome/browser/cocoa/import_settings_dialog.mm
@@ -6,7 +6,7 @@
#include "base/mac_util.h"
#include "base/sys_string_conversions.h"
-#include "chrome/browser/importer/importer_data_types.h"
+#include "chrome/common/importer_data_types.h"
#include "chrome/browser/importer/importer_list.h"
#include "chrome/browser/profile.h"
@@ -121,7 +121,8 @@ bool importSettingsDialogVisible = false;
NSMutableArray* browserProfiles =
[NSMutableArray arrayWithCapacity:profilesCount];
for (int i = 0; i < profilesCount; ++i) {
- const importer::ProfileInfo& sourceProfile = importerList.GetSourceProfileInfoAt(i);
+ const importer::ProfileInfo& sourceProfile =
+ importerList.GetSourceProfileInfoAt(i);
NSString* browserName =
base::SysWideToNSString(sourceProfile.description);
uint16 browserServices = sourceProfile.services_supported;
diff --git a/chrome/browser/extensions/extension_bookmarks_module.cc b/chrome/browser/extensions/extension_bookmarks_module.cc
index 8361b82..b44209e 100644
--- a/chrome/browser/extensions/extension_bookmarks_module.cc
+++ b/chrome/browser/extensions/extension_bookmarks_module.cc
@@ -18,7 +18,7 @@
#include "chrome/browser/extensions/extension_message_service.h"
#include "chrome/browser/extensions/extensions_quota_service.h"
#include "chrome/browser/importer/importer.h"
-#include "chrome/browser/importer/importer_data_types.h"
+#include "chrome/common/importer_data_types.h"
#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/notification_service.h"
diff --git a/chrome/browser/first_run_mac.mm b/chrome/browser/first_run_mac.mm
index 16ef3e7..234de5e 100644
--- a/chrome/browser/first_run_mac.mm
+++ b/chrome/browser/first_run_mac.mm
@@ -10,7 +10,7 @@
#import "chrome/browser/cocoa/first_run_dialog.h"
#import "chrome/browser/cocoa/import_progress_dialog.h"
#include "chrome/browser/importer/importer.h"
-#include "chrome/browser/importer/importer_data_types.h"
+#include "chrome/common/importer_data_types.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/shell_integration.h"
#include "chrome/installer/util/google_update_constants.h"
diff --git a/chrome/browser/first_run_win.cc b/chrome/browser/first_run_win.cc
index f12a75b..4c14df7 100644
--- a/chrome/browser/first_run_win.cc
+++ b/chrome/browser/first_run_win.cc
@@ -37,7 +37,7 @@
#include "chrome/browser/extensions/extension_updater.h"
#include "chrome/browser/hang_monitor/hung_window_detector.h"
#include "chrome/browser/importer/importer.h"
-#include "chrome/browser/importer/importer_data_types.h"
+#include "chrome/common/importer_data_types.h"
#include "chrome/browser/pref_service.h"
#include "chrome/browser/process_singleton.h"
#include "chrome/browser/profile.h"
diff --git a/chrome/browser/gtk/bookmark_bar_gtk.cc b/chrome/browser/gtk/bookmark_bar_gtk.cc
index f8d9808..6257bf4 100644
--- a/chrome/browser/gtk/bookmark_bar_gtk.cc
+++ b/chrome/browser/gtk/bookmark_bar_gtk.cc
@@ -31,7 +31,7 @@
#include "chrome/browser/gtk/tabstrip_origin_provider.h"
#include "chrome/browser/gtk/tabs/tab_strip_gtk.h"
#include "chrome/browser/gtk/view_id_util.h"
-#include "chrome/browser/importer/importer_data_types.h"
+#include "chrome/common/importer_data_types.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/ntp_background_util.h"
#include "chrome/browser/pref_service.h"
diff --git a/chrome/browser/gtk/first_run_dialog.cc b/chrome/browser/gtk/first_run_dialog.cc
index ed4dfb9..a1d7dc2 100644
--- a/chrome/browser/gtk/first_run_dialog.cc
+++ b/chrome/browser/gtk/first_run_dialog.cc
@@ -10,7 +10,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/gtk/gtk_chrome_link_button.h"
#include "chrome/browser/gtk/gtk_util.h"
-#include "chrome/browser/importer/importer_data_types.h"
+#include "chrome/common/importer_data_types.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/process_singleton.h"
#include "chrome/browser/shell_integration.h"
diff --git a/chrome/browser/gtk/import_dialog_gtk.cc b/chrome/browser/gtk/import_dialog_gtk.cc
index 5af8aec..0cb30e9 100644
--- a/chrome/browser/gtk/import_dialog_gtk.cc
+++ b/chrome/browser/gtk/import_dialog_gtk.cc
@@ -11,7 +11,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/gtk/accessible_widget_helper_gtk.h"
#include "chrome/browser/gtk/gtk_util.h"
-#include "chrome/browser/importer/importer_data_types.h"
+#include "chrome/common/importer_data_types.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
diff --git a/chrome/browser/gtk/import_progress_dialog_gtk.h b/chrome/browser/gtk/import_progress_dialog_gtk.h
index a990ca7..7e3e310 100644
--- a/chrome/browser/gtk/import_progress_dialog_gtk.h
+++ b/chrome/browser/gtk/import_progress_dialog_gtk.h
@@ -8,7 +8,7 @@
#include <gtk/gtk.h>
#include "chrome/browser/importer/importer.h"
-#include "chrome/browser/importer/importer_data_types.h"
+#include "chrome/common/importer_data_types.h"
class Profile;
diff --git a/chrome/browser/gtk/options/content_page_gtk.cc b/chrome/browser/gtk/options/content_page_gtk.cc
index dcdf53b..2969086 100644
--- a/chrome/browser/gtk/options/content_page_gtk.cc
+++ b/chrome/browser/gtk/options/content_page_gtk.cc
@@ -21,7 +21,7 @@
#include "chrome/browser/gtk/options/customize_sync_window_gtk.h"
#include "chrome/browser/gtk/options/options_layout_gtk.h"
#include "chrome/browser/gtk/options/passwords_exceptions_window_gtk.h"
-#include "chrome/browser/importer/importer_data_types.h"
+#include "chrome/common/importer_data_types.h"
#include "chrome/browser/pref_service.h"
#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/common/chrome_switches.h"
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,
diff --git a/chrome/browser/importer/firefox2_importer.h b/chrome/browser/importer/firefox2_importer.h
index 09a80d7..1eebd4a 100644
--- a/chrome/browser/importer/firefox2_importer.h
+++ b/chrome/browser/importer/firefox2_importer.h
@@ -9,7 +9,7 @@
#include "base/file_path.h"
#include "chrome/browser/importer/importer.h"
-#include "chrome/browser/importer/importer_data_types.h"
+#include "chrome/common/importer_data_types.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
class TemplateURL;
diff --git a/chrome/browser/importer/firefox3_importer.h b/chrome/browser/importer/firefox3_importer.h
index f8bfa2f..bf921b7 100644
--- a/chrome/browser/importer/firefox3_importer.h
+++ b/chrome/browser/importer/firefox3_importer.h
@@ -13,7 +13,7 @@
#include "base/basictypes.h"
#include "base/file_path.h"
#include "chrome/browser/importer/importer.h"
-#include "chrome/browser/importer/importer_data_types.h"
+#include "chrome/common/importer_data_types.h"
#include "googleurl/src/gurl.h"
struct sqlite3;
diff --git a/chrome/browser/importer/ie_importer.cc b/chrome/browser/importer/ie_importer.cc
index cae26ba..1cc3dc0 100644
--- a/chrome/browser/importer/ie_importer.cc
+++ b/chrome/browser/importer/ie_importer.cc
@@ -26,7 +26,7 @@
#include "base/win_util.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/importer/importer_bridge.h"
-#include "chrome/browser/importer/importer_data_types.h"
+#include "chrome/common/importer_data_types.h"
#include "chrome/browser/password_manager/ie7_password.h"
#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/common/time_format.h"
diff --git a/chrome/browser/importer/importer.h b/chrome/browser/importer/importer.h
index d0ea428..50b7a4d 100644
--- a/chrome/browser/importer/importer.h
+++ b/chrome/browser/importer/importer.h
@@ -15,7 +15,7 @@
#include "base/scoped_ptr.h"
#include "base/time.h"
#include "chrome/browser/bookmarks/bookmark_model_observer.h"
-#include "chrome/browser/importer/importer_data_types.h"
+#include "chrome/common/importer_data_types.h"
#include "chrome/browser/importer/importer_list.h"
#include "chrome/browser/importer/profile_writer.h"
#include "chrome/common/notification_registrar.h"
diff --git a/chrome/browser/importer/importer_bridge.h b/chrome/browser/importer/importer_bridge.h
index 14025e6..8f90e61 100644
--- a/chrome/browser/importer/importer_bridge.h
+++ b/chrome/browser/importer/importer_bridge.h
@@ -13,7 +13,7 @@
#include "base/string16.h"
#include "chrome/browser/importer/importer.h"
-#include "chrome/browser/importer/importer_data_types.h"
+#include "chrome/common/importer_data_types.h"
// TODO: remove this, see friend declaration in ImporterBridge.
#include "chrome/browser/importer/toolbar_importer.h"
diff --git a/chrome/browser/importer/importer_list.h b/chrome/browser/importer/importer_list.h
index 156e12e..3557043 100644
--- a/chrome/browser/importer/importer_list.h
+++ b/chrome/browser/importer/importer_list.h
@@ -10,7 +10,7 @@
#include "build/build_config.h"
#include "base/basictypes.h"
-#include "chrome/browser/importer/importer_data_types.h"
+#include "chrome/common/importer_data_types.h"
class Importer;
@@ -38,7 +38,8 @@ class ImporterList {
const importer::ProfileInfo& GetSourceProfileInfoAt(int index) const;
// Returns the ProfileInfo with the given browser type.
- const importer::ProfileInfo& GetSourceProfileInfoForBrowserType(int browser_type) const;
+ const importer::ProfileInfo& GetSourceProfileInfoForBrowserType(
+ int browser_type) const;
// Helper methods for detecting available profiles.
#if defined(OS_WIN)
diff --git a/chrome/browser/importer/importer_unittest.cc b/chrome/browser/importer/importer_unittest.cc
index eac9bed..eaa4dc6 100644
--- a/chrome/browser/importer/importer_unittest.cc
+++ b/chrome/browser/importer/importer_unittest.cc
@@ -23,7 +23,7 @@
#include "chrome/browser/importer/ie_importer.h"
#include "chrome/browser/importer/importer.h"
#include "chrome/browser/importer/importer_bridge.h"
-#include "chrome/browser/importer/importer_data_types.h"
+#include "chrome/common/importer_data_types.h"
#include "chrome/browser/password_manager/ie7_password.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/search_engines/template_url.h"
diff --git a/chrome/browser/importer/safari_importer.h b/chrome/browser/importer/safari_importer.h
index c15ca30..5465efd 100644
--- a/chrome/browser/importer/safari_importer.h
+++ b/chrome/browser/importer/safari_importer.h
@@ -13,7 +13,7 @@
#include "base/file_path.h"
#include "chrome/common/sqlite_utils.h"
-#include "chrome/browser/importer/importer_data_types.h"
+#include "chrome/common/importer_data_types.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
#if __OBJC__
diff --git a/chrome/browser/importer/toolbar_importer.h b/chrome/browser/importer/toolbar_importer.h
index 23f4291..0e13118 100644
--- a/chrome/browser/importer/toolbar_importer.h
+++ b/chrome/browser/importer/toolbar_importer.h
@@ -12,7 +12,7 @@
#include <vector>
#include "chrome/browser/importer/importer.h"
-#include "chrome/browser/importer/importer_data_types.h"
+#include "chrome/common/importer_data_types.h"
#include "chrome/common/net/url_fetcher.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc
index 108aba0..0aeb940 100644
--- a/chrome/browser/views/bookmark_bar_view.cc
+++ b/chrome/browser/views/bookmark_bar_view.cc
@@ -19,7 +19,7 @@
#include "chrome/browser/bookmarks/bookmark_utils.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_theme_provider.h"
-#include "chrome/browser/importer/importer_data_types.h"
+#include "chrome/common/importer_data_types.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
diff --git a/chrome/browser/views/importer_view.cc b/chrome/browser/views/importer_view.cc
index 151badf..ec13c39 100644
--- a/chrome/browser/views/importer_view.cc
+++ b/chrome/browser/views/importer_view.cc
@@ -7,7 +7,7 @@
#include "app/l10n_util.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_window.h"
-#include "chrome/browser/importer/importer_data_types.h"
+#include "chrome/common/importer_data_types.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
#include "views/controls/button/checkbox.h"
diff --git a/chrome/browser/views/importing_progress_view.h b/chrome/browser/views/importing_progress_view.h
index 71fdc74..d8a50b3 100644
--- a/chrome/browser/views/importing_progress_view.h
+++ b/chrome/browser/views/importing_progress_view.h
@@ -6,7 +6,7 @@
#define CHROME_BROWSER_VIEWS_IMPORTING_PROGRESS_VIEW_H_
#include "chrome/browser/importer/importer.h"
-#include "chrome/browser/importer/importer_data_types.h"
+#include "chrome/common/importer_data_types.h"
#include "views/view.h"
#include "views/window/dialog_delegate.h"
#include "views/window/window.h"
diff --git a/chrome/browser/views/options/content_page_view.cc b/chrome/browser/views/options/content_page_view.cc
index 5a84125..0e6b062 100644
--- a/chrome/browser/views/options/content_page_view.cc
+++ b/chrome/browser/views/options/content_page_view.cc
@@ -19,7 +19,7 @@
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_window.h"
-#include "chrome/browser/importer/importer_data_types.h"
+#include "chrome/common/importer_data_types.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/browser/views/importer_view.h"
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 5131867..2c75d38 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -1530,7 +1530,6 @@
'browser/importer/importer.h',
'browser/importer/importer_bridge.cc',
'browser/importer/importer_bridge.h',
- 'browser/importer/importer_data_types.h',
'browser/importer/importer_list.cc',
'browser/importer/importer_list.h',
'browser/importer/mork_reader.cc',
diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi
index 389f2a3..3fa6fe1 100644
--- a/chrome/chrome_common.gypi
+++ b/chrome/chrome_common.gypi
@@ -51,6 +51,7 @@
'common/geoposition.h',
'common/gpu_messages.h',
'common/gpu_messages_internal.h',
+ 'common/importer_data_types.h',
'common/logging_chrome.cc',
'common/logging_chrome.h',
'common/main_function_params.h',
@@ -91,6 +92,8 @@
'common/time_format.cc',
'common/time_format.h',
'common/transport_dib.h',
+ 'common/url_row_type.cc',
+ 'common/url_row_type.h',
'common/win_safe_util.cc',
'common/win_safe_util.h',
],
diff --git a/chrome/browser/importer/importer_data_types.h b/chrome/common/importer_data_types.h
index 444cc45..12ba3db 100644
--- a/chrome/browser/importer/importer_data_types.h
+++ b/chrome/common/importer_data_types.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_IMPORTER_IMPORTER_DATA_TYPES_H_
-#define CHROME_BROWSER_IMPORTER_IMPORTER_DATA_TYPES_H_
+#ifndef CHROME_COMMON_IMPORTER_DATA_TYPES_H_
+#define CHROME_COMMON_IMPORTER_DATA_TYPES_H_
#include <string>
@@ -54,5 +54,5 @@ struct ProfileInfo {
} // namespace importer
-#endif // CHROME_BROWSER_IMPORTER_IMPORTER_DATA_TYPES_H_
+#endif // CHROME_COMMON_IMPORTER_DATA_TYPES_H_
diff --git a/chrome/common/url_row_type.cc b/chrome/common/url_row_type.cc
new file mode 100644
index 0000000..ab04a7a
--- /dev/null
+++ b/chrome/common/url_row_type.cc
@@ -0,0 +1,31 @@
+// 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.
+
+#include "url_row_type.h"
+
+using base::Time;
+
+namespace history {
+
+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;
+}
+
+} // namespace history
diff --git a/chrome/common/url_row_type.h b/chrome/common/url_row_type.h
new file mode 100644
index 0000000..6ec004c
--- /dev/null
+++ b/chrome/common/url_row_type.h
@@ -0,0 +1,174 @@
+// 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.
+
+#ifndef CHROME_COMMON_URL_ROW_TYPE_H_
+#define CHROME_COMMON_URL_ROW_TYPE_H_
+
+#include <set>
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/time.h"
+#include "googleurl/src/gurl.h"
+
+// This file includes the URLRow class and ImportedFavIconUsage struct, which
+// need to be in the common directory because they're accessed by the importer
+// process as well as the browser process.
+
+namespace history {
+
+// URLRow ---------------------------------------------------------------------
+
+typedef int64 URLID;
+typedef int64 FavIconID; // For FavIcons.
+
+// 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=.
+};
+
+// 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;
+};
+
+} // namespace history
+
+#endif // CHROME_COMMON_URL_ROW_TYPE_H_
+
+