Fix broken path in extensions/common/PRESUBMIT.py
[chromium-blink-merge.git] / chrome / utility / importer / external_process_importer_bridge.h
blob4611859e76b028f4a7ccc0ab3e5a8c46835d15ca
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_
8 #include <string>
9 #include <vector>
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"
17 class GURL;
18 struct ImportedBookmarkEntry;
20 namespace base {
21 class DictionaryValue;
22 class TaskRunner;
25 namespace importer {
26 #if defined(OS_WIN)
27 struct ImporterIE7PasswordInfo;
28 #endif
29 struct ImporterURLRow;
30 struct SearchEngineInfo;
33 namespace IPC {
34 class Message;
35 class Sender;
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
42 // profile.
43 class ExternalProcessImporterBridge : public ImporterBridge {
44 public:
45 ExternalProcessImporterBridge(
46 const base::DictionaryValue& localized_strings,
47 IPC::Sender* sender,
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;
56 #if defined(OS_WIN)
57 void AddIE7PasswordInfo(
58 const importer::ImporterIE7PasswordInfo& password_info) override;
59 #endif
61 void SetFavicons(const favicon_base::FaviconUsageDataList& favicons) override;
63 void SetHistoryItems(const std::vector<ImporterURLRow>& rows,
64 importer::VisitSource visit_source) override;
66 void SetKeywords(
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.
86 private:
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_;
96 IPC::Sender* sender_;
97 scoped_refptr<base::TaskRunner> task_runner_;
99 DISALLOW_COPY_AND_ASSIGN(ExternalProcessImporterBridge);
102 #endif // CHROME_UTILITY_IMPORTER_EXTERNAL_PROCESS_IMPORTER_BRIDGE_H_