summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-03 00:02:48 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-03 00:02:48 +0000
commit2d01355a89e2d5df292289631d6880e2f08f1906 (patch)
tree27e77271164bd18abb09f9c2f0b1fb31aa5bba7d
parent245394091947f06762dc6fa7cc0ee96b37bdc32c (diff)
downloadchromium_src-2d01355a89e2d5df292289631d6880e2f08f1906.zip
chromium_src-2d01355a89e2d5df292289631d6880e2f08f1906.tar.gz
chromium_src-2d01355a89e2d5df292289631d6880e2f08f1906.tar.bz2
Revert "importer: Some random cleanups."
This reverts commit 1f7e6e059c44ad823e014534f2b3eaf5c4f5daed. R=avi@chromium.org,ananta@chromium.org BUG=77777 TEST=None Review URL: http://codereview.chromium.org/6880353 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83817 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/importer/external_process_importer_client.cc54
-rw-r--r--chrome/browser/importer/external_process_importer_client.h26
-rw-r--r--chrome/browser/importer/importer.h4
-rw-r--r--chrome/browser/importer/toolbar_importer.cc13
-rw-r--r--chrome/browser/importer/toolbar_importer.h16
5 files changed, 57 insertions, 56 deletions
diff --git a/chrome/browser/importer/external_process_importer_client.cc b/chrome/browser/importer/external_process_importer_client.cc
index 930f72d..29f249d 100644
--- a/chrome/browser/importer/external_process_importer_client.cc
+++ b/chrome/browser/importer/external_process_importer_client.cc
@@ -39,6 +39,24 @@ ExternalProcessImporterClient::~ExternalProcessImporterClient() {
bridge_->Release();
}
+void ExternalProcessImporterClient::CancelImportProcessOnIOThread() {
+ profile_import_process_host_->CancelProfileImportProcess();
+}
+
+void ExternalProcessImporterClient::NotifyItemFinishedOnIOThread(
+ importer::ImportItem import_item) {
+ profile_import_process_host_->ReportImportItemFinished(import_item);
+}
+
+void ExternalProcessImporterClient::Cleanup() {
+ if (cancelled_)
+ return;
+
+ if (process_importer_host_)
+ process_importer_host_->NotifyImportEnded();
+ Release();
+}
+
void ExternalProcessImporterClient::Start() {
AddRef(); // balanced in Cleanup.
BrowserThread::ID thread_id;
@@ -47,10 +65,18 @@ void ExternalProcessImporterClient::Start() {
BrowserThread::IO, FROM_HERE,
NewRunnableMethod(
this,
- &ExternalProcessImporterClient::StartImportProcessOnIOThread,
+ &ExternalProcessImporterClient::StartProcessOnIOThread,
thread_id));
}
+void ExternalProcessImporterClient::StartProcessOnIOThread(
+ BrowserThread::ID thread_id) {
+ profile_import_process_host_ =
+ new ProfileImportProcessHost(this, thread_id);
+ profile_import_process_host_->StartProfileImportProcess(
+ source_profile_, items_, import_to_bookmark_bar_);
+}
+
void ExternalProcessImporterClient::Cancel() {
if (cancelled_)
return;
@@ -65,32 +91,6 @@ void ExternalProcessImporterClient::Cancel() {
Release();
}
-void ExternalProcessImporterClient::Cleanup() {
- if (cancelled_)
- return;
-
- if (process_importer_host_)
- process_importer_host_->NotifyImportEnded();
- Release();
-}
-
-void ExternalProcessImporterClient::StartImportProcessOnIOThread(
- BrowserThread::ID thread_id) {
- profile_import_process_host_ =
- new ProfileImportProcessHost(this, thread_id);
- profile_import_process_host_->StartProfileImportProcess(
- source_profile_, items_, import_to_bookmark_bar_);
-}
-
-void ExternalProcessImporterClient::CancelImportProcessOnIOThread() {
- profile_import_process_host_->CancelProfileImportProcess();
-}
-
-void ExternalProcessImporterClient::NotifyItemFinishedOnIOThread(
- importer::ImportItem import_item) {
- profile_import_process_host_->ReportImportItemFinished(import_item);
-}
-
void ExternalProcessImporterClient::OnProcessCrashed(int exit_code) {
if (cancelled_)
return;
diff --git a/chrome/browser/importer/external_process_importer_client.h b/chrome/browser/importer/external_process_importer_client.h
index 6d5eeb6..69abb98 100644
--- a/chrome/browser/importer/external_process_importer_client.h
+++ b/chrome/browser/importer/external_process_importer_client.h
@@ -38,26 +38,25 @@ class ExternalProcessImporterClient : public ProfileImportProcessClient {
bool import_to_bookmark_bar);
virtual ~ExternalProcessImporterClient();
- // Launches the task to start the external process.
- void Start();
+ // Cancel import process on IO thread.
+ void CancelImportProcessOnIOThread();
- // Called by the ExternalProcessImporterHost on import cancel.
- void Cancel();
+ // Report item completely downloaded on IO thread.
+ void NotifyItemFinishedOnIOThread(importer::ImportItem import_item);
- // Notifies the ImporterHost that import has finished, and calls Release().
+ // Notifies the importerhost that import has finished, and calls Release().
void Cleanup();
- private:
- // Creates a new ProfileImportProcessHost, which launches the import process.
- void StartImportProcessOnIOThread(BrowserThread::ID thread_id);
+ // Launches the task to start the external process.
+ virtual void Start();
- // Cancel import process on IO thread.
- void CancelImportProcessOnIOThread();
+ // Creates a new ProfileImportProcessHost, which launches the import process.
+ virtual void StartProcessOnIOThread(BrowserThread::ID thread_id);
- // Report item completely downloaded on IO thread.
- void NotifyItemFinishedOnIOThread(importer::ImportItem import_item);
+ // Called by the ExternalProcessImporterHost on import cancel.
+ virtual void Cancel();
- // Begin ProfileImportProcessClient implementation.
+ // Begin ProfileImportProcessHost::ImportProcessClient implementation.
virtual void OnProcessCrashed(int exit_status) OVERRIDE;
virtual void OnImportStart() OVERRIDE;
virtual void OnImportFinished(bool succeeded,
@@ -111,6 +110,7 @@ class ExternalProcessImporterClient : public ProfileImportProcessClient {
// End ProfileImportProcessClient implementation.
+ 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_;
diff --git a/chrome/browser/importer/importer.h b/chrome/browser/importer/importer.h
index d6f0ff8..9b86109 100644
--- a/chrome/browser/importer/importer.h
+++ b/chrome/browser/importer/importer.h
@@ -6,11 +6,11 @@
#define CHROME_BROWSER_IMPORTER_IMPORTER_H_
#pragma once
-#include <vector>
-
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
+#include <vector>
+
class ImporterBridge;
namespace importer {
diff --git a/chrome/browser/importer/toolbar_importer.cc b/chrome/browser/importer/toolbar_importer.cc
index b3e6d4b..3ccc9c9 100644
--- a/chrome/browser/importer/toolbar_importer.cc
+++ b/chrome/browser/importer/toolbar_importer.cc
@@ -43,6 +43,9 @@ const char Toolbar5Importer::kT5FrontEndUrlTemplate[] =
"http://www.google.com/notebook/toolbar?cmd=list&tok={auth_token}&"
"num={max_num}&min={max_timestamp}&all=0&zx={random_number}";
+// Importer methods.
+
+// The constructor should set the initial state to NOT_USED.
Toolbar5Importer::Toolbar5Importer()
: state_(NOT_USED),
items_to_import_(importer::NONE),
@@ -72,13 +75,13 @@ void Toolbar5Importer::StartImport(
ContinueImport();
}
-// The public cancel method serves two functions, as a callback from the UI as
-// well as an internal callback in case of cancel. An internal callback is
-// required since the URLFetcher must be destroyed from the thread it was
+// The public cancel method serves two functions, as a callback from the UI
+// as well as an internal callback in case of cancel. An internal callback
+// is required since the URLFetcher must be destroyed from the thread it was
// created.
void Toolbar5Importer::Cancel() {
- // In the case when the thread is not importing messages we are to cancel as
- // soon as possible.
+ // In the case when the thread is not importing messages we are to
+ // cancel as soon as possible.
Importer::Cancel();
// If we are conducting network operations, post a message to the importer
diff --git a/chrome/browser/importer/toolbar_importer.h b/chrome/browser/importer/toolbar_importer.h
index 6acab81..a6865f7 100644
--- a/chrome/browser/importer/toolbar_importer.h
+++ b/chrome/browser/importer/toolbar_importer.h
@@ -33,20 +33,18 @@ class Toolbar5Importer : public URLFetcher::Delegate, public Importer {
public:
Toolbar5Importer();
- // Begin Importer implementation:
-
- // 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
+ // Importer:
+ // The importer view calls this method to begin the 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::SourceProfile& source_profile,
uint16 items,
ImporterBridge* bridge) OVERRIDE;
- // This method is called when the user clicks the cancel button on the UI
- // dialog. We need to post a message to our loop to cancel network retrieval.
- virtual void Cancel() OVERRIDE;
-
- // End Importer implementation.
+ // Importer view call this method when the user clicks the cancel button
+ // in the tabbed options UI. We need to post a message to our loop
+ // to cancel network retrieval.
+ virtual void Cancel();
// URLFetcher::Delegate method called back from the URLFetcher object.
virtual void OnURLFetchComplete(const URLFetcher* source,