Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(844)

Unified Diff: chrome/browser/importer/importer_host.h

Issue 6679004: importer: Pull ExternalProcessImporterClient out of ImporterHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/importer/importer_host.h
diff --git a/chrome/browser/importer/importer_host.h b/chrome/browser/importer/importer_host.h
index 4b206336ca5fd53d6152dcac359cbed86596bd6c..1b94a4aee97c03054bc7f9478b009806f3ef251d 100644
--- a/chrome/browser/importer/importer_host.h
+++ b/chrome/browser/importer/importer_host.h
@@ -17,7 +17,6 @@
#include "chrome/browser/importer/importer_data_types.h"
#include "chrome/browser/importer/importer_list.h"
#include "chrome/browser/importer/profile_writer.h"
-#include "chrome/browser/profile_import_process_host.h"
#include "content/common/notification_observer.h"
#include "content/common/notification_registrar.h"
#include "ui/gfx/native_widget_types.h"
@@ -222,141 +221,4 @@ class ExternalProcessImporterHost : public ImporterHost {
DISALLOW_COPY_AND_ASSIGN(ExternalProcessImporterHost);
};
-// 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 ProfileImportProcessHost::ImportProcessClient {
- public:
- ExternalProcessImporterClient(ExternalProcessImporterHost* importer_host,
- const importer::ProfileInfo& profile_info,
- int items,
- InProcessImporterBridge* bridge,
- bool import_to_bookmark_bar);
-
- ~ExternalProcessImporterClient();
-
- // Launches the task to start the external process.
- virtual void Start();
-
- // Creates a new ProfileImportProcessHost, which launches the import process.
- virtual void StartProcessOnIOThread(ResourceDispatcherHost* rdh,
- BrowserThread::ID thread_id);
-
- // Called by the ExternalProcessImporterHost on import cancel.
- virtual void Cancel();
-
- // Cancel import process on IO thread.
- void CancelImportProcessOnIOThread();
-
- // Report item completely downloaded on IO thread.
- void NotifyItemFinishedOnIOThread(importer::ImportItem import_item);
-
- // Cancel import on process crash.
- virtual void OnProcessCrashed(int exit_code);
-
- // Notifies the importerhost that import has finished, and calls Release().
- void Cleanup();
-
- // ProfileImportProcessHost messages ----------------------------------------
- // The following methods are called by ProfileImportProcessHost when the
- // corresponding message has been received from the import process.
- virtual void OnImportStart();
- virtual void OnImportFinished(bool succeeded, std::string error_msg);
- virtual void OnImportItemStart(int item_data);
- virtual void OnImportItemFinished(int item_data);
-
- // Called on first message received when importing history; gives total
- // number of rows to be imported.
- virtual void OnHistoryImportStart(size_t total_history_rows_count);
-
- // Called when a group of URLRows has been received.
- // The source is passed with history::VisitSource type.
- virtual void OnHistoryImportGroup(
- const std::vector<history::URLRow> &history_rows_group,
- int visit_source);
-
- // Called when the home page has been received.
- virtual void OnHomePageImportReady(const GURL& home_page);
-
- // First message received when importing bookmarks.
- // |first_folder_name| can be NULL.
- // |options| is described in ProfileWriter::BookmarkOptions.
- // |total_bookmarks_count| is the total number of bookmarks to be imported.
- virtual void OnBookmarksImportStart(
- const std::wstring first_folder_name,
- int options, size_t total_bookmarks_count);
-
- // Called when a group of bookmarks has been received.
- virtual void OnBookmarksImportGroup(
- const std::vector<ProfileWriter::BookmarkEntry>& bookmarks_group);
-
- // First message received when importing favicons. |total_fav_icons_size|
- // gives the total number of fav icons to be imported.
- virtual void OnFavIconsImportStart(size_t total_fav_icons_count);
-
- // Called when a group of favicons has been received.
- virtual void OnFavIconsImportGroup(
- const std::vector<history::ImportedFavIconUsage>& fav_icons_group);
-
- // Called when the passwordform has been received.
- virtual void OnPasswordFormImportReady(
- const webkit_glue::PasswordForm& form);
-
- // Called when search engines have been received.
- virtual void OnKeywordsImportReady(
- const std::vector<TemplateURL>& template_urls,
- int default_keyword_index, bool unique_on_host_and_path);
-
- // End ProfileImportProcessHost messages ------------------------------------
-
- private:
- // These variables store data being collected from the importer until the
- // entire group has been collected and is ready to be written to the profile.
- std::vector<history::URLRow> history_rows_;
- std::vector<ProfileWriter::BookmarkEntry> bookmarks_;
- std::vector<history::ImportedFavIconUsage> fav_icons_;
-
- // Usually some variation on IDS_BOOKMARK_GROUP_...; the name of the folder
- // under which imported bookmarks will be placed.
- std::wstring bookmarks_first_folder_name_;
-
- // Determines how bookmarks should be added (ProfileWriter::BookmarkOptions).
- int bookmarks_options_;
-
- // Total number of bookmarks to import.
- size_t total_bookmarks_count_;
-
- // Total number of history items to import.
- size_t total_history_rows_count_;
-
- // Total number of fav icons to import.
- size_t total_fav_icons_count_;
-
- // Notifications received from the ProfileImportProcessHost are passed back
- // to process_importer_host_, which calls the ProfileWriter to record the
- // import data. When the import process is done, process_importer_host_
- // deletes itself.
- ExternalProcessImporterHost* process_importer_host_;
-
- // Handles sending messages to the external process. Deletes itself when
- // the external process dies (see ChildProcessHost::OnChildDied).
- ProfileImportProcessHost* profile_import_process_host_;
-
- // Data to be passed from the importer host to the external importer.
- const importer::ProfileInfo& profile_info_;
- int items_;
- bool import_to_bookmark_bar_;
-
- // Takes import data coming over IPC and delivers it to be written by the
- // ProfileWriter. Released by ExternalProcessImporterClient in its
- // destructor.
- InProcessImporterBridge* bridge_;
-
- // True if import process has been cancelled.
- bool cancelled_;
-
- DISALLOW_COPY_AND_ASSIGN(ExternalProcessImporterClient);
-};
-
#endif // CHROME_BROWSER_IMPORTER_IMPORTER_HOST_H_
« no previous file with comments | « chrome/browser/importer/external_process_importer_client.cc ('k') | chrome/browser/importer/importer_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698