diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-02 23:23:08 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-02 23:23:08 +0000 |
commit | 58d7bb5fc1d079213e852c28d0557f17907e8ba6 (patch) | |
tree | 8b527c3e7522ee5f8f51b0a788bf33095522302e /chrome/browser/importer | |
parent | a0798ecd866df57352c628ee6adf191a3fdc865e (diff) | |
download | chromium_src-58d7bb5fc1d079213e852c28d0557f17907e8ba6.zip chromium_src-58d7bb5fc1d079213e852c28d0557f17907e8ba6.tar.gz chromium_src-58d7bb5fc1d079213e852c28d0557f17907e8ba6.tar.bz2 |
importer: Factor out StartImportingWithUI() function in its own file.
- Move this function to importer_progress_dialog.h
- Rename it ShowImportProgressDialog.
- Put it under the importer namespace (so the callers can know where it comes from).
- Reorder the parameters to be more easy to read.
- Remove some using declarations.
BUG=None
TEST=importer unit tests and importing works as before.
Review URL: http://codereview.chromium.org/6597095
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76654 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/importer')
-rw-r--r-- | chrome/browser/importer/ie_importer.cc | 8 | ||||
-rw-r--r-- | chrome/browser/importer/ie_importer.h | 10 | ||||
-rw-r--r-- | chrome/browser/importer/importer.h | 31 | ||||
-rw-r--r-- | chrome/browser/importer/importer_data_types.h | 3 | ||||
-rw-r--r-- | chrome/browser/importer/importer_list.cc | 4 | ||||
-rw-r--r-- | chrome/browser/importer/importer_progress_dialog.h | 34 | ||||
-rw-r--r-- | chrome/browser/importer/importer_unittest.cc | 6 |
7 files changed, 57 insertions, 39 deletions
diff --git a/chrome/browser/importer/ie_importer.cc b/chrome/browser/importer/ie_importer.cc index d10453c0..abdce9c 100644 --- a/chrome/browser/importer/ie_importer.cc +++ b/chrome/browser/importer/ie_importer.cc @@ -71,7 +71,10 @@ const GUID IEImporter::kPStoreAutocompleteGUID = {0xe161255a, 0x37c3, 0x11d2, const GUID IEImporter::kUnittestGUID = { 0xa79029d6, 0x753e, 0x4e27, {0xb8, 0x7, 0x3d, 0x46, 0xab, 0x15, 0x45, 0xdf}}; -void IEImporter::StartImport(const ProfileInfo& profile_info, +IEImporter::IEImporter() { +} + +void IEImporter::StartImport(const importer::ProfileInfo& profile_info, uint16 items, ImporterBridge* bridge) { bridge_ = bridge; @@ -112,6 +115,9 @@ void IEImporter::StartImport(const ProfileInfo& profile_info, bridge_->NotifyEnded(); } +IEImporter::~IEImporter() { +} + void IEImporter::ImportFavorites() { std::wstring path; diff --git a/chrome/browser/importer/ie_importer.h b/chrome/browser/importer/ie_importer.h index 68b7c23..d1fddb6 100644 --- a/chrome/browser/importer/ie_importer.h +++ b/chrome/browser/importer/ie_importer.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -11,17 +11,17 @@ class IEImporter : public Importer { public: - IEImporter() {} + IEImporter(); - // Importer methods. - virtual void StartImport(const ProfileInfo& browser_info, + // Importer: + virtual void StartImport(const importer::ProfileInfo& browser_info, uint16 items, ImporterBridge* bridge); private: FRIEND_TEST_ALL_PREFIXES(ImporterTest, IEImporter); - virtual ~IEImporter() {} + virtual ~IEImporter(); void ImportFavorites(); void ImportHistory(); diff --git a/chrome/browser/importer/importer.h b/chrome/browser/importer/importer.h index 2c25cad..c807d95 100644 --- a/chrome/browser/importer/importer.h +++ b/chrome/browser/importer/importer.h @@ -9,11 +9,10 @@ #include <string> #include <vector> -#include "build/build_config.h" - #include "base/basictypes.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" +#include "build/build_config.h" #include "chrome/browser/bookmarks/bookmark_model_observer.h" #include "chrome/browser/importer/importer_data_types.h" #include "chrome/browser/importer/importer_list.h" @@ -23,31 +22,26 @@ #include "chrome/common/notification_registrar.h" #include "ui/gfx/native_widget_types.h" -using importer::ImportItem; -using importer::ProfileInfo; - class ExternalProcessImporterClient; +class FirefoxProfileLock; +class GURL; +class Importer; class ImporterBridge; class InProcessImporterBridge; -class GURL; class Profile; class Task; class TemplateURL; - struct IE7PasswordInfo; namespace history { -struct ImportedFavIconUsage; class URLRow; +struct ImportedFavIconUsage; } namespace webkit_glue { struct PasswordForm; } -class FirefoxProfileLock; -class Importer; - // This class hosts the importers. It enumerates profiles from other // browsers dynamically, and controls the process of importing. When // the import process is done, ImporterHost deletes itself. @@ -473,19 +467,4 @@ class Importer : public base::RefCountedThreadSafe<Importer> { DISALLOW_COPY_AND_ASSIGN(Importer); }; -class ImporterObserver; - -// Shows a UI for importing and begins importing the specified items from -// source_profile to target_profile. observer is notified when the process is -// complete, can be NULL. parent is the window to parent the UI to, can be NULL -// if there's nothing to parent to. first_run is true if it's invoked in the -// first run UI. -void StartImportingWithUI(gfx::NativeWindow parent_window, - uint16 items, - ImporterHost* coordinator, - const importer::ProfileInfo& source_profile, - Profile* target_profile, - ImporterObserver* observer, - bool first_run); - #endif // CHROME_BROWSER_IMPORTER_IMPORTER_H_ diff --git a/chrome/browser/importer/importer_data_types.h b/chrome/browser/importer/importer_data_types.h index 51376c8..fa2b328 100644 --- a/chrome/browser/importer/importer_data_types.h +++ b/chrome/browser/importer/importer_data_types.h @@ -51,7 +51,7 @@ struct ProfileInfo { ~ProfileInfo(); std::wstring description; - importer::ProfileType browser_type; + ProfileType browser_type; FilePath source_path; FilePath app_path; uint16 services_supported; // Bitmask of ImportItem. @@ -60,4 +60,3 @@ struct ProfileInfo { } // 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 a47e9b4..121ec5f 100644 --- a/chrome/browser/importer/importer_list.cc +++ b/chrome/browser/importer/importer_list.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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,7 +32,7 @@ namespace { #if defined(OS_WIN) void DetectIEProfiles(std::vector<importer::ProfileInfo*>* profiles) { // IE always exists and doesn't have multiple profiles. - ProfileInfo* ie = new ProfileInfo(); + importer::ProfileInfo* ie = new importer::ProfileInfo(); ie->description = UTF16ToWide(l10n_util::GetStringUTF16(IDS_IMPORT_FROM_IE)); ie->browser_type = importer::MS_IE; ie->source_path.clear(); diff --git a/chrome/browser/importer/importer_progress_dialog.h b/chrome/browser/importer/importer_progress_dialog.h new file mode 100644 index 0000000..d11df70 --- /dev/null +++ b/chrome/browser/importer/importer_progress_dialog.h @@ -0,0 +1,34 @@ +// Copyright (c) 2011 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_PROGRESS_DIALOG_H_ +#define CHROME_BROWSER_IMPORTER_IMPORTER_PROGRESS_DIALOG_H_ +#pragma once + +#include "ui/gfx/native_widget_types.h" + +class ImporterHost; +class ImporterObserver; +class Profile; + +namespace importer { + +struct ProfileInfo; + +// Shows an UI for importing and begins importing the specified |items| from +// |source_profile| to |target_profile|. |importer_observer| is notified when +// the process is complete, it can be NULL. |parent_window| is the window to +// parent the UI to, it can be NULL if there's nothing to parent to. |first_run| +// is true if it's invoked in the first run UI. +void ShowImportProgressDialog(gfx::NativeWindow parent_window, + uint16 items, + ImporterHost* importer_host, + ImporterObserver* importer_observer, + const ProfileInfo& source_profile, + Profile* target_profile, + bool first_run); + +} // namespace importer + +#endif // CHROME_BROWSER_IMPORTER_IMPORTER_PROGRESS_DIALOG_H_ diff --git a/chrome/browser/importer/importer_unittest.cc b/chrome/browser/importer/importer_unittest.cc index 4bbd161..193a13f 100644 --- a/chrome/browser/importer/importer_unittest.cc +++ b/chrome/browser/importer/importer_unittest.cc @@ -110,7 +110,7 @@ class ImporterTest : public testing::Test { } MessageLoop* loop = MessageLoop::current(); - ProfileInfo profile_info; + importer::ProfileInfo profile_info; profile_info.browser_type = FIREFOX3; profile_info.app_path = app_path_; profile_info.source_path = profile_path_; @@ -420,7 +420,7 @@ TEST_F(ImporterTest, IEImporter) { TestObserver* observer = new TestObserver(); host->SetObserver(observer); - ProfileInfo profile_info; + importer::ProfileInfo profile_info; profile_info.browser_type = MS_IE; profile_info.source_path = test_path_; @@ -699,7 +699,7 @@ TEST_F(ImporterTest, MAYBE(Firefox2Importer)) { scoped_refptr<ImporterHost> host(new ImporterHost); FirefoxObserver* observer = new FirefoxObserver(); host->SetObserver(observer); - ProfileInfo profile_info; + importer::ProfileInfo profile_info; profile_info.browser_type = FIREFOX2; profile_info.app_path = app_path_; profile_info.source_path = profile_path_; |