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_COMMON_IMPORTER_IMPORTER_BRIDGE_H_
6 #define CHROME_COMMON_IMPORTER_IMPORTER_BRIDGE_H_
11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/strings/string16.h"
14 #include "build/build_config.h"
15 #include "chrome/common/importer/importer_data_types.h"
16 #include "chrome/common/importer/importer_url_row.h"
19 struct ImportedBookmarkEntry
;
20 struct ImportedFaviconUsage
;
21 struct ImporterAutofillFormDataEntry
;
29 struct ImporterIE7PasswordInfo
;
31 struct ImporterURlRow
;
32 struct SearchEngineInfo
;
35 class ImporterBridge
: public base::RefCountedThreadSafe
<ImporterBridge
> {
39 virtual void AddBookmarks(
40 const std::vector
<ImportedBookmarkEntry
>& bookmarks
,
41 const base::string16
& first_folder_name
) = 0;
43 virtual void AddHomePage(const GURL
& home_page
) = 0;
46 virtual void AddIE7PasswordInfo(
47 const importer::ImporterIE7PasswordInfo
& password_info
) = 0;
50 virtual void SetFavicons(
51 const std::vector
<ImportedFaviconUsage
>& favicons
) = 0;
53 virtual void SetHistoryItems(const std::vector
<ImporterURLRow
>& rows
,
54 importer::VisitSource visit_source
) = 0;
56 virtual void SetKeywords(
57 const std::vector
<importer::SearchEngineInfo
>& search_engines
,
58 bool unique_on_host_and_path
) = 0;
60 // The search_engine_data vector contains XML data retrieved from the Firefox
61 // profile and its sqlite db.
62 virtual void SetFirefoxSearchEnginesXMLData(
63 const std::vector
<std::string
>& search_engine_data
) = 0;
65 virtual void SetPasswordForm(const autofill::PasswordForm
& form
) = 0;
67 virtual void SetAutofillFormData(
68 const std::vector
<ImporterAutofillFormDataEntry
>& entries
) = 0;
70 // Notifies the coordinator that the import operation has begun.
71 virtual void NotifyStarted() = 0;
73 // Notifies the coordinator that the collection of data for the specified
75 virtual void NotifyItemStarted(importer::ImportItem item
) = 0;
77 // Notifies the coordinator that the collection of data for the specified
78 // item has completed.
79 virtual void NotifyItemEnded(importer::ImportItem item
) = 0;
81 // Notifies the coordinator that the entire import operation has completed.
82 virtual void NotifyEnded() = 0;
84 // For InProcessImporters this calls l10n_util. For ExternalProcessImporters
85 // this calls the set of strings we've ported over to the external process.
86 // It's good to avoid having to create a separate ResourceBundle for the
87 // external import process, since the importer only needs a few strings.
88 virtual base::string16
GetLocalizedString(int message_id
) = 0;
91 friend class base::RefCountedThreadSafe
<ImporterBridge
>;
93 virtual ~ImporterBridge();
95 DISALLOW_COPY_AND_ASSIGN(ImporterBridge
);
98 #endif // CHROME_COMMON_IMPORTER_IMPORTER_BRIDGE_H_