diff options
author | rsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-27 02:56:21 +0000 |
---|---|---|
committer | rsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-27 02:56:21 +0000 |
commit | 649d1c0ea7c08dec1586220da91a2ac3f73206ea (patch) | |
tree | da3ba2bd2812f1440827aac59c2e657c0b06a243 /chrome/browser/importer | |
parent | 3819c76919240d0470005263ae64761d7f7ed97f (diff) | |
download | chromium_src-649d1c0ea7c08dec1586220da91a2ac3f73206ea.zip chromium_src-649d1c0ea7c08dec1586220da91a2ac3f73206ea.tar.gz chromium_src-649d1c0ea7c08dec1586220da91a2ac3f73206ea.tar.bz2 |
RefCounted types should not have public destructors, chrome/browser/ part 6
BUG=123295
TEST=none
Review URL: http://codereview.chromium.org/10071036
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134218 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/importer')
5 files changed, 75 insertions, 65 deletions
diff --git a/chrome/browser/importer/external_process_importer_client.cc b/chrome/browser/importer/external_process_importer_client.cc index dbc25cf..e66b6e05 100644 --- a/chrome/browser/importer/external_process_importer_client.cc +++ b/chrome/browser/importer/external_process_importer_client.cc @@ -38,29 +38,6 @@ ExternalProcessImporterClient::ExternalProcessImporterClient( process_importer_host_->NotifyImportStarted(); } -ExternalProcessImporterClient::~ExternalProcessImporterClient() { -} - -void ExternalProcessImporterClient::CancelImportProcessOnIOThread() { - if (utility_process_host_) - utility_process_host_->Send(new ProfileImportProcessMsg_CancelImport()); -} - -void ExternalProcessImporterClient::NotifyItemFinishedOnIOThread( - importer::ImportItem import_item) { - utility_process_host_->Send( - new ProfileImportProcessMsg_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; @@ -72,46 +49,6 @@ void ExternalProcessImporterClient::Start() { thread_id)); } -void ExternalProcessImporterClient::StartProcessOnIOThread( - BrowserThread::ID thread_id) { - utility_process_host_ = - UtilityProcessHost::Create(this, thread_id)->AsWeakPtr(); - utility_process_host_->DisableSandbox(); - -#if defined(OS_MACOSX) - base::EnvironmentVector env; - std::string dylib_path = GetFirefoxDylibPath().value(); - if (!dylib_path.empty()) - env.push_back(std::make_pair("DYLD_FALLBACK_LIBRARY_PATH", dylib_path)); - utility_process_host_->SetEnv(env); -#endif - - // Dictionary of all localized strings that could be needed by the importer - // in the external process. - DictionaryValue localized_strings; - localized_strings.SetString( - base::IntToString(IDS_BOOKMARK_GROUP_FROM_FIREFOX), - l10n_util::GetStringUTF8(IDS_BOOKMARK_GROUP_FROM_FIREFOX)); - localized_strings.SetString( - base::IntToString(IDS_BOOKMARK_GROUP_FROM_SAFARI), - l10n_util::GetStringUTF8(IDS_BOOKMARK_GROUP_FROM_SAFARI)); - localized_strings.SetString( - base::IntToString(IDS_IMPORT_FROM_FIREFOX), - l10n_util::GetStringUTF8(IDS_IMPORT_FROM_FIREFOX)); - localized_strings.SetString( - base::IntToString(IDS_IMPORT_FROM_GOOGLE_TOOLBAR), - l10n_util::GetStringUTF8(IDS_IMPORT_FROM_GOOGLE_TOOLBAR)); - localized_strings.SetString( - base::IntToString(IDS_IMPORT_FROM_SAFARI), - l10n_util::GetStringUTF8(IDS_IMPORT_FROM_SAFARI)); - localized_strings.SetString( - base::IntToString(IDS_BOOKMARK_BAR_FOLDER_NAME), - l10n_util::GetStringUTF8(IDS_BOOKMARK_BAR_FOLDER_NAME)); - - utility_process_host_->Send(new ProfileImportProcessMsg_StartImport( - source_profile_, items_, localized_strings)); -} - void ExternalProcessImporterClient::Cancel() { if (cancelled_) return; @@ -298,3 +235,65 @@ void ExternalProcessImporterClient::OnKeywordsImportReady( bridge_->SetKeywords(template_urls, unique_on_host_and_path); // The pointers in |template_urls| have now been deleted. } + +ExternalProcessImporterClient::~ExternalProcessImporterClient() {} + +void ExternalProcessImporterClient::Cleanup() { + if (cancelled_) + return; + + if (process_importer_host_) + process_importer_host_->NotifyImportEnded(); + Release(); +} + +void ExternalProcessImporterClient::CancelImportProcessOnIOThread() { + if (utility_process_host_) + utility_process_host_->Send(new ProfileImportProcessMsg_CancelImport()); +} + +void ExternalProcessImporterClient::NotifyItemFinishedOnIOThread( + importer::ImportItem import_item) { + utility_process_host_->Send( + new ProfileImportProcessMsg_ReportImportItemFinished(import_item)); +} + +void ExternalProcessImporterClient::StartProcessOnIOThread( + BrowserThread::ID thread_id) { + utility_process_host_ = + UtilityProcessHost::Create(this, thread_id)->AsWeakPtr(); + utility_process_host_->DisableSandbox(); + +#if defined(OS_MACOSX) + base::EnvironmentVector env; + std::string dylib_path = GetFirefoxDylibPath().value(); + if (!dylib_path.empty()) + env.push_back(std::make_pair("DYLD_FALLBACK_LIBRARY_PATH", dylib_path)); + utility_process_host_->SetEnv(env); +#endif + + // Dictionary of all localized strings that could be needed by the importer + // in the external process. + DictionaryValue localized_strings; + localized_strings.SetString( + base::IntToString(IDS_BOOKMARK_GROUP_FROM_FIREFOX), + l10n_util::GetStringUTF8(IDS_BOOKMARK_GROUP_FROM_FIREFOX)); + localized_strings.SetString( + base::IntToString(IDS_BOOKMARK_GROUP_FROM_SAFARI), + l10n_util::GetStringUTF8(IDS_BOOKMARK_GROUP_FROM_SAFARI)); + localized_strings.SetString( + base::IntToString(IDS_IMPORT_FROM_FIREFOX), + l10n_util::GetStringUTF8(IDS_IMPORT_FROM_FIREFOX)); + localized_strings.SetString( + base::IntToString(IDS_IMPORT_FROM_GOOGLE_TOOLBAR), + l10n_util::GetStringUTF8(IDS_IMPORT_FROM_GOOGLE_TOOLBAR)); + localized_strings.SetString( + base::IntToString(IDS_IMPORT_FROM_SAFARI), + l10n_util::GetStringUTF8(IDS_IMPORT_FROM_SAFARI)); + localized_strings.SetString( + base::IntToString(IDS_BOOKMARK_BAR_FOLDER_NAME), + l10n_util::GetStringUTF8(IDS_BOOKMARK_BAR_FOLDER_NAME)); + + utility_process_host_->Send(new ProfileImportProcessMsg_StartImport( + source_profile_, items_, localized_strings)); +} diff --git a/chrome/browser/importer/external_process_importer_client.h b/chrome/browser/importer/external_process_importer_client.h index 1394588..ae13b81 100644 --- a/chrome/browser/importer/external_process_importer_client.h +++ b/chrome/browser/importer/external_process_importer_client.h @@ -39,7 +39,6 @@ class ExternalProcessImporterClient : public content::UtilityProcessHostClient { const importer::SourceProfile& source_profile, uint16 items, InProcessImporterBridge* bridge); - virtual ~ExternalProcessImporterClient(); // Launches the task to start the external process. void Start(); @@ -73,6 +72,9 @@ class ExternalProcessImporterClient : public content::UtilityProcessHostClient { void OnKeywordsImportReady(const std::vector<TemplateURL*>& template_urls, bool unique_on_host_and_path); + protected: + virtual ~ExternalProcessImporterClient(); + private: // Notifies the importerhost that import has finished, and calls Release(). void Cleanup(); diff --git a/chrome/browser/importer/external_process_importer_host.cc b/chrome/browser/importer/external_process_importer_host.cc index 4115189..d0397c2 100644 --- a/chrome/browser/importer/external_process_importer_host.cc +++ b/chrome/browser/importer/external_process_importer_host.cc @@ -23,6 +23,8 @@ void ExternalProcessImporterHost::Cancel() { NotifyImportEnded(); // Tells the observer that we're done, and releases us. } +ExternalProcessImporterHost::~ExternalProcessImporterHost() {} + void ExternalProcessImporterHost::StartImportSettings( const importer::SourceProfile& source_profile, Profile* target_profile, diff --git a/chrome/browser/importer/external_process_importer_host.h b/chrome/browser/importer/external_process_importer_host.h index c32ed7a..1b8be85 100644 --- a/chrome/browser/importer/external_process_importer_host.h +++ b/chrome/browser/importer/external_process_importer_host.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -27,6 +27,9 @@ class ExternalProcessImporterHost : public ImporterHost { // ImporterHost: virtual void Cancel() OVERRIDE; + protected: + virtual ~ExternalProcessImporterHost(); + private: // ImporterHost: virtual void StartImportSettings( diff --git a/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc b/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc index afe78e5..d609cc9 100644 --- a/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc +++ b/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc @@ -166,6 +166,10 @@ class CancellableQuitMsgLoop : public base::RefCounted<CancellableQuitMsgLoop> { MessageLoop::current()->Quit(); } bool cancelled_; + + private: + friend class base::RefCounted<CancellableQuitMsgLoop>; + ~CancellableQuitMsgLoop() {} }; // Spin until either a client response arrives or a timeout occurs. |