summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-22 16:42:07 +0000
committermirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-22 16:42:07 +0000
commit80a9966966b76bba436398ca529f9e4d509d5aab (patch)
tree11aec759e5dde6a0ae4b9262c557c90205e27690
parenta37bd9baafb3ccc1532b77db9df922d35a10e2f3 (diff)
downloadchromium_src-80a9966966b76bba436398ca529f9e4d509d5aab.zip
chromium_src-80a9966966b76bba436398ca529f9e4d509d5aab.tar.gz
chromium_src-80a9966966b76bba436398ca529f9e4d509d5aab.tar.bz2
Move importer data types into a separate file to prepare for moving importer
into its own process. BUG= 18774 TEST= none Review URL: http://codereview.chromium.org/1110005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42224 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/cocoa/import_progress_dialog.h11
-rw-r--r--chrome/browser/cocoa/import_progress_dialog.mm30
-rw-r--r--chrome/browser/cocoa/import_settings_dialog.mm25
-rw-r--r--chrome/browser/cocoa/import_settings_dialog_unittest.mm12
-rw-r--r--chrome/browser/extensions/extension_bookmark_manager_api.cc7
-rw-r--r--chrome/browser/first_run_mac.mm7
-rw-r--r--chrome/browser/first_run_win.cc13
-rw-r--r--chrome/browser/gtk/bookmark_bar_gtk.cc6
-rw-r--r--chrome/browser/gtk/bookmark_manager_gtk.cc7
-rw-r--r--chrome/browser/gtk/first_run_dialog.cc6
-rw-r--r--chrome/browser/gtk/import_dialog_gtk.cc19
-rw-r--r--chrome/browser/gtk/import_progress_dialog_gtk.cc12
-rw-r--r--chrome/browser/gtk/import_progress_dialog_gtk.h7
-rw-r--r--chrome/browser/gtk/options/content_page_gtk.cc3
-rw-r--r--chrome/browser/importer/firefox2_importer.cc9
-rw-r--r--chrome/browser/importer/firefox2_importer.h5
-rw-r--r--chrome/browser/importer/firefox3_importer.cc9
-rw-r--r--chrome/browser/importer/firefox3_importer.h5
-rw-r--r--chrome/browser/importer/ie_importer.cc27
-rw-r--r--chrome/browser/importer/importer.cc29
-rw-r--r--chrome/browser/importer/importer.h30
-rw-r--r--chrome/browser/importer/importer_bridge.cc6
-rw-r--r--chrome/browser/importer/importer_bridge.h11
-rw-r--r--chrome/browser/importer/importer_data_types.h57
-rw-r--r--chrome/browser/importer/importer_list.cc53
-rw-r--r--chrome/browser/importer/importer_list.h29
-rw-r--r--chrome/browser/importer/importer_unittest.cc12
-rw-r--r--chrome/browser/importer/safari_importer.h5
-rw-r--r--chrome/browser/importer/safari_importer.mm8
-rw-r--r--chrome/browser/importer/safari_importer_unittest.mm10
-rw-r--r--chrome/browser/importer/toolbar_importer.cc9
-rw-r--r--chrome/browser/importer/toolbar_importer.h5
-rw-r--r--chrome/browser/views/bookmark_bar_view.cc3
-rw-r--r--chrome/browser/views/bookmark_manager_view.cc7
-rw-r--r--chrome/browser/views/first_run_view_base.cc19
-rw-r--r--chrome/browser/views/importer_view.cc38
-rw-r--r--chrome/browser/views/importing_progress_view.cc38
-rw-r--r--chrome/browser/views/importing_progress_view.h7
-rw-r--r--chrome/browser/views/options/content_page_view.cc3
-rwxr-xr-xchrome/chrome_browser.gypi1
40 files changed, 359 insertions, 241 deletions
diff --git a/chrome/browser/cocoa/import_progress_dialog.h b/chrome/browser/cocoa/import_progress_dialog.h
index 0ff9dab..41e401d 100644
--- a/chrome/browser/cocoa/import_progress_dialog.h
+++ b/chrome/browser/cocoa/import_progress_dialog.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.
@@ -8,6 +8,7 @@
#import <Cocoa/Cocoa.h>
#include "chrome/browser/importer/importer.h"
+#include "chrome/browser/importer/importer_data_types.h"
class ImporterObserverBridge;
@@ -47,8 +48,8 @@ class ImporterObserverBridge;
- (void)closeDialog;
// Methods called by importer_host via ImporterObserverBridge.
-- (void)ImportItemStarted:(ImportItem)item;
-- (void)ImportItemEnded:(ImportItem)item;
+- (void)ImportItemStarted:(importer::ImportItem)item;
+- (void)ImportItemEnded:(importer::ImportItem)item;
- (void)ImportStarted;
- (void)ImportEnded;
@@ -73,13 +74,13 @@ class ImporterObserverBridge : public ImporterHost::Observer {
virtual ~ImporterObserverBridge() {}
// Invoked when data for the specified item is about to be collected.
- virtual void ImportItemStarted(ImportItem item) {
+ virtual void ImportItemStarted(importer::ImportItem item) {
[owner_ ImportItemStarted:item];
}
// Invoked when data for the specified item has been collected from the
// source profile and is now ready for further processing.
- virtual void ImportItemEnded(ImportItem item) {
+ virtual void ImportItemEnded(importer::ImportItem item) {
[owner_ ImportItemEnded:item];
}
diff --git a/chrome/browser/cocoa/import_progress_dialog.mm b/chrome/browser/cocoa/import_progress_dialog.mm
index 65d91e3..765e4d1 100644
--- a/chrome/browser/cocoa/import_progress_dialog.mm
+++ b/chrome/browser/cocoa/import_progress_dialog.mm
@@ -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.
@@ -19,15 +19,15 @@ namespace {
// Convert ImportItem enum into the name of the ImportProgressDialogController
// property corresponding to the text for that item, this makes the code to
// change the values for said properties much more readable.
-NSString* keyForImportItem(ImportItem item) {
+NSString* keyForImportItem(importer::ImportItem item) {
switch(item) {
- case HISTORY:
+ case importer::HISTORY:
return @"historyStatusText";
- case FAVORITES:
+ case importer::FAVORITES:
return @"favoritesStatusText";
- case PASSWORDS:
+ case importer::PASSWORDS:
return @"savedPasswordStatusText";
- case SEARCH_ENGINES:
+ case importer::SEARCH_ENGINES:
return @"searchStatusText";
default:
DCHECK(false);
@@ -82,10 +82,14 @@ NSString* keyForImportItem(ImportItem item) {
// Enable/disable item titles.
NSColor* disabled = [NSColor disabledControlTextColor];
NSColor* active = [NSColor textColor];
- [self setFavoritesImportEnabled:items & FAVORITES ? active : disabled];
- [self setSearchImportEnabled:items & SEARCH_ENGINES ? active : disabled];
- [self setPasswordImportEnabled:items & PASSWORDS ? active : disabled];
- [self setHistoryImportEnabled:items & HISTORY ? active : disabled];
+ [self setFavoritesImportEnabled:items & importer::FAVORITES ? active :
+ disabled];
+ [self setSearchImportEnabled:items & importer::SEARCH_ENGINES ? active :
+ disabled];
+ [self setPasswordImportEnabled:items & importer::PASSWORDS ? active :
+ disabled];
+ [self setHistoryImportEnabled:items & importer::HISTORY ? active :
+ disabled];
}
return self;
}
@@ -129,11 +133,11 @@ NSString* keyForImportItem(ImportItem item) {
[self release];
}
}
-- (void)ImportItemStarted:(ImportItem)item {
+- (void)ImportItemStarted:(importer::ImportItem)item {
[self setValue:progress_text_ forKey:keyForImportItem(item)];
}
-- (void)ImportItemEnded:(ImportItem)item {
+- (void)ImportItemEnded:(importer::ImportItem)item {
[self setValue:done_text_ forKey:keyForImportItem(item)];
}
@@ -158,7 +162,7 @@ NSString* keyForImportItem(ImportItem item) {
void StartImportingWithUI(gfx::NativeWindow parent_window,
int16 items,
ImporterHost* coordinator,
- const ProfileInfo& source_profile,
+ const importer::ProfileInfo& source_profile,
Profile* target_profile,
ImportObserver* observer,
bool first_run) {
diff --git a/chrome/browser/cocoa/import_settings_dialog.mm b/chrome/browser/cocoa/import_settings_dialog.mm
index 454e8cc..09985c5 100644
--- a/chrome/browser/cocoa/import_settings_dialog.mm
+++ b/chrome/browser/cocoa/import_settings_dialog.mm
@@ -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.
@@ -6,6 +6,7 @@
#include "base/mac_util.h"
#include "base/sys_string_conversions.h"
+#include "chrome/browser/importer/importer_data_types.h"
#include "chrome/browser/importer/importer_list.h"
#include "chrome/browser/profile.h"
@@ -120,7 +121,7 @@ bool importSettingsDialogVisible = false;
NSMutableArray* browserProfiles =
[NSMutableArray arrayWithCapacity:profilesCount];
for (int i = 0; i < profilesCount; ++i) {
- const ProfileInfo& sourceProfile = importerList.GetSourceProfileInfoAt(i);
+ const importer::ProfileInfo& sourceProfile = importerList.GetSourceProfileInfoAt(i);
NSString* browserName =
base::SysWideToNSString(sourceProfile.description);
uint16 browserServices = sourceProfile.services_supported;
@@ -169,7 +170,7 @@ bool importSettingsDialogVisible = false;
- (IBAction)ok:(id)sender {
[self closeDialog];
- const ProfileInfo& sourceProfile =
+ const importer::ProfileInfo& sourceProfile =
importerList_.get()->GetSourceProfileInfoAt([self sourceBrowserIndex]);
uint16 items = sourceProfile.services_supported;
// ProfileInfo.services_supported is a uint16 while the call to
@@ -213,22 +214,24 @@ bool importSettingsDialogVisible = false;
ImportSettingsProfile* profile =
[sourceBrowsersList_.get() objectAtIndex:browserIndex];
uint16 items = [profile services];
- [self setHistoryAvailable:(items & HISTORY) ? YES : NO];
+ [self setHistoryAvailable:(items & importer::HISTORY) ? YES : NO];
[self setImportHistory:[self historyAvailable]];
- [self setFavoritesAvailable:(items & FAVORITES) ? YES : NO];
+ [self setFavoritesAvailable:(items & importer::FAVORITES) ? YES : NO];
[self setImportFavorites:[self favoritesAvailable]];
- [self setPasswordsAvailable:(items & PASSWORDS) ? YES : NO];
+ [self setPasswordsAvailable:(items & importer::PASSWORDS) ? YES : NO];
[self setImportPasswords:[self passwordsAvailable]];
- [self setSearchEnginesAvailable:(items & SEARCH_ENGINES) ? YES : NO];
+ [self setSearchEnginesAvailable:(items & importer::SEARCH_ENGINES) ?
+ YES : NO];
[self setImportSearchEngines:[self searchEnginesAvailable]];
}
- (uint16)servicesToImport {
uint16 servicesToImport = 0;
- if ([self importHistory]) servicesToImport |= HISTORY;
- if ([self importFavorites]) servicesToImport |= FAVORITES;
- if ([self importPasswords]) servicesToImport |= PASSWORDS;
- if ([self importSearchEngines]) servicesToImport |= SEARCH_ENGINES;
+ if ([self importHistory]) servicesToImport |= importer::HISTORY;
+ if ([self importFavorites]) servicesToImport |= importer::FAVORITES;
+ if ([self importPasswords]) servicesToImport |= importer::PASSWORDS;
+ if ([self importSearchEngines]) servicesToImport |=
+ importer::SEARCH_ENGINES;
return servicesToImport;
}
diff --git a/chrome/browser/cocoa/import_settings_dialog_unittest.mm b/chrome/browser/cocoa/import_settings_dialog_unittest.mm
index 6c55498..f75a79a 100644
--- a/chrome/browser/cocoa/import_settings_dialog_unittest.mm
+++ b/chrome/browser/cocoa/import_settings_dialog_unittest.mm
@@ -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.
@@ -12,6 +12,13 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
+using importer::HISTORY;
+using importer::FAVORITES;
+using importer::COOKIES;
+using importer::PASSWORDS;
+using importer::SEARCH_ENGINES;
+using importer::NONE;
+
class ImportSettingsDialogTest : public CocoaTest {
public:
ImportSettingsDialogController* controller_;
@@ -86,8 +93,7 @@ TEST_F(ImportSettingsDialogTest, ChooseVariousBrowsers) {
EXPECT_TRUE([controller_ passwordsAvailable]);
EXPECT_FALSE([controller_ importSearchEngines]);
EXPECT_FALSE([controller_ searchEnginesAvailable]);
- EXPECT_EQ(HISTORY | FAVORITES | PASSWORDS,
- [controller_ servicesToImport]);
+ EXPECT_EQ(HISTORY | FAVORITES | PASSWORDS, [controller_ servicesToImport]);
[controller_ cancel:nil];
}
diff --git a/chrome/browser/extensions/extension_bookmark_manager_api.cc b/chrome/browser/extensions/extension_bookmark_manager_api.cc
index 5c589ba..c480766 100644
--- a/chrome/browser/extensions/extension_bookmark_manager_api.cc
+++ b/chrome/browser/extensions/extension_bookmark_manager_api.cc
@@ -19,6 +19,7 @@
#include "chrome/browser/extensions/extension_dom_ui.h"
#include "chrome/browser/extensions/extension_message_service.h"
#include "chrome/browser/importer/importer.h"
+#include "chrome/browser/importer/importer_data_types.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "grit/generated_resources.h"
@@ -287,12 +288,12 @@ void ImportBookmarksFunction::FileSelected(const FilePath& path,
int index,
void* params) {
ImporterHost* host = new ImporterHost();
- ProfileInfo profile_info;
- profile_info.browser_type = BOOKMARKS_HTML;
+ importer::ProfileInfo profile_info;
+ profile_info.browser_type = importer::BOOKMARKS_HTML;
profile_info.source_path = path.ToWStringHack();
host->StartImportSettings(profile_info,
profile(),
- FAVORITES,
+ importer::FAVORITES,
new ProfileWriter(profile()),
true);
Release(); // Balanced in BookmarkManagerIOFunction::SelectFile()
diff --git a/chrome/browser/first_run_mac.mm b/chrome/browser/first_run_mac.mm
index 41642af..687838e 100644
--- a/chrome/browser/first_run_mac.mm
+++ b/chrome/browser/first_run_mac.mm
@@ -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.
@@ -10,6 +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/browser/metrics/user_metrics.h"
#include "chrome/browser/shell_integration.h"
#include "chrome/installer/util/google_update_constants.h"
@@ -136,8 +137,8 @@ bool FirstRunController::DoFirstRun(Profile* profile,
// Import bookmarks.
if (!browser_import_disabled && [dialog.get() importBookmarks]) {
- const ProfileInfo& source_profile = importer_host_->GetSourceProfileInfoAt(
- [dialog.get() browserImportSelectedIndex]);
+ const importer::ProfileInfo& source_profile = importer_host_->
+ GetSourceProfileInfoAt([dialog.get() browserImportSelectedIndex]);
int16 items = source_profile.services_supported;
// TODO(port): Do the actual import in a new process like Windows.
gc.release();
diff --git a/chrome/browser/first_run_win.cc b/chrome/browser/first_run_win.cc
index 2f3eda7..e3a3b52 100644
--- a/chrome/browser/first_run_win.cc
+++ b/chrome/browser/first_run_win.cc
@@ -36,6 +36,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/browser/pref_service.h"
#include "chrome/browser/process_singleton.h"
#include "chrome/browser/profile.h"
@@ -312,10 +313,10 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir,
if (installer_util::GetDistroBooleanPreference(prefs.get(),
installer_util::master_preferences::kDistroImportSearchPref, &value)) {
if (value) {
- import_items += SEARCH_ENGINES;
- out_prefs->do_import_items += SEARCH_ENGINES;
+ import_items += importer::SEARCH_ENGINES;
+ out_prefs->do_import_items += importer::SEARCH_ENGINES;
} else {
- out_prefs->dont_import_items += SEARCH_ENGINES;
+ out_prefs->dont_import_items += importer::SEARCH_ENGINES;
}
}
@@ -344,15 +345,15 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir,
if (installer_util::GetDistroBooleanPreference(prefs.get(),
installer_util::master_preferences::kDistroImportHistoryPref, &value) &&
value)
- import_items += HISTORY;
+ import_items += importer::HISTORY;
if (installer_util::GetDistroBooleanPreference(prefs.get(),
installer_util::master_preferences::kDistroImportBookmarksPref, &value) &&
value)
- import_items += FAVORITES;
+ import_items += importer::FAVORITES;
if (installer_util::GetDistroBooleanPreference(prefs.get(),
installer_util::master_preferences::kDistroImportHomePagePref, &value) &&
value)
- import_items += HOME_PAGE;
+ import_items += importer::HOME_PAGE;
if (import_items) {
// There is something to import from the default browser. This launches
diff --git a/chrome/browser/gtk/bookmark_bar_gtk.cc b/chrome/browser/gtk/bookmark_bar_gtk.cc
index 4618085..c42b5a7 100644
--- a/chrome/browser/gtk/bookmark_bar_gtk.cc
+++ b/chrome/browser/gtk/bookmark_bar_gtk.cc
@@ -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.
@@ -32,6 +32,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/browser/metrics/user_metrics.h"
#include "chrome/browser/ntp_background_util.h"
#include "chrome/browser/pref_service.h"
@@ -365,7 +366,8 @@ void BookmarkBarGtk::OnStateChanged() {
}
void BookmarkBarGtk::ShowImportDialog() {
- ImportDialogGtk::Show(window_->window(), browser_->profile(), FAVORITES);
+ ImportDialogGtk::Show(window_->window(), browser_->profile(),
+ importer::FAVORITES);
}
void BookmarkBarGtk::EnterFullscreen() {
diff --git a/chrome/browser/gtk/bookmark_manager_gtk.cc b/chrome/browser/gtk/bookmark_manager_gtk.cc
index bfa168b..86fea68 100644
--- a/chrome/browser/gtk/bookmark_manager_gtk.cc
+++ b/chrome/browser/gtk/bookmark_manager_gtk.cc
@@ -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.
@@ -24,6 +24,7 @@
#include "chrome/browser/gtk/gtk_util.h"
#include "chrome/browser/gtk/menu_gtk.h"
#include "chrome/browser/importer/importer.h"
+#include "chrome/browser/importer/importer_data_types.h"
#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/sync/sync_ui_util.h"
@@ -1454,9 +1455,9 @@ void BookmarkManagerGtk::FileSelected(const FilePath& path,
// ImporterHost is ref counted and will delete itself when done.
ImporterHost* host = new ImporterHost();
ProfileInfo profile_info;
- profile_info.browser_type = BOOKMARKS_HTML;
+ profile_info.browser_type = importer::BOOKMARKS_HTML;
profile_info.source_path = path.ToWStringHack();
- StartImportingWithUI(GTK_WINDOW(window_), FAVORITES, host,
+ StartImportingWithUI(GTK_WINDOW(window_), importer::FAVORITES, host,
profile_info, profile_,
new ImportObserverImpl(profile()), false);
} else if (id == IDS_BOOKMARK_MANAGER_EXPORT_MENU) {
diff --git a/chrome/browser/gtk/first_run_dialog.cc b/chrome/browser/gtk/first_run_dialog.cc
index 93f2861..6613957 100644
--- a/chrome/browser/gtk/first_run_dialog.cc
+++ b/chrome/browser/gtk/first_run_dialog.cc
@@ -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.
@@ -10,6 +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/browser/process_singleton.h"
#include "chrome/browser/shell_integration.h"
#include "chrome/common/platform_util.h"
@@ -169,7 +170,8 @@ void FirstRunDialog::OnDialogResponse(GtkWidget* widget, int response) {
const ProfileInfo& source_profile =
importer_host_->GetSourceProfileInfoAt(
gtk_combo_box_get_active(GTK_COMBO_BOX(import_profile_)));
- int items = SEARCH_ENGINES + HISTORY + FAVORITES + HOME_PAGE + PASSWORDS;
+ int items = importer::SEARCH_ENGINES + importer::HISTORY +
+ importer::FAVORITES + importer::HOME_PAGE + importer::PASSWORDS;
// TODO(port): Should we do the actual import in a new process like
// Windows?
StartImportingWithUI(GTK_WINDOW(dialog_), items, importer_host_.get(),
diff --git a/chrome/browser/gtk/import_dialog_gtk.cc b/chrome/browser/gtk/import_dialog_gtk.cc
index 1d1c4dc..c4c3804 100644
--- a/chrome/browser/gtk/import_dialog_gtk.cc
+++ b/chrome/browser/gtk/import_dialog_gtk.cc
@@ -11,6 +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 "grit/generated_resources.h"
#include "grit/locale_settings.h"
@@ -91,25 +92,25 @@ ImportDialogGtk::ImportDialogGtk(GtkWindow* parent, Profile* profile,
l10n_util::GetStringUTF8(IDS_IMPORT_FAVORITES_CHKBOX).c_str());
gtk_box_pack_start(GTK_BOX(vbox), bookmarks_, FALSE, FALSE, 0);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(bookmarks_),
- (initial_state_ & FAVORITES) != 0);
+ (initial_state_ & importer::FAVORITES) != 0);
search_engines_ = gtk_check_button_new_with_label(
l10n_util::GetStringUTF8(IDS_IMPORT_SEARCH_ENGINES_CHKBOX).c_str());
gtk_box_pack_start(GTK_BOX(vbox), search_engines_, FALSE, FALSE, 0);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(search_engines_),
- (initial_state_ & SEARCH_ENGINES) != 0);
+ (initial_state_ & importer::SEARCH_ENGINES) != 0);
passwords_ = gtk_check_button_new_with_label(
l10n_util::GetStringUTF8(IDS_IMPORT_PASSWORDS_CHKBOX).c_str());
gtk_box_pack_start(GTK_BOX(vbox), passwords_, FALSE, FALSE, 0);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(passwords_),
- (initial_state_ & PASSWORDS) != 0);
+ (initial_state_ & importer::PASSWORDS) != 0);
history_ = gtk_check_button_new_with_label(
l10n_util::GetStringUTF8(IDS_IMPORT_HISTORY_CHKBOX).c_str());
gtk_box_pack_start(GTK_BOX(vbox), history_, FALSE, FALSE, 0);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(history_),
- (initial_state_ & HISTORY) !=0);
+ (initial_state_ & importer::HISTORY) !=0);
gtk_box_pack_start(GTK_BOX(content_area), vbox, FALSE, FALSE, 0);
@@ -145,15 +146,15 @@ ImportDialogGtk::~ImportDialogGtk() {
void ImportDialogGtk::OnDialogResponse(GtkWidget* widget, int response) {
gtk_widget_hide_all(dialog_);
if (response == GTK_RESPONSE_ACCEPT) {
- uint16 items = NONE;
+ uint16 items = importer::NONE;
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(bookmarks_)))
- items |= FAVORITES;
+ items |= importer::FAVORITES;
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(search_engines_)))
- items |= SEARCH_ENGINES;
+ items |= importer::SEARCH_ENGINES;
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(passwords_)))
- items |= PASSWORDS;
+ items |= importer::PASSWORDS;
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(history_)))
- items |= HISTORY;
+ items |= importer::HISTORY;
if (items == 0) {
ImportComplete();
diff --git a/chrome/browser/gtk/import_progress_dialog_gtk.cc b/chrome/browser/gtk/import_progress_dialog_gtk.cc
index 68514b1..946e1d9 100644
--- a/chrome/browser/gtk/import_progress_dialog_gtk.cc
+++ b/chrome/browser/gtk/import_progress_dialog_gtk.cc
@@ -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.
@@ -13,6 +13,16 @@
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
+using importer::ALL;
+using importer::BOOKMARKS_HTML;
+using importer::FAVORITES;
+using importer::HISTORY;
+using importer::HOME_PAGE;
+using importer::ImportItem;
+using importer::PASSWORDS;
+using importer::ProfileInfo;
+using importer::SEARCH_ENGINES;
+
namespace {
void SetItemImportStatus(GtkWidget* label, int res_id, bool is_done) {
diff --git a/chrome/browser/gtk/import_progress_dialog_gtk.h b/chrome/browser/gtk/import_progress_dialog_gtk.h
index c98472f..a990ca7 100644
--- a/chrome/browser/gtk/import_progress_dialog_gtk.h
+++ b/chrome/browser/gtk/import_progress_dialog_gtk.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.
@@ -8,6 +8,7 @@
#include <gtk/gtk.h>
#include "chrome/browser/importer/importer.h"
+#include "chrome/browser/importer/importer_data_types.h"
class Profile;
@@ -21,8 +22,8 @@ class ImportProgressDialogGtk : public ImporterHost::Observer {
ImportObserver* observer, bool first_run);
// Overridden from ImporterHost::Observer:
- virtual void ImportItemStarted(ImportItem item);
- virtual void ImportItemEnded(ImportItem item);
+ virtual void ImportItemStarted(importer::ImportItem item);
+ virtual void ImportItemEnded(importer::ImportItem item);
virtual void ImportStarted();
virtual void ImportEnded();
diff --git a/chrome/browser/gtk/options/content_page_gtk.cc b/chrome/browser/gtk/options/content_page_gtk.cc
index 356146e..a539eb9 100644
--- a/chrome/browser/gtk/options/content_page_gtk.cc
+++ b/chrome/browser/gtk/options/content_page_gtk.cc
@@ -19,6 +19,7 @@
#include "chrome/browser/gtk/import_dialog_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/browser/pref_service.h"
#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/common/notification_service.h"
@@ -413,7 +414,7 @@ void ContentPageGtk::OnAutofillButtonClicked(GtkWidget* widget) {
void ContentPageGtk::OnImportButtonClicked(GtkWidget* widget) {
ImportDialogGtk::Show(
GTK_WINDOW(gtk_widget_get_toplevel(widget)),
- profile(), ALL);
+ profile(), importer::ALL);
}
void ContentPageGtk::OnGtkThemeButtonClicked(GtkWidget* widget) {
diff --git a/chrome/browser/importer/firefox2_importer.cc b/chrome/browser/importer/firefox2_importer.cc
index b56bee7..11d8109 100644
--- a/chrome/browser/importer/firefox2_importer.cc
+++ b/chrome/browser/importer/firefox2_importer.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 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.
@@ -30,6 +30,13 @@
#include "webkit/glue/password_form.h"
using base::Time;
+using importer::BOOKMARKS_HTML;
+using importer::FAVORITES;
+using importer::HISTORY;
+using importer::HOME_PAGE;
+using importer::PASSWORDS;
+using importer::ProfileInfo;
+using importer::SEARCH_ENGINES;
using webkit_glue::PasswordForm;
// Firefox2Importer.
diff --git a/chrome/browser/importer/firefox2_importer.h b/chrome/browser/importer/firefox2_importer.h
index 95e3cc8..09a80d7 100644
--- a/chrome/browser/importer/firefox2_importer.h
+++ b/chrome/browser/importer/firefox2_importer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 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.
@@ -9,6 +9,7 @@
#include "base/file_path.h"
#include "chrome/browser/importer/importer.h"
+#include "chrome/browser/importer/importer_data_types.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
class TemplateURL;
@@ -19,7 +20,7 @@ class Firefox2Importer : public Importer {
Firefox2Importer();
// Importer methods.
- virtual void StartImport(ProfileInfo profile_info,
+ virtual void StartImport(importer::ProfileInfo profile_info,
uint16 items,
ImporterBridge* bridge);
diff --git a/chrome/browser/importer/firefox3_importer.cc b/chrome/browser/importer/firefox3_importer.cc
index eacb945..a71f995 100644
--- a/chrome/browser/importer/firefox3_importer.cc
+++ b/chrome/browser/importer/firefox3_importer.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 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.
@@ -24,6 +24,13 @@
#include "webkit/glue/password_form.h"
using base::Time;
+using importer::BOOKMARKS_HTML;
+using importer::FAVORITES;
+using importer::HISTORY;
+using importer::HOME_PAGE;
+using importer::PASSWORDS;
+using importer::ProfileInfo;
+using importer::SEARCH_ENGINES;
using webkit_glue::PasswordForm;
void Firefox3Importer::StartImport(ProfileInfo profile_info,
diff --git a/chrome/browser/importer/firefox3_importer.h b/chrome/browser/importer/firefox3_importer.h
index fcdb898..f8bfa2f 100644
--- a/chrome/browser/importer/firefox3_importer.h
+++ b/chrome/browser/importer/firefox3_importer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 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.
@@ -13,6 +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 "googleurl/src/gurl.h"
struct sqlite3;
@@ -25,7 +26,7 @@ class Firefox3Importer : public Importer {
Firefox3Importer() { }
// Importer methods.
- virtual void StartImport(ProfileInfo profile_info,
+ virtual void StartImport(importer::ProfileInfo profile_info,
uint16 items,
ImporterBridge* bridge);
diff --git a/chrome/browser/importer/ie_importer.cc b/chrome/browser/importer/ie_importer.cc
index 8c11064..d171d58 100644
--- a/chrome/browser/importer/ie_importer.cc
+++ b/chrome/browser/importer/ie_importer.cc
@@ -26,6 +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/browser/password_manager/ie7_password.h"
#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/common/time_format.h"
@@ -74,32 +75,32 @@ void IEImporter::StartImport(ProfileInfo profile_info,
// Some IE settings (such as Protected Storage) are obtained via COM APIs.
win_util::ScopedCOMInitializer com_initializer;
- if ((items & HOME_PAGE) && !cancelled())
+ if ((items & importer::HOME_PAGE) && !cancelled())
ImportHomepage(); // Doesn't have a UI item.
// The order here is important!
- if ((items & HISTORY) && !cancelled()) {
- bridge_->NotifyItemStarted(HISTORY);
+ if ((items & importer::HISTORY) && !cancelled()) {
+ bridge_->NotifyItemStarted(importer::HISTORY);
ImportHistory();
- bridge_->NotifyItemEnded(HISTORY);
+ bridge_->NotifyItemEnded(importer::HISTORY);
}
- if ((items & FAVORITES) && !cancelled()) {
- bridge_->NotifyItemStarted(FAVORITES);
+ if ((items & importer::FAVORITES) && !cancelled()) {
+ bridge_->NotifyItemStarted(importer::FAVORITES);
ImportFavorites();
- bridge_->NotifyItemEnded(FAVORITES);
+ bridge_->NotifyItemEnded(importer::FAVORITES);
}
- if ((items & SEARCH_ENGINES) && !cancelled()) {
- bridge_->NotifyItemStarted(SEARCH_ENGINES);
+ if ((items & importer::SEARCH_ENGINES) && !cancelled()) {
+ bridge_->NotifyItemStarted(importer::SEARCH_ENGINES);
ImportSearchEngines();
- bridge_->NotifyItemEnded(SEARCH_ENGINES);
+ bridge_->NotifyItemEnded(importer::SEARCH_ENGINES);
}
- if ((items & PASSWORDS) && !cancelled()) {
- bridge_->NotifyItemStarted(PASSWORDS);
+ if ((items & importer::PASSWORDS) && !cancelled()) {
+ bridge_->NotifyItemStarted(importer::PASSWORDS);
// Always import IE6 passwords.
ImportPasswordsIE6();
if (CurrentIEVersion() >= 7)
ImportPasswordsIE7();
- bridge_->NotifyItemEnded(PASSWORDS);
+ bridge_->NotifyItemEnded(importer::PASSWORDS);
}
bridge_->NotifyEnded();
}
diff --git a/chrome/browser/importer/importer.cc b/chrome/browser/importer/importer.cc
index 7fbaf47..27ba58a 100644
--- a/chrome/browser/importer/importer.cc
+++ b/chrome/browser/importer/importer.cc
@@ -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.
@@ -486,11 +486,12 @@ void ImporterHost::OnLockViewEnd(bool is_continue) {
}
}
-void ImporterHost::StartImportSettings(const ProfileInfo& profile_info,
- Profile* target_profile,
- uint16 items,
- ProfileWriter* writer,
- bool first_run) {
+void ImporterHost::StartImportSettings(
+ const importer::ProfileInfo& profile_info,
+ Profile* target_profile,
+ uint16 items,
+ ProfileWriter* writer,
+ bool first_run) {
DCHECK(!profile_); // We really only support importing from one host at a
// time.
profile_ = target_profile;
@@ -520,8 +521,8 @@ void ImporterHost::StartImportSettings(const ProfileInfo& profile_info,
profile_info, items, bridge);
// We should lock the Firefox profile directory to prevent corruption.
- if (profile_info.browser_type == FIREFOX2 ||
- profile_info.browser_type == FIREFOX3) {
+ if (profile_info.browser_type == importer::FIREFOX2 ||
+ profile_info.browser_type == importer::FIREFOX3) {
firefox_lock_.reset(new FirefoxProfileLock(profile_info.source_path));
if (!firefox_lock_->HasAcquired()) {
// If fail to acquire the lock, we set the source unreadable and
@@ -530,7 +531,7 @@ void ImporterHost::StartImportSettings(const ProfileInfo& profile_info,
// import just the home page, then import anyway. The home page setting
// is stored in an unlocked text file, so it is the only preference safe
// to import even if Firefox is running.
- if (items == HOME_PAGE && first_run && this->headless_) {
+ if (items == importer::HOME_PAGE && first_run && this->headless_) {
AddRef();
InvokeTaskIfDone();
return;
@@ -543,7 +544,7 @@ void ImporterHost::StartImportSettings(const ProfileInfo& profile_info,
#if defined(OS_WIN)
// For google toolbar import, we need the user to log in and store their GAIA
// credentials.
- if (profile_info.browser_type == GOOGLE_TOOLBAR5) {
+ if (profile_info.browser_type == importer::GOOGLE_TOOLBAR5) {
if (!toolbar_importer_utils::IsGoogleGAIACookieInstalled()) {
win_util::MessageBox(
NULL,
@@ -568,7 +569,7 @@ void ImporterHost::StartImportSettings(const ProfileInfo& profile_info,
// BookmarkModel should be loaded before adding IE favorites. So we observe
// the BookmarkModel if needed, and start the task after it has been loaded.
- if ((items & FAVORITES) && !writer_->BookmarkModelIsLoaded()) {
+ if ((items & importer::FAVORITES) && !writer_->BookmarkModelIsLoaded()) {
target_profile->GetBookmarkModel()->AddObserver(this);
waiting_for_bookmarkbar_model_ = true;
installed_bookmark_observer_ = true;
@@ -577,7 +578,7 @@ void ImporterHost::StartImportSettings(const ProfileInfo& profile_info,
// Observes the TemplateURLModel if needed to import search engines from the
// other browser. We also check to see if we're importing bookmarks because
// we can import bookmark keywords from Firefox as search engines.
- if ((items & SEARCH_ENGINES) || (items & FAVORITES)) {
+ if ((items & importer::SEARCH_ENGINES) || (items & importer::FAVORITES)) {
if (!writer_->TemplateURLModelIsLoaded()) {
TemplateURLModel* model = target_profile->GetTemplateURLModel();
registrar_.Add(this, NotificationType::TEMPLATE_URL_MODEL_LOADED,
@@ -606,12 +607,12 @@ void ImporterHost::InvokeTaskIfDone() {
ChromeThread::PostTask(ChromeThread::FILE, FROM_HERE, task_);
}
-void ImporterHost::ImportItemStarted(ImportItem item) {
+void ImporterHost::ImportItemStarted(importer::ImportItem item) {
if (observer_)
observer_->ImportItemStarted(item);
}
-void ImporterHost::ImportItemEnded(ImportItem item) {
+void ImporterHost::ImportItemEnded(importer::ImportItem item) {
if (observer_)
observer_->ImportItemEnded(item);
}
diff --git a/chrome/browser/importer/importer.h b/chrome/browser/importer/importer.h
index 2834c89..6ea8b6d 100644
--- a/chrome/browser/importer/importer.h
+++ b/chrome/browser/importer/importer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 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.
@@ -15,11 +15,15 @@
#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/browser/importer/importer_list.h"
#include "chrome/common/notification_registrar.h"
#include "gfx/native_widget_types.h"
#include "googleurl/src/gurl.h"
+using importer::ImportItem;
+using importer::ProfileInfo;
+
class ImporterBridge;
class Profile;
class Task;
@@ -36,26 +40,6 @@ namespace webkit_glue {
struct PasswordForm;
}
-// An enumeration of the type of data we want to import.
-enum ImportItem {
- NONE = 0x0000,
- HISTORY = 0x0001,
- FAVORITES = 0x0002,
- COOKIES = 0x0004, // not supported yet.
- PASSWORDS = 0x0008,
- SEARCH_ENGINES = 0x0010,
- HOME_PAGE = 0x0020,
- ALL = 0x003f
-};
-
-struct ProfileInfo {
- std::wstring description;
- ProfileType browser_type;
- std::wstring source_path;
- std::wstring app_path;
- uint16 services_supported; // bitmap of ImportItem
-};
-
class FirefoxProfileLock;
class Importer;
@@ -273,8 +257,8 @@ class ImporterHost : public base::RefCountedThreadSafe<ImporterHost>,
}
// Returns the ProfileInfo with the given browser type.
- const ProfileInfo& GetSourceProfileInfoForBrowserType(int browser_type)
- const {
+ const ProfileInfo& GetSourceProfileInfoForBrowserType(
+ int browser_type) const {
return importer_list_.GetSourceProfileInfoForBrowserType(browser_type);
}
diff --git a/chrome/browser/importer/importer_bridge.cc b/chrome/browser/importer/importer_bridge.cc
index e646c7b..782f12b 100644
--- a/chrome/browser/importer/importer_bridge.cc
+++ b/chrome/browser/importer/importer_bridge.cc
@@ -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.
@@ -76,13 +76,13 @@ void InProcessImporterBridge::SetPasswordForm(
NewRunnableMethod(writer_, &ProfileWriter::AddPasswordForm, form));
}
-void InProcessImporterBridge::NotifyItemStarted(ImportItem item) {
+void InProcessImporterBridge::NotifyItemStarted(importer::ImportItem item) {
ChromeThread::PostTask(
ChromeThread::UI, FROM_HERE,
NewRunnableMethod(host_, &ImporterHost::ImportItemStarted, item));
}
-void InProcessImporterBridge::NotifyItemEnded(ImportItem item) {
+void InProcessImporterBridge::NotifyItemEnded(importer::ImportItem item) {
ChromeThread::PostTask(
ChromeThread::UI, FROM_HERE,
NewRunnableMethod(host_, &ImporterHost::ImportItemEnded, item));
diff --git a/chrome/browser/importer/importer_bridge.h b/chrome/browser/importer/importer_bridge.h
index 2da1b7d..14025e6 100644
--- a/chrome/browser/importer/importer_bridge.h
+++ b/chrome/browser/importer/importer_bridge.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.
@@ -13,6 +13,7 @@
#include "base/string16.h"
#include "chrome/browser/importer/importer.h"
+#include "chrome/browser/importer/importer_data_types.h"
// TODO: remove this, see friend declaration in ImporterBridge.
#include "chrome/browser/importer/toolbar_importer.h"
@@ -44,11 +45,11 @@ class ImporterBridge : public base::RefCountedThreadSafe<ImporterBridge> {
// Notifies the coordinator that the collection of data for the specified
// item has begun.
- virtual void NotifyItemStarted(ImportItem item) = 0;
+ virtual void NotifyItemStarted(importer::ImportItem item) = 0;
// Notifies the coordinator that the collection of data for the specified
// item has completed.
- virtual void NotifyItemEnded(ImportItem item) = 0;
+ virtual void NotifyItemEnded(importer::ImportItem item) = 0;
// Notifies the coordinator that the import operation has begun.
virtual void NotifyStarted() = 0;
@@ -95,8 +96,8 @@ class InProcessImporterBridge : public ImporterBridge {
bool unique_on_host_and_path);
virtual void SetPasswordForm(const webkit_glue::PasswordForm& form);
- virtual void NotifyItemStarted(ImportItem item);
- virtual void NotifyItemEnded(ImportItem item);
+ virtual void NotifyItemStarted(importer::ImportItem item);
+ virtual void NotifyItemEnded(importer::ImportItem item);
virtual void NotifyStarted();
virtual void NotifyEnded();
diff --git a/chrome/browser/importer/importer_data_types.h b/chrome/browser/importer/importer_data_types.h
new file mode 100644
index 0000000..52da02c
--- /dev/null
+++ b/chrome/browser/importer/importer_data_types.h
@@ -0,0 +1,57 @@
+// 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_BROWSER_IMPORTER_IMPORTER_DATA_TYPES_H_
+#define CHROME_BROWSER_IMPORTER_IMPORTER_DATA_TYPES_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+
+// Types needed for importing data from other browsers and the Google
+// Toolbar.
+namespace importer {
+
+// An enumeration of the type of data that can be imported.
+enum ImportItem {
+ NONE = 0x0000,
+ HISTORY = 0x0001,
+ FAVORITES = 0x0002,
+ COOKIES = 0x0004, // Not supported yet.
+ PASSWORDS = 0x0008,
+ SEARCH_ENGINES = 0x0010,
+ HOME_PAGE = 0x0020,
+ ALL = 0x003f
+};
+
+// An enumeration of the type of browsers that we support to import
+// settings and data from them. Numbers added so that data can be
+// reliably cast to ints and passed across IPC.
+enum ProfileType {
+#if defined(OS_WIN)
+ MS_IE = 0,
+#endif
+ FIREFOX2 = 1,
+ FIREFOX3 = 2,
+#if defined(OS_MACOSX)
+ SAFARI = 3,
+#endif
+ GOOGLE_TOOLBAR5 = 4,
+ // Identifies a 'bookmarks.html' file.
+ BOOKMARKS_HTML = 5
+};
+
+// Information about a profile needed by an importer to do import work.
+struct ProfileInfo {
+ std::wstring description;
+ importer::ProfileType browser_type;
+ std::wstring source_path;
+ std::wstring app_path;
+ uint16 services_supported; // Bitmap of ImportItem
+};
+
+} // namespace importer
+
+#endif // CHROME_BROWSER_IMPORTER_IMPORTER_DATA_TYPES_H_
+
diff --git a/chrome/browser/importer/importer_list.cc b/chrome/browser/importer/importer_list.cc
index 4369dd6..fccc389 100644
--- a/chrome/browser/importer/importer_list.cc
+++ b/chrome/browser/importer/importer_list.cc
@@ -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.
@@ -56,21 +56,21 @@ void ImporterList::DetectSourceProfiles() {
#endif
}
-Importer* ImporterList::CreateImporterByType(ProfileType type) {
+Importer* ImporterList::CreateImporterByType(importer::ProfileType type) {
switch (type) {
#if defined(OS_WIN)
- case MS_IE:
+ case importer::MS_IE:
return new IEImporter();
#endif
- case BOOKMARKS_HTML:
- case FIREFOX2:
+ case importer::BOOKMARKS_HTML:
+ case importer::FIREFOX2:
return new Firefox2Importer();
- case FIREFOX3:
+ case importer::FIREFOX3:
return new Firefox3Importer();
- case GOOGLE_TOOLBAR5:
+ case importer::GOOGLE_TOOLBAR5:
return new Toolbar5Importer();
#if defined(OS_MACOSX)
- case SAFARI:
+ case importer::SAFARI:
return new SafariImporter(mac_util::GetUserLibraryPath());
#endif // OS_MACOSX
}
@@ -87,12 +87,13 @@ std::wstring ImporterList::GetSourceProfileNameAt(int index) const {
return source_profiles_[index]->description;
}
-const ProfileInfo& ImporterList::GetSourceProfileInfoAt(int index) const {
+const importer::ProfileInfo& ImporterList::GetSourceProfileInfoAt(
+ int index) const {
DCHECK(index >=0 && index < GetAvailableProfileCount());
return *source_profiles_[index];
}
-const ProfileInfo& ImporterList::GetSourceProfileInfoForBrowserType(
+const importer::ProfileInfo& ImporterList::GetSourceProfileInfoForBrowserType(
int browser_type) const {
int count = GetAvailableProfileCount();
for (int i = 0; i < count; ++i) {
@@ -100,7 +101,7 @@ const ProfileInfo& ImporterList::GetSourceProfileInfoForBrowserType(
return *source_profiles_[i];
}
NOTREACHED();
- return *(new ProfileInfo());
+ return *(new importer::ProfileInfo());
}
#if defined(OS_WIN)
@@ -108,11 +109,11 @@ void ImporterList::DetectIEProfiles() {
// IE always exists and don't have multiple profiles.
ProfileInfo* ie = new ProfileInfo();
ie->description = l10n_util::GetString(IDS_IMPORT_FROM_IE);
- ie->browser_type = MS_IE;
+ ie->browser_type = importer::MS_IE;
ie->source_path.clear();
ie->app_path.clear();
- ie->services_supported = HISTORY | FAVORITES | COOKIES | PASSWORDS |
- SEARCH_ENGINES;
+ ie->services_supported = importer::HISTORY | importer::FAVORITES |
+ importer::COOKIES | importer::PASSWORDS | importer::SEARCH_ENGINES;
source_profiles_.push_back(ie);
}
#endif
@@ -165,7 +166,7 @@ void ImporterList::DetectFirefoxProfiles() {
}
// Detects which version of Firefox is installed.
- ProfileType firefox_type;
+ importer::ProfileType firefox_type;
FilePath app_path;
int version = 0;
#if defined(OS_WIN)
@@ -175,16 +176,16 @@ void ImporterList::DetectFirefoxProfiles() {
GetFirefoxVersionAndPathFromProfile(source_path, &version, &app_path);
if (version == 2) {
- firefox_type = FIREFOX2;
+ firefox_type = importer::FIREFOX2;
} else if (version == 3) {
- firefox_type = FIREFOX3;
+ firefox_type = importer::FIREFOX3;
} else {
// Ignores other versions of firefox.
return;
}
if (!source_path.empty()) {
- ProfileInfo* firefox = new ProfileInfo();
+ importer::ProfileInfo* firefox = new importer::ProfileInfo();
firefox->description = l10n_util::GetString(IDS_IMPORT_FROM_FIREFOX);
firefox->browser_type = firefox_type;
firefox->source_path = source_path.ToWStringHack();
@@ -193,31 +194,31 @@ void ImporterList::DetectFirefoxProfiles() {
#endif
if (firefox->app_path.empty())
firefox->app_path = app_path.ToWStringHack();
- firefox->services_supported = HISTORY | FAVORITES | COOKIES | PASSWORDS |
- SEARCH_ENGINES;
+ firefox->services_supported = importer::HISTORY | importer::FAVORITES |
+ importer::COOKIES | importer::PASSWORDS | importer::SEARCH_ENGINES;
source_profiles_.push_back(firefox);
}
}
void ImporterList::DetectGoogleToolbarProfiles() {
if (!FirstRun::IsChromeFirstRun()) {
- ProfileInfo* google_toolbar = new ProfileInfo();
- google_toolbar->browser_type = GOOGLE_TOOLBAR5;
+ importer::ProfileInfo* google_toolbar = new importer::ProfileInfo();
+ google_toolbar->browser_type = importer::GOOGLE_TOOLBAR5;
google_toolbar->description = l10n_util::GetString(
IDS_IMPORT_FROM_GOOGLE_TOOLBAR);
google_toolbar->source_path.clear();
google_toolbar->app_path.clear();
- google_toolbar->services_supported = FAVORITES;
+ google_toolbar->services_supported = importer::FAVORITES;
source_profiles_.push_back(google_toolbar);
}
}
#if defined(OS_MACOSX)
void ImporterList::DetectSafariProfiles() {
- uint16 items = NONE;
+ uint16 items = importer::NONE;
if (SafariImporter::CanImport(mac_util::GetUserLibraryPath(), &items)) {
- ProfileInfo* safari = new ProfileInfo();
- safari->browser_type = SAFARI;
+ importer::ProfileInfo* safari = new importer::ProfileInfo();
+ safari->browser_type = importer::SAFARI;
safari->description = l10n_util::GetString(IDS_IMPORT_FROM_SAFARI);
safari->source_path.clear();
safari->app_path.clear();
diff --git a/chrome/browser/importer/importer_list.h b/chrome/browser/importer/importer_list.h
index 9619bb9..156e12e 100644
--- a/chrome/browser/importer/importer_list.h
+++ b/chrome/browser/importer/importer_list.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.
@@ -9,27 +9,10 @@
#include <vector>
#include "build/build_config.h"
-
#include "base/basictypes.h"
+#include "chrome/browser/importer/importer_data_types.h"
class Importer;
-struct ProfileInfo;
-
-// An enumeration of the type of browsers that we support to import
-// settings and data from them.
-enum ProfileType {
-#if defined(OS_WIN)
- MS_IE,
-#endif
- FIREFOX2,
- FIREFOX3,
-#if defined(OS_MACOSX)
- SAFARI,
-#endif
- GOOGLE_TOOLBAR5,
- // Identifies a 'bookmarks.html' file.
- BOOKMARKS_HTML
-};
class ImporterList {
public:
@@ -41,7 +24,7 @@ class ImporterList {
// of all profiles.
void DetectSourceProfiles();
- Importer* CreateImporterByType(ProfileType type);
+ Importer* CreateImporterByType(importer::ProfileType type);
// Returns the number of different browser profiles you can import from.
int GetAvailableProfileCount() const;
@@ -52,10 +35,10 @@ class ImporterList {
// Returns the ProfileInfo at the specified index. The ProfileInfo should be
// passed to StartImportSettings().
- const ProfileInfo& GetSourceProfileInfoAt(int index) const;
+ const importer::ProfileInfo& GetSourceProfileInfoAt(int index) const;
// Returns the ProfileInfo with the given browser type.
- const ProfileInfo& GetSourceProfileInfoForBrowserType(int browser_type) const;
+ const importer::ProfileInfo& GetSourceProfileInfoForBrowserType(int browser_type) const;
// Helper methods for detecting available profiles.
#if defined(OS_WIN)
@@ -69,7 +52,7 @@ class ImporterList {
private:
// The list of profiles with the default one first.
- std::vector<ProfileInfo*> source_profiles_;
+ std::vector<importer::ProfileInfo*> source_profiles_;
DISALLOW_COPY_AND_ASSIGN(ImporterList);
};
diff --git a/chrome/browser/importer/importer_unittest.cc b/chrome/browser/importer/importer_unittest.cc
index 3ba7c41..f4ebbe2 100644
--- a/chrome/browser/importer/importer_unittest.cc
+++ b/chrome/browser/importer/importer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 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.
@@ -23,14 +23,24 @@
#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/browser/password_manager/ie7_password.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/common/chrome_paths.h"
#include "webkit/glue/password_form.h"
+using importer::FAVORITES;
+using importer::FIREFOX2;
+using importer::FIREFOX3;
+using importer::HISTORY;
+using importer::ImportItem;
+using importer::MS_IE;
+using importer::PASSWORDS;
+using importer::SEARCH_ENGINES;
using webkit_glue::PasswordForm;
+
class ImporterTest : public testing::Test {
public:
ImporterTest()
diff --git a/chrome/browser/importer/safari_importer.h b/chrome/browser/importer/safari_importer.h
index c47bdac..c15ca30 100644
--- a/chrome/browser/importer/safari_importer.h
+++ b/chrome/browser/importer/safari_importer.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.
@@ -13,6 +13,7 @@
#include "base/file_path.h"
#include "chrome/common/sqlite_utils.h"
+#include "chrome/browser/importer/importer_data_types.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
#if __OBJC__
@@ -31,7 +32,7 @@ class SafariImporter : public Importer {
explicit SafariImporter(const FilePath& library_dir);
// Importer methods.
- virtual void StartImport(ProfileInfo profile_info,
+ virtual void StartImport(importer::ProfileInfo profile_info,
uint16 items,
ImporterBridge* bridge);
diff --git a/chrome/browser/importer/safari_importer.mm b/chrome/browser/importer/safari_importer.mm
index 3118b31..e503165 100644
--- a/chrome/browser/importer/safari_importer.mm
+++ b/chrome/browser/importer/safari_importer.mm
@@ -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.
@@ -24,6 +24,12 @@
#include "grit/generated_resources.h"
#include "net/base/data_url.h"
+using importer::FAVORITES;
+using importer::HISTORY;
+using importer::NONE;
+using importer::PASSWORDS;
+using importer::ProfileInfo;
+
namespace {
// A function like this is used by other importers in order to filter out
diff --git a/chrome/browser/importer/safari_importer_unittest.mm b/chrome/browser/importer/safari_importer_unittest.mm
index 5c8a153..bb8b66d 100644
--- a/chrome/browser/importer/safari_importer_unittest.mm
+++ b/chrome/browser/importer/safari_importer_unittest.mm
@@ -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.
@@ -15,6 +15,14 @@
#include "chrome/browser/importer/importer_bridge.h"
#include "testing/platform_test.h"
+using importer::COOKIES;
+using importer::FAVORITES;
+using importer::HISTORY;
+using importer::HOME_PAGE;
+using importer::NONE;
+using importer::PASSWORDS;
+using importer::SEARCH_ENGINES;
+
// In order to test the Safari import functionality effectively, we store a
// simulated Library directory containing dummy data files in the same
// structure as ~/Library in the Chrome test data directory.
diff --git a/chrome/browser/importer/toolbar_importer.cc b/chrome/browser/importer/toolbar_importer.cc
index 47b0974..a2a5430 100644
--- a/chrome/browser/importer/toolbar_importer.cc
+++ b/chrome/browser/importer/toolbar_importer.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 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.
@@ -20,6 +20,10 @@
#include "net/base/data_url.h"
#include "net/url_request/url_request_context.h"
+using importer::FAVORITES;
+using importer::NONE;
+using importer::ProfileInfo;
+
//
// ToolbarImporterUtils
//
@@ -158,7 +162,8 @@ void Toolbar5Importer::OnURLFetchComplete(
}
void Toolbar5Importer::ContinueImport() {
- DCHECK((items_to_import_ == FAVORITES) || (items_to_import_ == NONE)) <<
+ DCHECK((items_to_import_ == FAVORITES) ||
+ (items_to_import_ == NONE)) <<
"The items requested are not supported";
// The order here is important. Each Begin... will clear the flag
diff --git a/chrome/browser/importer/toolbar_importer.h b/chrome/browser/importer/toolbar_importer.h
index 14df86b..ab0160a 100644
--- a/chrome/browser/importer/toolbar_importer.h
+++ b/chrome/browser/importer/toolbar_importer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 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.
@@ -12,6 +12,7 @@
#include <vector>
#include "chrome/browser/importer/importer.h"
+#include "chrome/browser/importer/importer_data_types.h"
#include "chrome/browser/net/url_fetcher.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
@@ -39,7 +40,7 @@ class Toolbar5Importer : public URLFetcher::Delegate, public Importer {
// should only either be NONE or FAVORITES, since as of right now these are
// the only items this importer supports. This method provides implementation
// of Importer::StartImport.
- virtual void StartImport(ProfileInfo profile_info,
+ virtual void StartImport(importer::ProfileInfo profile_info,
uint16 items,
ImporterBridge* bridge);
diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc
index f1fb348..6e3718a 100644
--- a/chrome/browser/views/bookmark_bar_view.cc
+++ b/chrome/browser/views/bookmark_bar_view.cc
@@ -20,6 +20,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/browser/metrics/user_metrics.h"
#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
@@ -876,7 +877,7 @@ void BookmarkBarView::ShowImportDialog() {
views::Window::CreateChromeWindow(
GetWindow()->GetNativeWindow(),
gfx::Rect(),
- new ImporterView(profile_, FAVORITES))->Show();
+ new ImporterView(profile_, importer::FAVORITES))->Show();
#endif
}
diff --git a/chrome/browser/views/bookmark_manager_view.cc b/chrome/browser/views/bookmark_manager_view.cc
index 503af86..fc8ddd1 100644
--- a/chrome/browser/views/bookmark_manager_view.cc
+++ b/chrome/browser/views/bookmark_manager_view.cc
@@ -20,6 +20,7 @@
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/importer/importer.h"
+#include "chrome/browser/importer/importer_data_types.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
@@ -607,10 +608,10 @@ void BookmarkManagerView::FileSelected(const FilePath& path,
// ImporterHost is ref counted and will delete itself when done.
ImporterHost* host = new ImporterHost();
ProfileInfo profile_info;
- profile_info.browser_type = BOOKMARKS_HTML;
+ profile_info.browser_type = importer::BOOKMARKS_HTML;
profile_info.source_path = path.ToWStringHack();
- StartImportingWithUI(GetWidget()->GetNativeView(), FAVORITES, host,
- profile_info, profile_,
+ StartImportingWithUI(GetWidget()->GetNativeView(), importer::FAVORITES,
+ host, profile_info, profile_,
new ImportObserverImpl(profile()), false);
} else if (id == IDS_BOOKMARK_MANAGER_EXPORT_MENU) {
bookmark_html_writer::WriteBookmarks(profile(), path, NULL);
diff --git a/chrome/browser/views/first_run_view_base.cc b/chrome/browser/views/first_run_view_base.cc
index 88e2b9d..300d9c9 100644
--- a/chrome/browser/views/first_run_view_base.cc
+++ b/chrome/browser/views/first_run_view_base.cc
@@ -12,6 +12,7 @@
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/first_run.h"
+#include "chrome/browser/importer/importer.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/pref_service.h"
#include "chrome/browser/shell_integration.h"
@@ -187,16 +188,16 @@ int FirstRunViewBase::GetImportItems() const {
// the process take way too much time among other issues. So for the time
// being we say: TODO(CPU): Bug 1196875
int items = import_items_;
- if (!(dont_import_items_ & HISTORY))
- items = items | HISTORY;
- if (!(dont_import_items_ & FAVORITES))
- items = items | FAVORITES;
- if (!(dont_import_items_ & PASSWORDS))
- items = items | PASSWORDS;
- if (!(dont_import_items_ & SEARCH_ENGINES))
- items = items | SEARCH_ENGINES;
+ if (!(dont_import_items_ & importer::HISTORY))
+ items = items | importer::HISTORY;
+ if (!(dont_import_items_ & importer::FAVORITES))
+ items = items | importer::FAVORITES;
+ if (!(dont_import_items_ & importer::PASSWORDS))
+ items = items | importer::PASSWORDS;
+ if (!(dont_import_items_ & importer::SEARCH_ENGINES))
+ items = items | importer::SEARCH_ENGINES;
if (!homepage_defined_)
- items = items | HOME_PAGE;
+ items = items | importer::HOME_PAGE;
return items;
};
diff --git a/chrome/browser/views/importer_view.cc b/chrome/browser/views/importer_view.cc
index 12636c8..9a4b24a 100644
--- a/chrome/browser/views/importer_view.cc
+++ b/chrome/browser/views/importer_view.cc
@@ -7,6 +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 "grit/generated_resources.h"
#include "grit/locale_settings.h"
#include "views/controls/button/checkbox.h"
@@ -25,7 +26,7 @@ namespace browser {
void ShowImporterView(views::Widget* parent,
Profile* profile) {
views::Window::CreateChromeWindow(parent->GetNativeView(), gfx::Rect(),
- new ImporterView(profile, ALL))->Show();
+ new ImporterView(profile, importer::ALL))->Show();
}
} // namespace browser
@@ -61,16 +62,16 @@ void ImporterView::SetupControl() {
history_checkbox_ =
InitCheckbox(l10n_util::GetString(IDS_IMPORT_HISTORY_CHKBOX),
- (initial_state_ & HISTORY) != 0);
+ (initial_state_ & importer::HISTORY) != 0);
favorites_checkbox_ =
InitCheckbox(l10n_util::GetString(IDS_IMPORT_FAVORITES_CHKBOX),
- (initial_state_ & FAVORITES) != 0);
+ (initial_state_ & importer::FAVORITES) != 0);
passwords_checkbox_ =
InitCheckbox(l10n_util::GetString(IDS_IMPORT_PASSWORDS_CHKBOX),
- (initial_state_ & PASSWORDS) != 0);
+ (initial_state_ & importer::PASSWORDS) != 0);
search_engines_checkbox_ =
InitCheckbox(l10n_util::GetString(IDS_IMPORT_SEARCH_ENGINES_CHKBOX),
- (initial_state_ & SEARCH_ENGINES) != 0);
+ (initial_state_ & importer::SEARCH_ENGINES) != 0);
// Arranges controls by using GridLayout.
const int column_set_id = 0;
@@ -207,39 +208,39 @@ views::Checkbox* ImporterView::InitCheckbox(const std::wstring& text,
}
uint16 ImporterView::GetCheckedItems() {
- uint16 items = NONE;
+ uint16 items = importer::NONE;
if (history_checkbox_->IsEnabled() && history_checkbox_->checked())
- items |= HISTORY;
+ items |= importer::HISTORY;
if (favorites_checkbox_->IsEnabled() && favorites_checkbox_->checked())
- items |= FAVORITES;
+ items |= importer::FAVORITES;
if (passwords_checkbox_->IsEnabled() && passwords_checkbox_->checked())
- items |= PASSWORDS;
+ items |= importer::PASSWORDS;
if (search_engines_checkbox_->IsEnabled() &&
search_engines_checkbox_->checked())
- items |= SEARCH_ENGINES;
+ items |= importer::SEARCH_ENGINES;
return items;
}
void ImporterView::SetCheckedItemsState(uint16 items) {
- if (items & HISTORY) {
+ if (items & importer::HISTORY) {
history_checkbox_->SetEnabled(true);
} else {
history_checkbox_->SetEnabled(false);
history_checkbox_->SetChecked(false);
}
- if (items & FAVORITES) {
+ if (items & importer::FAVORITES) {
favorites_checkbox_->SetEnabled(true);
} else {
favorites_checkbox_->SetEnabled(false);
favorites_checkbox_->SetChecked(false);
}
- if (items & PASSWORDS) {
+ if (items & importer::PASSWORDS) {
passwords_checkbox_->SetEnabled(true);
} else {
passwords_checkbox_->SetEnabled(false);
passwords_checkbox_->SetChecked(false);
}
- if (items & SEARCH_ENGINES) {
+ if (items & importer::SEARCH_ENGINES) {
search_engines_checkbox_->SetEnabled(true);
} else {
search_engines_checkbox_->SetEnabled(false);
@@ -249,14 +250,15 @@ void ImporterView::SetCheckedItemsState(uint16 items) {
void ImporterView::SetCheckedItems(uint16 items) {
if (history_checkbox_->IsEnabled())
- history_checkbox_->SetChecked(!!(items & HISTORY));
+ history_checkbox_->SetChecked(!!(items & importer::HISTORY));
if (favorites_checkbox_->IsEnabled())
- favorites_checkbox_->SetChecked(!!(items & FAVORITES));
+ favorites_checkbox_->SetChecked(!!(items & importer::FAVORITES));
if (passwords_checkbox_->IsEnabled())
- passwords_checkbox_->SetChecked(!!(items & PASSWORDS));
+ passwords_checkbox_->SetChecked(!!(items & importer::PASSWORDS));
if (search_engines_checkbox_->IsEnabled())
- search_engines_checkbox_->SetChecked(!!(items & SEARCH_ENGINES));
+ search_engines_checkbox_->SetChecked(!!(items &
+ importer::SEARCH_ENGINES));
}
diff --git a/chrome/browser/views/importing_progress_view.cc b/chrome/browser/views/importing_progress_view.cc
index 32b92e5..70e71f0 100644
--- a/chrome/browser/views/importing_progress_view.cc
+++ b/chrome/browser/views/importing_progress_view.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 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.
@@ -97,47 +97,47 @@ ImportingProgressView::~ImportingProgressView() {
////////////////////////////////////////////////////////////////////////////////
// ImportingProgressView, ImporterObserver implementation:
-void ImportingProgressView::ImportItemStarted(ImportItem item) {
+void ImportingProgressView::ImportItemStarted(importer::ImportItem item) {
DCHECK(items_ & item);
switch (item) {
- case FAVORITES:
+ case importer::FAVORITES:
state_bookmarks_->Start();
break;
- case SEARCH_ENGINES:
+ case importer::SEARCH_ENGINES:
state_searches_->Start();
break;
- case PASSWORDS:
+ case importer::PASSWORDS:
state_passwords_->Start();
break;
- case HISTORY:
+ case importer::HISTORY:
state_history_->Start();
break;
- case COOKIES:
+ case importer::COOKIES:
state_cookies_->Start();
break;
}
}
-void ImportingProgressView::ImportItemEnded(ImportItem item) {
+void ImportingProgressView::ImportItemEnded(importer::ImportItem item) {
DCHECK(items_ & item);
switch (item) {
- case FAVORITES:
+ case importer::FAVORITES:
state_bookmarks_->Stop();
state_bookmarks_->SetChecked(true);
break;
- case SEARCH_ENGINES:
+ case importer::SEARCH_ENGINES:
state_searches_->Stop();
state_searches_->SetChecked(true);
break;
- case PASSWORDS:
+ case importer::PASSWORDS:
state_passwords_->Stop();
state_passwords_->SetChecked(true);
break;
- case HISTORY:
+ case importer::HISTORY:
state_history_->Stop();
state_history_->SetChecked(true);
break;
- case COOKIES:
+ case importer::COOKIES:
state_cookies_->Stop();
state_cookies_->SetChecked(true);
break;
@@ -254,31 +254,31 @@ void ImportingProgressView::InitControlLayout() {
layout->AddView(label_info_);
layout->AddPaddingRow(0, kUnrelatedControlVerticalSpacing);
- if (items_ & HISTORY) {
+ if (items_ & importer::HISTORY) {
layout->StartRow(0, double_column_view_set_id);
layout->AddView(state_history_.get());
layout->AddView(label_history_.get());
layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
}
- if (items_ & FAVORITES && !bookmarks_import_) {
+ if (items_ & importer::FAVORITES && !bookmarks_import_) {
layout->StartRow(0, double_column_view_set_id);
layout->AddView(state_bookmarks_.get());
layout->AddView(label_bookmarks_.get());
layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
}
- if (items_ & SEARCH_ENGINES) {
+ if (items_ & importer::SEARCH_ENGINES) {
layout->StartRow(0, double_column_view_set_id);
layout->AddView(state_searches_.get());
layout->AddView(label_searches_.get());
layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
}
- if (items_ & PASSWORDS) {
+ if (items_ & importer::PASSWORDS) {
layout->StartRow(0, double_column_view_set_id);
layout->AddView(state_passwords_.get());
layout->AddView(label_passwords_.get());
layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
}
- if (items_ & COOKIES) {
+ if (items_ & importer::COOKIES) {
layout->StartRow(0, double_column_view_set_id);
layout->AddView(state_cookies_.get());
layout->AddView(label_cookies_.get());
@@ -299,7 +299,7 @@ void StartImportingWithUI(HWND parent_window,
DCHECK(items != 0);
ImportingProgressView* v = new ImportingProgressView(
source_profile.description, items, coordinator, observer, parent_window,
- source_profile.browser_type == BOOKMARKS_HTML);
+ source_profile.browser_type == importer::BOOKMARKS_HTML);
views::Window* window =
views::Window::CreateChromeWindow(parent_window, gfx::Rect(), v);
diff --git a/chrome/browser/views/importing_progress_view.h b/chrome/browser/views/importing_progress_view.h
index da3afbd..71fdc74 100644
--- a/chrome/browser/views/importing_progress_view.h
+++ b/chrome/browser/views/importing_progress_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 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.
@@ -6,6 +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 "views/view.h"
#include "views/window/dialog_delegate.h"
#include "views/window/window.h"
@@ -32,8 +33,8 @@ class ImportingProgressView : public views::View,
protected:
// Overridden from ImporterHost::Observer:
- virtual void ImportItemStarted(ImportItem item);
- virtual void ImportItemEnded(ImportItem item);
+ virtual void ImportItemStarted(importer::ImportItem item);
+ virtual void ImportItemEnded(importer::ImportItem item);
virtual void ImportStarted();
virtual void ImportEnded();
diff --git a/chrome/browser/views/options/content_page_view.cc b/chrome/browser/views/options/content_page_view.cc
index 7c28557..8a626ef 100644
--- a/chrome/browser/views/options/content_page_view.cc
+++ b/chrome/browser/views/options/content_page_view.cc
@@ -18,6 +18,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/browser/profile.h"
#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/browser/views/importer_view.h"
@@ -120,7 +121,7 @@ void ContentPageView::ButtonPressed(
views::Window::CreateChromeWindow(
GetWindow()->GetNativeWindow(),
gfx::Rect(),
- new ImporterView(profile(), ALL))->Show();
+ new ImporterView(profile(), importer::ALL))->Show();
} else if (sender == sync_start_stop_button_) {
DCHECK(sync_service_);
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index a2dba11..2563588 100755
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -1409,6 +1409,7 @@
'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',