#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"
using content::UtilityProcessHost;
ExternalProcessImporterClient::ExternalProcessImporterClient(
- ExternalProcessImporterHost* importer_host,
+ base::WeakPtr<ExternalProcessImporterHost> importer_host,
const importer::SourceProfile& source_profile,
uint16 items,
InProcessImporterBridge* bridge)
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(
}
void ExternalProcessImporterClient::OnBookmarksImportStart(
- const string16& first_folder_name,
+ const base::string16& first_folder_name,
size_t total_bookmarks_count) {
if (cancelled_)
return;
if (cancelled_)
return;
- if (process_importer_host_)
+ if (process_importer_host_.get())
process_importer_host_->NotifyImportEnded();
Release();
}
// 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));