1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_UTILITY_IMPORTER_EXTERNAL_PROCESS_IMPORTER_BRIDGE_H_
6 #define CHROME_UTILITY_IMPORTER_EXTERNAL_PROCESS_IMPORTER_BRIDGE_H_
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "chrome/common/importer/importer_bridge.h"
15 #include "components/favicon_base/favicon_usage_data.h"
18 struct ImportedBookmarkEntry
;
21 class DictionaryValue
;
27 struct ImporterIE7PasswordInfo
;
29 struct ImporterURLRow
;
30 struct SearchEngineInfo
;
38 // When the importer is run in an external process, the bridge is effectively
39 // split in half by the IPC infrastructure. The external bridge receives data
40 // and notifications from the importer, and sends it across IPC. The
41 // internal bridge gathers the data from the IPC host and writes it to the
43 class ExternalProcessImporterBridge
: public ImporterBridge
{
45 ExternalProcessImporterBridge(
46 const base::DictionaryValue
& localized_strings
,
48 base::TaskRunner
* task_runner
);
50 // Begin ImporterBridge implementation:
51 void AddBookmarks(const std::vector
<ImportedBookmarkEntry
>& bookmarks
,
52 const base::string16
& first_folder_name
) override
;
54 void AddHomePage(const GURL
& home_page
) override
;
57 void AddIE7PasswordInfo(
58 const importer::ImporterIE7PasswordInfo
& password_info
) override
;
61 void SetFavicons(const favicon_base::FaviconUsageDataList
& favicons
) override
;
63 void SetHistoryItems(const std::vector
<ImporterURLRow
>& rows
,
64 importer::VisitSource visit_source
) override
;
67 const std::vector
<importer::SearchEngineInfo
>& search_engines
,
68 bool unique_on_host_and_path
) override
;
70 void SetFirefoxSearchEnginesXMLData(
71 const std::vector
<std::string
>& seach_engine_data
) override
;
73 void SetPasswordForm(const autofill::PasswordForm
& form
) override
;
75 void SetAutofillFormData(
76 const std::vector
<ImporterAutofillFormDataEntry
>& entries
) override
;
78 void NotifyStarted() override
;
79 void NotifyItemStarted(importer::ImportItem item
) override
;
80 void NotifyItemEnded(importer::ImportItem item
) override
;
81 void NotifyEnded() override
;
83 base::string16
GetLocalizedString(int message_id
) override
;
84 // End ImporterBridge implementation.
87 ~ExternalProcessImporterBridge() override
;
89 void Send(IPC::Message
* message
);
90 void SendInternal(IPC::Message
* message
);
92 // Holds strings needed by the external importer because the resource
93 // bundle isn't available to the external process.
94 scoped_ptr
<base::DictionaryValue
> localized_strings_
;
97 scoped_refptr
<base::TaskRunner
> task_runner_
;
99 DISALLOW_COPY_AND_ASSIGN(ExternalProcessImporterBridge
);
102 #endif // CHROME_UTILITY_IMPORTER_EXTERNAL_PROCESS_IMPORTER_BRIDGE_H_