summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-06 18:35:11 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-06 18:35:11 +0000
commit76176e8ac414c60540d9dcd146c8198a2988136b (patch)
tree6c535e54e89aba5905189360c1928514361f8afb /chrome/browser
parentd2b21e8d4c93fb3c95693eed3ceae02a910e33b5 (diff)
downloadchromium_src-76176e8ac414c60540d9dcd146c8198a2988136b.zip
chromium_src-76176e8ac414c60540d9dcd146c8198a2988136b.tar.gz
chromium_src-76176e8ac414c60540d9dcd146c8198a2988136b.tar.bz2
importer: Cleanup ProfileInfo calls a little bit.
- Rename the struct from ProfileInfo to SourceProfile, so it makes a bit more sense. - Rename the ImporterList methods, removing the Info from the ProfileInfo, so it's just SourceProfile. - Forward declare SourceProfile struct whenever is possible. - Use uint16 for the bitmask of importer::ImportItem where is applicable. BUG=None TEST=None R=avi@chromium.org Review URL: http://codereview.chromium.org/6801004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80666 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/automation/testing_automation_provider.cc14
-rw-r--r--chrome/browser/extensions/extension_bookmarks_module.cc8
-rw-r--r--chrome/browser/first_run/first_run.cc31
-rw-r--r--chrome/browser/first_run/first_run.h2
-rw-r--r--chrome/browser/first_run/first_run_win.cc8
-rw-r--r--chrome/browser/importer/external_process_importer_client.cc6
-rw-r--r--chrome/browser/importer/external_process_importer_client.h8
-rw-r--r--chrome/browser/importer/external_process_importer_host.cc20
-rw-r--r--chrome/browser/importer/external_process_importer_host.h17
-rw-r--r--chrome/browser/importer/firefox2_importer.cc13
-rw-r--r--chrome/browser/importer/firefox2_importer.h3
-rw-r--r--chrome/browser/importer/firefox3_importer.cc15
-rw-r--r--chrome/browser/importer/firefox3_importer.h10
-rw-r--r--chrome/browser/importer/ie_importer.cc4
-rw-r--r--chrome/browser/importer/ie_importer.h2
-rw-r--r--chrome/browser/importer/importer.h4
-rw-r--r--chrome/browser/importer/importer_data_types.cc4
-rw-r--r--chrome/browser/importer/importer_data_types.h9
-rw-r--r--chrome/browser/importer/importer_host.cc22
-rw-r--r--chrome/browser/importer/importer_host.h17
-rw-r--r--chrome/browser/importer/importer_list.cc35
-rw-r--r--chrome/browser/importer/importer_list.h19
-rw-r--r--chrome/browser/importer/importer_progress_dialog.h4
-rw-r--r--chrome/browser/importer/importer_unittest.cc28
-rw-r--r--chrome/browser/importer/profile_import_process_host.cc5
-rw-r--r--chrome/browser/importer/profile_import_process_host.h7
-rw-r--r--chrome/browser/importer/profile_import_process_messages.h16
-rw-r--r--chrome/browser/importer/safari_importer.h16
-rw-r--r--chrome/browser/importer/safari_importer.mm13
-rw-r--r--chrome/browser/importer/toolbar_importer.cc8
-rw-r--r--chrome/browser/importer/toolbar_importer.h14
-rw-r--r--chrome/browser/ui/cocoa/importer/import_progress_dialog_cocoa.mm2
-rw-r--r--chrome/browser/ui/gtk/importer/import_progress_dialog_gtk.cc12
-rw-r--r--chrome/browser/ui/gtk/importer/import_progress_dialog_gtk.h4
-rw-r--r--chrome/browser/ui/views/importer/import_progress_dialog_view.cc2
-rw-r--r--chrome/browser/ui/webui/options/import_data_handler.cc8
36 files changed, 214 insertions, 196 deletions
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index d3014f5..467835c 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -152,14 +152,14 @@ TestingAutomationProvider::~TestingAutomationProvider() {
void TestingAutomationProvider::SourceProfilesLoaded() {
DCHECK_NE(static_cast<ImporterList*>(NULL), importer_list_.get());
- // Get the correct ProfileInfo based on the browser the user provided.
- importer::ProfileInfo profile_info;
+ // Get the correct profile based on the browser the user provided.
+ importer::SourceProfile source_profile;
int num_browsers = importer_list_->GetAvailableProfileCount();
int i = 0;
for ( ; i < num_browsers; i++) {
string16 name = importer_list_->GetSourceProfileNameAt(i);
if (name == import_settings_data_.browser_name) {
- profile_info = importer_list_->GetSourceProfileInfoAt(i);
+ source_profile = importer_list_->GetSourceProfileAt(i);
break;
}
}
@@ -175,11 +175,11 @@ void TestingAutomationProvider::SourceProfilesLoaded() {
new AutomationProviderImportSettingsObserver(
this, import_settings_data_.reply_message));
- Profile* profile = import_settings_data_.browser->profile();
- importer_host->StartImportSettings(profile_info,
- profile,
+ Profile* target_profile = import_settings_data_.browser->profile();
+ importer_host->StartImportSettings(source_profile,
+ target_profile,
import_settings_data_.import_items,
- new ProfileWriter(profile),
+ new ProfileWriter(target_profile),
import_settings_data_.first_run);
}
diff --git a/chrome/browser/extensions/extension_bookmarks_module.cc b/chrome/browser/extensions/extension_bookmarks_module.cc
index e5a8613..4c5834d 100644
--- a/chrome/browser/extensions/extension_bookmarks_module.cc
+++ b/chrome/browser/extensions/extension_bookmarks_module.cc
@@ -853,10 +853,10 @@ void ImportBookmarksFunction::FileSelected(const FilePath& path,
int index,
void* params) {
scoped_refptr<ImporterHost> importer_host(new ImporterHost);
- importer::ProfileInfo profile_info;
- profile_info.importer_type = importer::BOOKMARKS_HTML;
- profile_info.source_path = path;
- importer_host->StartImportSettings(profile_info,
+ importer::SourceProfile source_profile;
+ source_profile.importer_type = importer::BOOKMARKS_HTML;
+ source_profile.source_path = path;
+ importer_host->StartImportSettings(source_profile,
profile(),
importer::FAVORITES,
new ProfileWriter(profile()),
diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc
index dbbf3fe..9cc2e16 100644
--- a/chrome/browser/first_run/first_run.cc
+++ b/chrome/browser/first_run/first_run.cc
@@ -27,6 +27,7 @@
#include "chrome/installer/util/master_preferences.h"
#include "chrome/installer/util/master_preferences_constants.h"
#include "chrome/installer/util/util_constants.h"
+#include "googleurl/src/gurl.h"
#if defined(OS_WIN)
// TODO(port): move more code in back from the first_run_win.cc module.
@@ -285,7 +286,7 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir,
scoped_refptr<ImporterList> importer_list(new ImporterList);
importer_list->DetectSourceProfilesHack();
if (!FirstRun::ImportSettings(NULL,
- importer_list->GetSourceProfileInfoAt(0).importer_type,
+ importer_list->GetSourceProfileAt(0).importer_type,
out_prefs->do_import_items,
FilePath::FromWStringHack(UTF8ToWide(import_bookmarks_path)),
true, NULL)) {
@@ -425,22 +426,20 @@ int FirstRun::ImportFromFile(Profile* profile, const CommandLine& cmdline) {
return false;
}
scoped_refptr<ImporterHost> importer_host(new ImporterHost);
- FirstRunImportObserver importer_observer;
-
importer_host->set_headless();
- importer::ProfileInfo profile_info;
- profile_info.importer_type = importer::BOOKMARKS_HTML;
- profile_info.source_path = file_path;
+ importer::SourceProfile source_profile;
+ source_profile.importer_type = importer::BOOKMARKS_HTML;
+ source_profile.source_path = file_path;
- importer::ShowImportProgressDialog(
- NULL,
- importer::FAVORITES,
- importer_host,
- &importer_observer,
- profile_info,
- profile,
- true);
+ FirstRunImportObserver importer_observer;
+ importer::ShowImportProgressDialog(NULL,
+ importer::FAVORITES,
+ importer_host,
+ &importer_observer,
+ source_profile,
+ profile,
+ true);
importer_observer.RunLoop();
return importer_observer.import_result();
@@ -675,8 +674,8 @@ bool FirstRun::ImportSettings(Profile* profile,
scoped_refptr<ImporterHost> importer_host,
scoped_refptr<ImporterList> importer_list,
int items_to_import) {
- const importer::ProfileInfo& source_profile =
- importer_list->GetSourceProfileInfoAt(0);
+ const importer::SourceProfile& source_profile =
+ importer_list->GetSourceProfileAt(0);
// Ensure that importers aren't requested to import items that they do not
// support.
diff --git a/chrome/browser/first_run/first_run.h b/chrome/browser/first_run/first_run.h
index d41c9be..8cb5861 100644
--- a/chrome/browser/first_run/first_run.h
+++ b/chrome/browser/first_run/first_run.h
@@ -13,11 +13,11 @@
#include "chrome/browser/browser_process_impl.h"
#include "chrome/browser/importer/importer_observer.h"
#include "content/common/result_codes.h"
-#include "googleurl/src/gurl.h"
#include "ui/gfx/native_widget_types.h"
class CommandLine;
class FilePath;
+class GURL;
class Profile;
class ProcessSingleton;
class ImporterHost;
diff --git a/chrome/browser/first_run/first_run_win.cc b/chrome/browser/first_run/first_run_win.cc
index f72464e..9d963b1 100644
--- a/chrome/browser/first_run/first_run_win.cc
+++ b/chrome/browser/first_run/first_run_win.cc
@@ -498,9 +498,11 @@ bool FirstRun::ImportSettings(Profile* profile,
int items_to_import) {
return ImportSettings(
profile,
- importer_list->GetSourceProfileInfoAt(0).importer_type,
+ importer_list->GetSourceProfileAt(0).importer_type,
items_to_import,
- FilePath(), false, NULL);
+ FilePath(),
+ false,
+ NULL);
}
int FirstRun::ImportFromBrowser(Profile* profile,
@@ -535,7 +537,7 @@ int FirstRun::ImportFromBrowser(Profile* profile,
static_cast<uint16>(items_to_import),
importer_host,
&importer_observer,
- importer_list->GetSourceProfileInfoForImporterType(importer_type),
+ importer_list->GetSourceProfileForImporterType(importer_type),
profile,
true);
importer_observer.RunLoop();
diff --git a/chrome/browser/importer/external_process_importer_client.cc b/chrome/browser/importer/external_process_importer_client.cc
index cf98adb..930f72d 100644
--- a/chrome/browser/importer/external_process_importer_client.cc
+++ b/chrome/browser/importer/external_process_importer_client.cc
@@ -16,7 +16,7 @@
ExternalProcessImporterClient::ExternalProcessImporterClient(
ExternalProcessImporterHost* importer_host,
- const importer::ProfileInfo& profile_info,
+ const importer::SourceProfile& source_profile,
uint16 items,
InProcessImporterBridge* bridge,
bool import_to_bookmark_bar)
@@ -26,7 +26,7 @@ ExternalProcessImporterClient::ExternalProcessImporterClient(
total_favicons_count_(0),
process_importer_host_(importer_host),
profile_import_process_host_(NULL),
- profile_info_(profile_info),
+ source_profile_(source_profile),
items_(items),
import_to_bookmark_bar_(import_to_bookmark_bar),
bridge_(bridge),
@@ -79,7 +79,7 @@ void ExternalProcessImporterClient::StartImportProcessOnIOThread(
profile_import_process_host_ =
new ProfileImportProcessHost(this, thread_id);
profile_import_process_host_->StartProfileImportProcess(
- profile_info_, items_, import_to_bookmark_bar_);
+ source_profile_, items_, import_to_bookmark_bar_);
}
void ExternalProcessImporterClient::CancelImportProcessOnIOThread() {
diff --git a/chrome/browser/importer/external_process_importer_client.h b/chrome/browser/importer/external_process_importer_client.h
index 58ef0a1..6d5eeb6 100644
--- a/chrome/browser/importer/external_process_importer_client.h
+++ b/chrome/browser/importer/external_process_importer_client.h
@@ -26,17 +26,13 @@ class URLRow;
struct ImportedFaviconUsage;
}
-namespace importer {
-struct ProfileInfo;
-}
-
// This class is the client for the ProfileImportProcessHost. It collects
// notifications from this process host and feeds data back to the importer
// host, who actually does the writing.
class ExternalProcessImporterClient : public ProfileImportProcessClient {
public:
ExternalProcessImporterClient(ExternalProcessImporterHost* importer_host,
- const importer::ProfileInfo& profile_info,
+ const importer::SourceProfile& source_profile,
uint16 items,
InProcessImporterBridge* bridge,
bool import_to_bookmark_bar);
@@ -148,7 +144,7 @@ class ExternalProcessImporterClient : public ProfileImportProcessClient {
ProfileImportProcessHost* profile_import_process_host_;
// Data to be passed from the importer host to the external importer.
- const importer::ProfileInfo& profile_info_;
+ const importer::SourceProfile& source_profile_;
uint16 items_;
bool import_to_bookmark_bar_;
diff --git a/chrome/browser/importer/external_process_importer_host.cc b/chrome/browser/importer/external_process_importer_host.cc
index faeb371..5560405 100644
--- a/chrome/browser/importer/external_process_importer_host.cc
+++ b/chrome/browser/importer/external_process_importer_host.cc
@@ -23,7 +23,7 @@ void ExternalProcessImporterHost::Cancel() {
}
void ExternalProcessImporterHost::StartImportSettings(
- const importer::ProfileInfo& profile_info,
+ const importer::SourceProfile& source_profile,
Profile* target_profile,
uint16 items,
ProfileWriter* writer,
@@ -31,13 +31,13 @@ void ExternalProcessImporterHost::StartImportSettings(
DCHECK(!profile_);
profile_ = target_profile;
writer_ = writer;
- profile_info_ = &profile_info;
+ source_profile_ = &source_profile;
items_ = items;
ImporterHost::AddRef(); // Balanced in ImporterHost::NotifyImportEnded.
import_to_bookmark_bar_ = ShouldImportToBookmarkBar(first_run);
- CheckForFirefoxLock(profile_info, items, first_run);
+ CheckForFirefoxLock(source_profile, items, first_run);
CheckForLoadedModels(items);
InvokeTaskIfDone();
@@ -48,15 +48,15 @@ void ExternalProcessImporterHost::InvokeTaskIfDone() {
!is_source_readable_ || cancelled_)
return;
- // The in-process half of the bridge which catches data from the IPC pipe
- // and feeds it to the ProfileWriter. The external process half of the
- // bridge lives in the external process -- see ProfileImportThread.
- // The ExternalProcessImporterClient created in the next line owns this
- // bridge, and will delete it.
+ // This is the in-process half of the bridge, which catches data from the IPC
+ // pipe and feeds it to the ProfileWriter. The external process half of the
+ // bridge lives in the external process (see ProfileImportThread).
+ // The ExternalProcessImporterClient created in the next line owns the bridge,
+ // and will delete it.
InProcessImporterBridge* bridge =
new InProcessImporterBridge(writer_.get(), this);
- client_ = new ExternalProcessImporterClient(this, *profile_info_, items_,
- bridge, import_to_bookmark_bar_);
+ client_ = new ExternalProcessImporterClient(
+ this, *source_profile_, items_, bridge, import_to_bookmark_bar_);
import_process_launched_ = true;
client_->Start();
}
diff --git a/chrome/browser/importer/external_process_importer_host.h b/chrome/browser/importer/external_process_importer_host.h
index d47fea9..3184a5d 100644
--- a/chrome/browser/importer/external_process_importer_host.h
+++ b/chrome/browser/importer/external_process_importer_host.h
@@ -15,7 +15,7 @@ class Profile;
class ProfileWriter;
namespace importer {
-struct ProfileInfo;
+struct SourceProfile;
}
// This class manages the import process. It creates the in-process half of the
@@ -29,11 +29,12 @@ class ExternalProcessImporterHost : public ImporterHost {
private:
// ImporterHost:
- virtual void StartImportSettings(const importer::ProfileInfo& profile_info,
- Profile* target_profile,
- uint16 items,
- ProfileWriter* writer,
- bool first_run) OVERRIDE;
+ virtual void StartImportSettings(
+ const importer::SourceProfile& source_profile,
+ Profile* target_profile,
+ uint16 items,
+ ProfileWriter* writer,
+ bool first_run) OVERRIDE;
virtual void InvokeTaskIfDone() OVERRIDE;
virtual void Loaded(BookmarkModel* model) OVERRIDE;
@@ -41,9 +42,9 @@ class ExternalProcessImporterHost : public ImporterHost {
ExternalProcessImporterClient* client_;
// Information about a profile needed for importing.
- const importer::ProfileInfo* profile_info_;
+ const importer::SourceProfile* source_profile_;
- // Mask of items to be imported (see importer::ImportItem).
+ // Bitmask of items to be imported (see importer::ImportItem enum).
uint16 items_;
// Whether to import bookmarks to the bookmark bar.
diff --git a/chrome/browser/importer/firefox2_importer.cc b/chrome/browser/importer/firefox2_importer.cc
index 6a7ee80..8866f4d 100644
--- a/chrome/browser/importer/firefox2_importer.cc
+++ b/chrome/browser/importer/firefox2_importer.cc
@@ -47,15 +47,16 @@ Firefox2Importer::Firefox2Importer() : parsing_bookmarks_html_file_(false) {}
Firefox2Importer::~Firefox2Importer() {}
-void Firefox2Importer::StartImport(const importer::ProfileInfo& profile_info,
- uint16 items,
- ImporterBridge* bridge) {
+void Firefox2Importer::StartImport(
+ const importer::SourceProfile& source_profile,
+ uint16 items,
+ ImporterBridge* bridge) {
bridge_ = bridge;
- source_path_ = profile_info.source_path;
- app_path_ = profile_info.app_path;
+ source_path_ = source_profile.source_path;
+ app_path_ = source_profile.app_path;
parsing_bookmarks_html_file_ =
- (profile_info.importer_type == importer::BOOKMARKS_HTML);
+ (source_profile.importer_type == importer::BOOKMARKS_HTML);
// The order here is important!
bridge_->NotifyStarted();
diff --git a/chrome/browser/importer/firefox2_importer.h b/chrome/browser/importer/firefox2_importer.h
index 6fa1b27..86b68c2 100644
--- a/chrome/browser/importer/firefox2_importer.h
+++ b/chrome/browser/importer/firefox2_importer.h
@@ -14,7 +14,6 @@
#include "base/gtest_prod_util.h"
#include "base/string16.h"
#include "chrome/browser/importer/importer.h"
-#include "chrome/browser/importer/importer_data_types.h"
#include "chrome/browser/importer/profile_writer.h"
class GURL;
@@ -26,7 +25,7 @@ class Firefox2Importer : public Importer {
Firefox2Importer();
// Importer:
- virtual void StartImport(const importer::ProfileInfo& profile_info,
+ virtual void StartImport(const importer::SourceProfile& source_profile,
uint16 items,
ImporterBridge* bridge) OVERRIDE;
diff --git a/chrome/browser/importer/firefox3_importer.cc b/chrome/browser/importer/firefox3_importer.cc
index 4eb54d0..fc11cb0 100644
--- a/chrome/browser/importer/firefox3_importer.cc
+++ b/chrome/browser/importer/firefox3_importer.cc
@@ -27,6 +27,8 @@
#include "grit/generated_resources.h"
#include "webkit/glue/password_form.h"
+namespace {
+
// Original definition is in http://mxr.mozilla.org/firefox/source/toolkit/
// components/places/public/nsINavBookmarksService.idl
enum BookmarkItemType {
@@ -36,6 +38,8 @@ enum BookmarkItemType {
TYPE_DYNAMIC_CONTAINER = 4
};
+} // namespace
+
struct Firefox3Importer::BookmarkItem {
int parent;
int id;
@@ -58,15 +62,16 @@ Firefox3Importer::Firefox3Importer() {
Firefox3Importer::~Firefox3Importer() {
}
-void Firefox3Importer::StartImport(const importer::ProfileInfo& profile_info,
- uint16 items,
- ImporterBridge* bridge) {
+void Firefox3Importer::StartImport(
+ const importer::SourceProfile& source_profile,
+ uint16 items,
+ ImporterBridge* bridge) {
#if defined(OS_LINUX)
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
#endif
bridge_ = bridge;
- source_path_ = profile_info.source_path;
- app_path_ = profile_info.app_path;
+ source_path_ = source_profile.source_path;
+ app_path_ = source_profile.app_path;
// The order here is important!
bridge_->NotifyStarted();
diff --git a/chrome/browser/importer/firefox3_importer.h b/chrome/browser/importer/firefox3_importer.h
index ac374a4..cbf1690 100644
--- a/chrome/browser/importer/firefox3_importer.h
+++ b/chrome/browser/importer/firefox3_importer.h
@@ -14,9 +14,13 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/file_path.h"
-#include "chrome/browser/history/history_types.h"
#include "chrome/browser/importer/importer.h"
-#include "chrome/browser/importer/importer_data_types.h"
+
+class GURL;
+
+namespace history {
+struct ImportedFaviconUsage;
+}
namespace sql {
class Connection;
@@ -30,7 +34,7 @@ class Firefox3Importer : public Importer {
Firefox3Importer();
// Importer:
- virtual void StartImport(const importer::ProfileInfo& profile_info,
+ virtual void StartImport(const importer::SourceProfile& source_profile,
uint16 items,
ImporterBridge* bridge) OVERRIDE;
diff --git a/chrome/browser/importer/ie_importer.cc b/chrome/browser/importer/ie_importer.cc
index ceb4b93..d92ae2a 100644
--- a/chrome/browser/importer/ie_importer.cc
+++ b/chrome/browser/importer/ie_importer.cc
@@ -82,11 +82,11 @@ const GUID IEImporter::kUnittestGUID = {
IEImporter::IEImporter() {
}
-void IEImporter::StartImport(const importer::ProfileInfo& profile_info,
+void IEImporter::StartImport(const importer::SourceProfile& source_profile,
uint16 items,
ImporterBridge* bridge) {
bridge_ = bridge;
- source_path_ = profile_info.source_path;
+ source_path_ = source_profile.source_path;
bridge_->NotifyStarted();
diff --git a/chrome/browser/importer/ie_importer.h b/chrome/browser/importer/ie_importer.h
index 17806bd..72be567 100644
--- a/chrome/browser/importer/ie_importer.h
+++ b/chrome/browser/importer/ie_importer.h
@@ -21,7 +21,7 @@ class IEImporter : public Importer {
IEImporter();
// Importer:
- virtual void StartImport(const importer::ProfileInfo& browser_info,
+ virtual void StartImport(const importer::SourceProfile& source_profile,
uint16 items,
ImporterBridge* bridge) OVERRIDE;
diff --git a/chrome/browser/importer/importer.h b/chrome/browser/importer/importer.h
index 618dfd4..d6f0ff8 100644
--- a/chrome/browser/importer/importer.h
+++ b/chrome/browser/importer/importer.h
@@ -14,7 +14,7 @@
class ImporterBridge;
namespace importer {
-struct ProfileInfo;
+struct SourceProfile;
}
// The base class of all importers.
@@ -24,7 +24,7 @@ class Importer : public base::RefCountedThreadSafe<Importer> {
// And it will be run in file thread by ImporterHost. Since we do async
// import, the importer should invoke ImporterHost::NotifyImportEnded() to
// notify its host that import stuff have been finished.
- virtual void StartImport(const importer::ProfileInfo& profile_info,
+ virtual void StartImport(const importer::SourceProfile& source_profile,
uint16 items,
ImporterBridge* bridge) = 0;
diff --git a/chrome/browser/importer/importer_data_types.cc b/chrome/browser/importer/importer_data_types.cc
index fc1a50a..e9c7305 100644
--- a/chrome/browser/importer/importer_data_types.cc
+++ b/chrome/browser/importer/importer_data_types.cc
@@ -6,12 +6,12 @@
namespace importer {
-ProfileInfo::ProfileInfo()
+SourceProfile::SourceProfile()
: importer_type(NONE_IMPORTER),
services_supported(0) {
}
-ProfileInfo::~ProfileInfo() {
+SourceProfile::~SourceProfile() {
}
} // namespace importer
diff --git a/chrome/browser/importer/importer_data_types.h b/chrome/browser/importer/importer_data_types.h
index 504574b..6540f04 100644
--- a/chrome/browser/importer/importer_data_types.h
+++ b/chrome/browser/importer/importer_data_types.h
@@ -13,8 +13,7 @@
#include "base/string16.h"
#include "chrome/browser/importer/importer_type.h"
-// Types needed for importing data from other browsers and the Google
-// Toolbar.
+// 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.
@@ -30,9 +29,9 @@ enum ImportItem {
};
// Information about a profile needed by an importer to do import work.
-struct ProfileInfo {
- ProfileInfo();
- ~ProfileInfo();
+struct SourceProfile {
+ SourceProfile();
+ ~SourceProfile();
string16 description;
ImporterType importer_type;
diff --git a/chrome/browser/importer/importer_host.cc b/chrome/browser/importer/importer_host.cc
index 1bc07b1..c81094c 100644
--- a/chrome/browser/importer/importer_host.cc
+++ b/chrome/browser/importer/importer_host.cc
@@ -96,7 +96,7 @@ void ImporterHost::NotifyImportEnded() {
}
void ImporterHost::StartImportSettings(
- const importer::ProfileInfo& profile_info,
+ const importer::SourceProfile& source_profile,
Profile* target_profile,
uint16 items,
ProfileWriter* writer,
@@ -109,7 +109,7 @@ void ImporterHost::StartImportSettings(
// it doesn't block the UI. When the import is complete, observer will be
// notified.
writer_ = writer;
- importer_ = importer::CreateImporterByType(profile_info.importer_type);
+ importer_ = importer::CreateImporterByType(source_profile.importer_type);
// If we fail to create the Importer, exit, as we cannot do anything.
if (!importer_) {
NotifyImportEnded();
@@ -117,20 +117,20 @@ void ImporterHost::StartImportSettings(
}
importer_->AddRef();
-
importer_->set_import_to_bookmark_bar(ShouldImportToBookmarkBar(first_run));
importer_->set_bookmark_bar_disabled(first_run);
+
scoped_refptr<InProcessImporterBridge> bridge(
new InProcessImporterBridge(writer_.get(), this));
task_ = NewRunnableMethod(
- importer_, &Importer::StartImport, profile_info, items, bridge);
+ importer_, &Importer::StartImport, source_profile, items, bridge);
- CheckForFirefoxLock(profile_info, items, first_run);
+ CheckForFirefoxLock(source_profile, items, first_run);
#if defined(OS_WIN)
// For google toolbar import, we need the user to log in and store their GAIA
// credentials.
- if (profile_info.importer_type == importer::GOOGLE_TOOLBAR5) {
+ if (source_profile.importer_type == importer::GOOGLE_TOOLBAR5) {
if (!toolbar_importer_utils::IsGoogleGAIACookieInstalled()) {
ui::MessageBox(
NULL,
@@ -181,11 +181,13 @@ bool ImporterHost::ShouldImportToBookmarkBar(bool first_run) {
}
void ImporterHost::CheckForFirefoxLock(
- const importer::ProfileInfo& profile_info, uint16 items, bool first_run) {
- if (profile_info.importer_type == importer::FIREFOX2 ||
- profile_info.importer_type == importer::FIREFOX3) {
+ const importer::SourceProfile& source_profile,
+ uint16 items,
+ bool first_run) {
+ if (source_profile.importer_type == importer::FIREFOX2 ||
+ source_profile.importer_type == importer::FIREFOX3) {
DCHECK(!firefox_lock_.get());
- firefox_lock_.reset(new FirefoxProfileLock(profile_info.source_path));
+ firefox_lock_.reset(new FirefoxProfileLock(source_profile.source_path));
if (!firefox_lock_->HasAcquired()) {
// If fail to acquire the lock, we set the source unreadable and
// show a warning dialog, unless running without UI.
diff --git a/chrome/browser/importer/importer_host.h b/chrome/browser/importer/importer_host.h
index 1c80455..bb3ad0b 100644
--- a/chrome/browser/importer/importer_host.h
+++ b/chrome/browser/importer/importer_host.h
@@ -65,16 +65,17 @@ class ImporterHost : public base::RefCountedThreadSafe<ImporterHost>,
// Starts the process of importing the settings and data depending on what the
// user selected.
- // |profile_info| - browser profile to import.
+ // |source_profile| - importer profile to import.
// |target_profile| - profile to import into.
// |items| - specifies which data to import (bitmask of importer::ImportItem).
// |writer| - called to actually write data back to the profile.
// |first_run| - true if this method is being called during first run.
- virtual void StartImportSettings(const importer::ProfileInfo& profile_info,
- Profile* target_profile,
- uint16 items,
- ProfileWriter* writer,
- bool first_run);
+ virtual void StartImportSettings(
+ const importer::SourceProfile& source_profile,
+ Profile* target_profile,
+ uint16 items,
+ ProfileWriter* writer,
+ bool first_run);
// Cancels the import process.
virtual void Cancel();
@@ -88,10 +89,10 @@ class ImporterHost : public base::RefCountedThreadSafe<ImporterHost>,
// Make sure that Firefox isn't running, if import browser is Firefox. Show
// to the user a dialog that notifies that is necessary to close Firefox
// prior to continue.
- // |profile_info| - browser profile to import.
+ // |source_profile| - importer profile to import.
// |items| - specifies which data to import (bitmask of importer::ImportItem).
// |first_run| - true if this method is being called during first run.
- void CheckForFirefoxLock(const importer::ProfileInfo& profile_info,
+ void CheckForFirefoxLock(const importer::SourceProfile& source_profile,
uint16 items,
bool first_run);
diff --git a/chrome/browser/importer/importer_list.cc b/chrome/browser/importer/importer_list.cc
index 84805ca..78e306a 100644
--- a/chrome/browser/importer/importer_list.cc
+++ b/chrome/browser/importer/importer_list.cc
@@ -6,6 +6,7 @@
#include "chrome/browser/first_run/first_run.h"
#include "chrome/browser/importer/firefox_importer_utils.h"
+#include "chrome/browser/importer/importer_data_types.h"
#include "chrome/browser/importer/importer_bridge.h"
#include "chrome/browser/shell_integration.h"
#include "grit/generated_resources.h"
@@ -19,9 +20,9 @@
namespace {
#if defined(OS_WIN)
-void DetectIEProfiles(std::vector<importer::ProfileInfo*>* profiles) {
+void DetectIEProfiles(std::vector<importer::SourceProfile*>* profiles) {
// IE always exists and doesn't have multiple profiles.
- importer::ProfileInfo* ie = new importer::ProfileInfo();
+ importer::SourceProfile* ie = new importer::SourceProfile();
ie->description = l10n_util::GetStringUTF16(IDS_IMPORT_FROM_IE);
ie->importer_type = importer::MS_IE;
ie->source_path.clear();
@@ -33,14 +34,14 @@ void DetectIEProfiles(std::vector<importer::ProfileInfo*>* profiles) {
#endif // defined(OS_WIN)
#if defined(OS_MACOSX)
-void DetectSafariProfiles(std::vector<importer::ProfileInfo*>* profiles) {
+void DetectSafariProfiles(std::vector<importer::SourceProfile*>* profiles) {
uint16 items = importer::NONE;
if (!SafariImporter::CanImport(base::mac::GetUserLibraryPath(), &items))
return;
- importer::ProfileInfo* safari = new importer::ProfileInfo();
- safari->importer_type = importer::SAFARI;
+ importer::SourceProfile* safari = new importer::SourceProfile();
safari->description = l10n_util::GetStringUTF16(IDS_IMPORT_FROM_SAFARI);
+ safari->importer_type = importer::SAFARI;
safari->source_path.clear();
safari->app_path.clear();
safari->services_supported = items;
@@ -48,7 +49,7 @@ void DetectSafariProfiles(std::vector<importer::ProfileInfo*>* profiles) {
}
#endif // defined(OS_MACOSX)
-void DetectFirefoxProfiles(std::vector<importer::ProfileInfo*>* profiles) {
+void DetectFirefoxProfiles(std::vector<importer::SourceProfile*>* profiles) {
FilePath profile_path = GetFirefoxProfilePath();
if (profile_path.empty())
return;
@@ -72,7 +73,7 @@ void DetectFirefoxProfiles(std::vector<importer::ProfileInfo*>* profiles) {
return;
}
- importer::ProfileInfo* firefox = new importer::ProfileInfo();
+ importer::SourceProfile* firefox = new importer::SourceProfile();
firefox->description = l10n_util::GetStringUTF16(IDS_IMPORT_FROM_FIREFOX);
firefox->importer_type = firefox_type;
firefox->source_path = profile_path;
@@ -88,14 +89,14 @@ void DetectFirefoxProfiles(std::vector<importer::ProfileInfo*>* profiles) {
}
void DetectGoogleToolbarProfiles(
- std::vector<importer::ProfileInfo*>* profiles) {
+ std::vector<importer::SourceProfile*>* profiles) {
if (FirstRun::IsChromeFirstRun())
return;
- importer::ProfileInfo* google_toolbar = new importer::ProfileInfo();
- google_toolbar->importer_type = importer::GOOGLE_TOOLBAR5;
+ importer::SourceProfile* google_toolbar = new importer::SourceProfile();
google_toolbar->description =
l10n_util::GetStringUTF16(IDS_IMPORT_FROM_GOOGLE_TOOLBAR);
+ google_toolbar->importer_type = importer::GOOGLE_TOOLBAR5;
google_toolbar->source_path.clear();
google_toolbar->app_path.clear();
google_toolbar->services_supported = importer::FAVORITES;
@@ -142,18 +143,18 @@ int ImporterList::GetAvailableProfileCount() const {
string16 ImporterList::GetSourceProfileNameAt(int index) const {
DCHECK(source_profiles_loaded_);
- DCHECK(index >=0 && index < GetAvailableProfileCount());
+ DCHECK(index >= 0 && index < GetAvailableProfileCount());
return source_profiles_[index]->description;
}
-const importer::ProfileInfo& ImporterList::GetSourceProfileInfoAt(
+const importer::SourceProfile& ImporterList::GetSourceProfileAt(
int index) const {
DCHECK(source_profiles_loaded_);
- DCHECK(index >=0 && index < GetAvailableProfileCount());
+ DCHECK(index >= 0 && index < GetAvailableProfileCount());
return *source_profiles_[index];
}
-const importer::ProfileInfo& ImporterList::GetSourceProfileInfoForImporterType(
+const importer::SourceProfile& ImporterList::GetSourceProfileForImporterType(
int importer_type) const {
DCHECK(source_profiles_loaded_);
@@ -163,7 +164,7 @@ const importer::ProfileInfo& ImporterList::GetSourceProfileInfoForImporterType(
return *source_profiles_[i];
}
NOTREACHED();
- return *(new importer::ProfileInfo());
+ return *(new importer::SourceProfile());
}
bool ImporterList::source_profiles_loaded() const {
@@ -176,7 +177,7 @@ void ImporterList::DetectSourceProfilesWorker() {
if (is_observed_)
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
- std::vector<importer::ProfileInfo*> profiles;
+ std::vector<importer::SourceProfile*> profiles;
// The first run import will automatically take settings from the first
// profile detected, which should be the user's current default.
@@ -216,7 +217,7 @@ void ImporterList::DetectSourceProfilesWorker() {
}
void ImporterList::SourceProfilesLoaded(
- const std::vector<importer::ProfileInfo*>& profiles) {
+ const std::vector<importer::SourceProfile*>& profiles) {
// |observer_| may be NULL if it removed itself before being notified.
if (!observer_)
return;
diff --git a/chrome/browser/importer/importer_list.h b/chrome/browser/importer/importer_list.h
index d4efc64..839d63f 100644
--- a/chrome/browser/importer/importer_list.h
+++ b/chrome/browser/importer/importer_list.h
@@ -13,9 +13,12 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_vector.h"
#include "build/build_config.h"
-#include "chrome/browser/importer/importer_data_types.h"
#include "content/browser/browser_thread.h"
+namespace importer {
+struct SourceProfile;
+}
+
class ImporterList : public base::RefCountedThreadSafe<ImporterList> {
public:
// Any class calling DetectSourceProfiles() must implement this interface in
@@ -53,12 +56,12 @@ class ImporterList : public base::RefCountedThreadSafe<ImporterList> {
// that the profile at index 0 is the likely default browser.
string16 GetSourceProfileNameAt(int index) const;
- // Returns the ProfileInfo at |index|. The ProfileInfo should be
- // passed to StartImportSettings().
- const importer::ProfileInfo& GetSourceProfileInfoAt(int index) const;
+ // Returns the SourceProfile at |index|. The SourceProfile should be passed to
+ // ImporterHost::StartImportSettings().
+ const importer::SourceProfile& GetSourceProfileAt(int index) const;
- // Returns the ProfileInfo with the given |importer_type|.
- const importer::ProfileInfo& GetSourceProfileInfoForImporterType(
+ // Returns the SourceProfile for the given |importer_type|.
+ const importer::SourceProfile& GetSourceProfileForImporterType(
int importer_type) const;
// Returns true if the source profiles have been loaded.
@@ -77,10 +80,10 @@ class ImporterList : public base::RefCountedThreadSafe<ImporterList> {
// notifies |observer_| that the source profiles are loaded. |profiles| is
// the vector of loaded profiles.
void SourceProfilesLoaded(
- const std::vector<importer::ProfileInfo*>& profiles);
+ const std::vector<importer::SourceProfile*>& profiles);
// The list of profiles with the default one first.
- ScopedVector<importer::ProfileInfo> source_profiles_;
+ ScopedVector<importer::SourceProfile> source_profiles_;
// The ID of the thread DetectSourceProfiles() is called on. Only valid after
// DetectSourceProfiles() is called and until SourceProfilesLoaded() has
diff --git a/chrome/browser/importer/importer_progress_dialog.h b/chrome/browser/importer/importer_progress_dialog.h
index d11df70..5d74f3c 100644
--- a/chrome/browser/importer/importer_progress_dialog.h
+++ b/chrome/browser/importer/importer_progress_dialog.h
@@ -14,7 +14,7 @@ class Profile;
namespace importer {
-struct ProfileInfo;
+struct SourceProfile;
// Shows an UI for importing and begins importing the specified |items| from
// |source_profile| to |target_profile|. |importer_observer| is notified when
@@ -25,7 +25,7 @@ void ShowImportProgressDialog(gfx::NativeWindow parent_window,
uint16 items,
ImporterHost* importer_host,
ImporterObserver* importer_observer,
- const ProfileInfo& source_profile,
+ const SourceProfile& source_profile,
Profile* target_profile,
bool first_run);
diff --git a/chrome/browser/importer/importer_unittest.cc b/chrome/browser/importer/importer_unittest.cc
index 4a403a8..30769f2 100644
--- a/chrome/browser/importer/importer_unittest.cc
+++ b/chrome/browser/importer/importer_unittest.cc
@@ -102,17 +102,17 @@ class ImporterTest : public testing::Test {
}
MessageLoop* loop = MessageLoop::current();
- importer::ProfileInfo profile_info;
- profile_info.importer_type = importer::FIREFOX3;
- profile_info.app_path = app_path_;
- profile_info.source_path = profile_path_;
+ importer::SourceProfile source_profile;
+ source_profile.importer_type = importer::FIREFOX3;
+ source_profile.app_path = app_path_;
+ source_profile.source_path = profile_path_;
scoped_refptr<ImporterHost> host(new ImporterHost);
host->SetObserver(observer);
int items = importer::HISTORY | importer::PASSWORDS | importer::FAVORITES;
if (import_search_plugins)
items = items | importer::SEARCH_ENGINES;
loop->PostTask(FROM_HERE, NewRunnableMethod(host.get(),
- &ImporterHost::StartImportSettings, profile_info,
+ &ImporterHost::StartImportSettings, source_profile,
static_cast<Profile*>(NULL), items, make_scoped_refptr(writer), true));
loop->Run();
}
@@ -395,13 +395,13 @@ TEST_F(ImporterTest, IEImporter) {
TestObserver* observer = new TestObserver();
host->SetObserver(observer);
- importer::ProfileInfo profile_info;
- profile_info.importer_type = importer::MS_IE;
- profile_info.source_path = test_path_;
+ importer::SourceProfile source_profile;
+ source_profile.importer_type = importer::MS_IE;
+ source_profile.source_path = test_path_;
loop->PostTask(FROM_HERE, NewRunnableMethod(host.get(),
&ImporterHost::StartImportSettings,
- profile_info,
+ source_profile,
static_cast<Profile*>(NULL),
importer::HISTORY | importer::PASSWORDS | importer::FAVORITES,
observer,
@@ -689,15 +689,15 @@ TEST_F(ImporterTest, MAYBE(Firefox2Importer)) {
scoped_refptr<ImporterHost> host(new ImporterHost);
FirefoxObserver* observer = new FirefoxObserver();
host->SetObserver(observer);
- importer::ProfileInfo profile_info;
- profile_info.importer_type = importer::FIREFOX2;
- profile_info.app_path = app_path_;
- profile_info.source_path = profile_path_;
+ importer::SourceProfile source_profile;
+ source_profile.importer_type = importer::FIREFOX2;
+ source_profile.app_path = app_path_;
+ source_profile.source_path = profile_path_;
loop->PostTask(FROM_HERE, NewRunnableMethod(
host.get(),
&ImporterHost::StartImportSettings,
- profile_info,
+ source_profile,
static_cast<Profile*>(NULL),
importer::HISTORY | importer::PASSWORDS |
importer::FAVORITES | importer::SEARCH_ENGINES,
diff --git a/chrome/browser/importer/profile_import_process_host.cc b/chrome/browser/importer/profile_import_process_host.cc
index 71d0df0..3ef00bf 100644
--- a/chrome/browser/importer/profile_import_process_host.cc
+++ b/chrome/browser/importer/profile_import_process_host.cc
@@ -28,7 +28,8 @@ ProfileImportProcessHost::~ProfileImportProcessHost() {
}
bool ProfileImportProcessHost::StartProfileImportProcess(
- const importer::ProfileInfo& profile_info, int items,
+ const importer::SourceProfile& source_profile,
+ uint16 items,
bool import_to_bookmark_bar) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
if (!StartProcess())
@@ -54,7 +55,7 @@ bool ProfileImportProcessHost::StartProfileImportProcess(
l10n_util::GetStringUTF8(IDS_IMPORT_FROM_SAFARI));
Send(new ProfileImportProcessMsg_StartImport(
- profile_info, items, localized_strings, import_to_bookmark_bar));
+ source_profile, items, localized_strings, import_to_bookmark_bar));
return true;
}
diff --git a/chrome/browser/importer/profile_import_process_host.h b/chrome/browser/importer/profile_import_process_host.h
index 6004197..d8656ab 100644
--- a/chrome/browser/importer/profile_import_process_host.h
+++ b/chrome/browser/importer/profile_import_process_host.h
@@ -12,7 +12,6 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
-#include "chrome/browser/history/history_types.h"
#include "chrome/browser/importer/importer_data_types.h"
#include "chrome/browser/importer/profile_writer.h"
#include "content/browser/browser_child_process_host.h"
@@ -39,10 +38,10 @@ class ProfileImportProcessHost : public BrowserChildProcessHost {
BrowserThread::ID thread_id);
virtual ~ProfileImportProcessHost();
- // |profile_info|, |items|, and |import_to_bookmark_bar| are all needed by
+ // |source_profile|, |items|, and |import_to_bookmark_bar| are all needed by
// the external importer process.
- bool StartProfileImportProcess(const importer::ProfileInfo& profile_info,
- int items,
+ bool StartProfileImportProcess(const importer::SourceProfile& source_profile,
+ uint16 items,
bool import_to_bookmark_bar);
// Cancel the external import process.
diff --git a/chrome/browser/importer/profile_import_process_messages.h b/chrome/browser/importer/profile_import_process_messages.h
index ff86644..5f30d7c 100644
--- a/chrome/browser/importer/profile_import_process_messages.h
+++ b/chrome/browser/importer/profile_import_process_messages.h
@@ -23,10 +23,10 @@
namespace IPC {
-// Traits for importer::ProfileInfo struct to pack/unpack.
+// Traits for importer::SourceProfile struct to pack/unpack.
template <>
-struct ParamTraits<importer::ProfileInfo> {
- typedef importer::ProfileInfo param_type;
+struct ParamTraits<importer::SourceProfile> {
+ typedef importer::SourceProfile param_type;
static void Write(Message* m, const param_type& p) {
WriteParam(m, p.description);
WriteParam(m, static_cast<int>(p.importer_type));
@@ -67,7 +67,7 @@ struct ParamTraits<importer::ProfileInfo> {
LogParam(static_cast<int>(p.services_supported), l);
l->append(")");
}
-}; // ParamTraits<importer::ProfileInfo>
+}; // ParamTraits<importer::SourceProfile>
// Traits for history::URLRow to pack/unpack.
template <>
@@ -373,10 +373,10 @@ struct ParamTraits<TemplateURL> {
// ProfileImportProcess messages
// These are messages sent from the browser to the profile import process.
IPC_MESSAGE_CONTROL4(ProfileImportProcessMsg_StartImport,
- importer::ProfileInfo /* ProfileInfo struct */,
- int /* bitmask of items to import */,
- DictionaryValue /* localized strings */,
- bool /* import to bookmark bar */)
+ importer::SourceProfile,
+ int /* Bitmask of items to import. */,
+ DictionaryValue /* Localized strings. */,
+ bool /* Import to bookmark bar. */)
IPC_MESSAGE_CONTROL0(ProfileImportProcessMsg_CancelImport)
diff --git a/chrome/browser/importer/safari_importer.h b/chrome/browser/importer/safari_importer.h
index c30253f..47dfd92 100644
--- a/chrome/browser/importer/safari_importer.h
+++ b/chrome/browser/importer/safari_importer.h
@@ -14,11 +14,8 @@
#include "base/compiler_specific.h"
#include "base/file_path.h"
#include "base/gtest_prod_util.h"
-#include "chrome/browser/history/history_types.h"
#include "chrome/browser/importer/importer.h"
-#include "chrome/browser/importer/importer_data_types.h"
#include "chrome/browser/importer/profile_writer.h"
-#include "googleurl/src/gurl.h"
#if __OBJC__
@class NSDictionary;
@@ -28,6 +25,13 @@ class NSDictionary;
class NSString;
#endif
+class GURL;
+
+namespace history {
+class URLRow;
+struct ImportedFaviconUsage;
+}
+
namespace sql {
class Connection;
}
@@ -40,7 +44,7 @@ class SafariImporter : public Importer {
explicit SafariImporter(const FilePath& library_dir);
// Importer:
- virtual void StartImport(const importer::ProfileInfo& profile_info,
+ virtual void StartImport(const importer::SourceProfile& source_profile,
uint16 items,
ImporterBridge* bridge) OVERRIDE;
@@ -48,8 +52,8 @@ class SafariImporter : public Importer {
// are supported?
// in: library_dir - ~/Library or a standin for testing purposes.
// out: services_supported - the service supported for import.
- // returns true if we can import the Safari profile.
- static bool CanImport(const FilePath& library_dir, uint16 *services_supported);
+ // Returns true if we can import the Safari profile.
+ static bool CanImport(const FilePath& library_dir, uint16* services_supported);
private:
FRIEND_TEST_ALL_PREFIXES(SafariImporterTest, BookmarkImport);
diff --git a/chrome/browser/importer/safari_importer.mm b/chrome/browser/importer/safari_importer.mm
index 8a88fe8..8c5f5a7 100644
--- a/chrome/browser/importer/safari_importer.mm
+++ b/chrome/browser/importer/safari_importer.mm
@@ -49,7 +49,7 @@ SafariImporter::~SafariImporter() {
// static
bool SafariImporter::CanImport(const FilePath& library_dir,
- uint16 *services_supported) {
+ uint16* services_supported) {
DCHECK(services_supported);
*services_supported = importer::NONE;
@@ -68,26 +68,27 @@ bool SafariImporter::CanImport(const FilePath& library_dir,
return *services_supported != importer::NONE;
}
-void SafariImporter::StartImport(const importer::ProfileInfo& profile_info,
- uint16 services_supported,
+void SafariImporter::StartImport(const importer::SourceProfile& source_profile,
+ uint16 items,
ImporterBridge* bridge) {
bridge_ = bridge;
// The order here is important!
bridge_->NotifyStarted();
+
// In keeping with import on other platforms (and for other browsers), we
// don't import the home page (since it may lead to a useless homepage); see
// crbug.com/25603.
- if ((services_supported & importer::HISTORY) && !cancelled()) {
+ if ((items & importer::HISTORY) && !cancelled()) {
bridge_->NotifyItemStarted(importer::HISTORY);
ImportHistory();
bridge_->NotifyItemEnded(importer::HISTORY);
}
- if ((services_supported & importer::FAVORITES) && !cancelled()) {
+ if ((items & importer::FAVORITES) && !cancelled()) {
bridge_->NotifyItemStarted(importer::FAVORITES);
ImportBookmarks();
bridge_->NotifyItemEnded(importer::FAVORITES);
}
- if ((services_supported & importer::PASSWORDS) && !cancelled()) {
+ if ((items & importer::PASSWORDS) && !cancelled()) {
bridge_->NotifyItemStarted(importer::PASSWORDS);
ImportPasswords();
bridge_->NotifyItemEnded(importer::PASSWORDS);
diff --git a/chrome/browser/importer/toolbar_importer.cc b/chrome/browser/importer/toolbar_importer.cc
index 6c1bd0e..b3e6d4b 100644
--- a/chrome/browser/importer/toolbar_importer.cc
+++ b/chrome/browser/importer/toolbar_importer.cc
@@ -12,6 +12,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/first_run/first_run.h"
#include "chrome/browser/importer/importer_bridge.h"
+#include "chrome/browser/importer/importer_data_types.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/libxml_utils.h"
#include "content/browser/browser_thread.h"
@@ -57,9 +58,10 @@ Toolbar5Importer::~Toolbar5Importer() {
DCHECK(!data_fetcher_);
}
-void Toolbar5Importer::StartImport(const importer::ProfileInfo& profile_info,
- uint16 items,
- ImporterBridge* bridge) {
+void Toolbar5Importer::StartImport(
+ const importer::SourceProfile& source_profile,
+ uint16 items,
+ ImporterBridge* bridge) {
DCHECK(bridge);
bridge_ = bridge;
diff --git a/chrome/browser/importer/toolbar_importer.h b/chrome/browser/importer/toolbar_importer.h
index 203469a..6acab81 100644
--- a/chrome/browser/importer/toolbar_importer.h
+++ b/chrome/browser/importer/toolbar_importer.h
@@ -17,7 +17,6 @@
#include "base/gtest_prod_util.h"
#include "base/string16.h"
#include "chrome/browser/importer/importer.h"
-#include "chrome/browser/importer/importer_data_types.h"
#include "chrome/browser/importer/profile_writer.h"
#include "chrome/common/net/url_fetcher.h"
@@ -27,9 +26,9 @@ class XmlReader;
// Toolbar5Importer is a class which exposes the functionality needed to
// communicate with the Google Toolbar v5 front-end, negotiate the download of
// Toolbar bookmarks, parse them, and install them on the client.
-// Toolbar5Importer should not have StartImport called more than once. Futher
-// if StartImport is called, then the class must not be destroyed until it
-// has either completed or Toolbar5Importer->Cancel() has been called.
+// Toolbar5Importer should not have StartImport called more than once. Futher
+// if StartImport is called, then the class must not be destroyed until it has
+// either completed or Toolbar5Importer->Cancel() has been called.
class Toolbar5Importer : public URLFetcher::Delegate, public Importer {
public:
Toolbar5Importer();
@@ -39,7 +38,7 @@ class Toolbar5Importer : public URLFetcher::Delegate, public Importer {
// This method is called to begin the import process. |items| should only
// either be NONE or FAVORITES, since as of right now these are the only
// items this importer supports.
- virtual void StartImport(const importer::ProfileInfo& profile_info,
+ virtual void StartImport(const importer::SourceProfile& source_profile,
uint16 items,
ImporterBridge* bridge) OVERRIDE;
@@ -154,11 +153,10 @@ class Toolbar5Importer : public URLFetcher::Delegate, public Importer {
void AddBookmarksToChrome(
const std::vector<ProfileWriter::BookmarkEntry>& bookmarks);
- // Internal state is stored in state_.
InternalStateEnum state_;
- // Bitmask of Importer::ImportItem is stored in items_to_import_.
- uint16 items_to_import_;
+ // Bitmask of Importer::ImportItem.
+ uint16 items_to_import_;
// The fetchers need to be available to cancel the network call on user cancel
// hence they are stored as member variables.
diff --git a/chrome/browser/ui/cocoa/importer/import_progress_dialog_cocoa.mm b/chrome/browser/ui/cocoa/importer/import_progress_dialog_cocoa.mm
index c3a7e9c..e0bc0d2 100644
--- a/chrome/browser/ui/cocoa/importer/import_progress_dialog_cocoa.mm
+++ b/chrome/browser/ui/cocoa/importer/import_progress_dialog_cocoa.mm
@@ -183,7 +183,7 @@ void ShowImportProgressDialog(gfx::NativeWindow parent_window,
uint16 items,
ImporterHost* importer_host,
ImporterObserver* importer_observer,
- const ProfileInfo& source_profile,
+ const SourceProfile& source_profile,
Profile* target_profile,
bool first_run) {
DCHECK(items != 0);
diff --git a/chrome/browser/ui/gtk/importer/import_progress_dialog_gtk.cc b/chrome/browser/ui/gtk/importer/import_progress_dialog_gtk.cc
index 61b8d19..f47d58b 100644
--- a/chrome/browser/ui/gtk/importer/import_progress_dialog_gtk.cc
+++ b/chrome/browser/ui/gtk/importer/import_progress_dialog_gtk.cc
@@ -37,7 +37,7 @@ void ImportProgressDialogGtk::StartImport(
uint16 items,
ImporterHost* importer_host,
ImporterObserver* importer_observer,
- const importer::ProfileInfo& browser_profile,
+ const importer::SourceProfile& source_profile,
Profile* profile,
bool first_run) {
ImportProgressDialogGtk* dialog = new ImportProgressDialogGtk(
@@ -45,8 +45,8 @@ void ImportProgressDialogGtk::StartImport(
items,
importer_host,
importer_observer,
- browser_profile.description,
- browser_profile.importer_type == importer::BOOKMARKS_HTML);
+ source_profile.description,
+ source_profile.importer_type == importer::BOOKMARKS_HTML);
// In headless mode it means that we don't show the progress window, but it
// still need it to exist. No user interaction will be required.
@@ -54,7 +54,7 @@ void ImportProgressDialogGtk::StartImport(
dialog->ShowDialog();
importer_host->StartImportSettings(
- browser_profile, profile, items, new ProfileWriter(profile), first_run);
+ source_profile, profile, items, new ProfileWriter(profile), first_run);
}
ImportProgressDialogGtk::ImportProgressDialogGtk(
@@ -221,12 +221,12 @@ void ShowImportProgressDialog(GtkWindow* parent,
uint16 items,
ImporterHost* importer_host,
ImporterObserver* importer_observer,
- const ProfileInfo& browser_profile,
+ const SourceProfile& source_profile,
Profile* profile,
bool first_run) {
DCHECK_NE(0, items);
ImportProgressDialogGtk::StartImport(
- parent, items, importer_host, importer_observer, browser_profile, profile,
+ parent, items, importer_host, importer_observer, source_profile, profile,
first_run);
}
diff --git a/chrome/browser/ui/gtk/importer/import_progress_dialog_gtk.h b/chrome/browser/ui/gtk/importer/import_progress_dialog_gtk.h
index 5996cc5..eeb2b9d 100644
--- a/chrome/browser/ui/gtk/importer/import_progress_dialog_gtk.h
+++ b/chrome/browser/ui/gtk/importer/import_progress_dialog_gtk.h
@@ -22,12 +22,12 @@ typedef struct _GtkWindow GtkWindow;
class ImportProgressDialogGtk : public importer::ImporterProgressObserver {
public:
- // Displays the import progress dialog box and starts the import.
+ // Displays the import progress dialog box and starts the import process.
static void StartImport(GtkWindow* parent,
uint16 items,
ImporterHost* importer_host,
ImporterObserver* importer_observer,
- const importer::ProfileInfo& browser_profile,
+ const importer::SourceProfile& source_profile,
Profile* profile,
bool first_run);
diff --git a/chrome/browser/ui/views/importer/import_progress_dialog_view.cc b/chrome/browser/ui/views/importer/import_progress_dialog_view.cc
index c9a9fb7..c0d9845 100644
--- a/chrome/browser/ui/views/importer/import_progress_dialog_view.cc
+++ b/chrome/browser/ui/views/importer/import_progress_dialog_view.cc
@@ -286,7 +286,7 @@ void ShowImportProgressDialog(HWND parent_window,
uint16 items,
ImporterHost* importer_host,
ImporterObserver* importer_observer,
- const ProfileInfo& source_profile,
+ const SourceProfile& source_profile,
Profile* target_profile,
bool first_run) {
DCHECK(items != 0);
diff --git a/chrome/browser/ui/webui/options/import_data_handler.cc b/chrome/browser/ui/webui/options/import_data_handler.cc
index b37f3c2..df2b9f5 100644
--- a/chrome/browser/ui/webui/options/import_data_handler.cc
+++ b/chrome/browser/ui/webui/options/import_data_handler.cc
@@ -88,8 +88,8 @@ void ImportDataHandler::ImportData(const ListValue* args) {
selected_items |= importer::SEARCH_ENGINES;
}
- const importer::ProfileInfo& source_profile =
- importer_list_->GetSourceProfileInfoAt(browser_index);
+ const importer::SourceProfile& source_profile =
+ importer_list_->GetSourceProfileAt(browser_index);
uint16 supported_items = source_profile.services_supported;
uint16 import_services = (selected_items & supported_items);
@@ -122,8 +122,8 @@ void ImportDataHandler::SourceProfilesLoaded() {
ListValue browser_profiles;
int profiles_count = importer_list_->GetAvailableProfileCount();
for (int i = 0; i < profiles_count; i++) {
- const importer::ProfileInfo& source_profile =
- importer_list_->GetSourceProfileInfoAt(i);
+ const importer::SourceProfile& source_profile =
+ importer_list_->GetSourceProfileAt(i);
uint16 browser_services = source_profile.services_supported;
DictionaryValue* browser_profile = new DictionaryValue();