Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / importer / external_process_importer_client.cc
index a363922..b47fe22 100644 (file)
@@ -14,6 +14,7 @@
 #include "chrome/common/importer/profile_import_process_messages.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/utility_process_host.h"
+#include "grit/component_strings.h"
 #include "grit/generated_resources.h"
 #include "ui/base/l10n/l10n_util.h"
 
@@ -21,7 +22,7 @@ using content::BrowserThread;
 using content::UtilityProcessHost;
 
 ExternalProcessImporterClient::ExternalProcessImporterClient(
-    ExternalProcessImporterHost* importer_host,
+    base::WeakPtr<ExternalProcessImporterHost> importer_host,
     const importer::SourceProfile& source_profile,
     uint16 items,
     InProcessImporterBridge* bridge)
@@ -65,7 +66,10 @@ void ExternalProcessImporterClient::OnProcessCrashed(int exit_code) {
   if (cancelled_)
     return;
 
-  process_importer_host_->Cancel();
+  // If the host is still around, cancel the import; otherwise it means the
+  // import was already cancelled or completed and this message can be dropped.
+  if (process_importer_host_.get())
+    process_importer_host_->Cancel();
 }
 
 bool ExternalProcessImporterClient::OnMessageReceived(
@@ -180,7 +184,7 @@ void ExternalProcessImporterClient::OnHomePageImportReady(
 }
 
 void ExternalProcessImporterClient::OnBookmarksImportStart(
-    const string16& first_folder_name,
+    const base::string16& first_folder_name,
     size_t total_bookmarks_count) {
   if (cancelled_)
     return;
@@ -261,7 +265,7 @@ void ExternalProcessImporterClient::Cleanup() {
   if (cancelled_)
     return;
 
-  if (process_importer_host_)
+  if (process_importer_host_.get())
     process_importer_host_->NotifyImportEnded();
   Release();
 }
@@ -294,7 +298,7 @@ void ExternalProcessImporterClient::StartProcessOnIOThread(
 
   // Dictionary of all localized strings that could be needed by the importer
   // in the external process.
-  DictionaryValue localized_strings;
+  base::DictionaryValue localized_strings;
   localized_strings.SetString(
       base::IntToString(IDS_BOOKMARK_GROUP),
       l10n_util::GetStringUTF8(IDS_BOOKMARK_GROUP));