• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2011 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.
4 
5 #ifndef CHROME_BROWSER_IMPORTER_IMPORTER_BRIDGE_H_
6 #define CHROME_BROWSER_IMPORTER_IMPORTER_BRIDGE_H_
7 #pragma once
8 
9 #include <vector>
10 
11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/string16.h"
14 #include "build/build_config.h"
15 #include "chrome/browser/importer/importer_data_types.h"
16 #include "chrome/browser/importer/profile_writer.h"
17 
18 // TODO: remove this, see friend declaration in ImporterBridge.
19 class Toolbar5Importer;
20 
21 class ImporterBridge : public base::RefCountedThreadSafe<ImporterBridge> {
22  public:
23   ImporterBridge();
24 
25   virtual void AddBookmarkEntries(
26       const std::vector<ProfileWriter::BookmarkEntry>& bookmarks,
27       const string16& first_folder_name,
28       int options) = 0;
29 
30   virtual void AddHomePage(const GURL& home_page) = 0;
31 
32 #if defined(OS_WIN)
33   virtual void AddIE7PasswordInfo(const IE7PasswordInfo& password_info) = 0;
34 #endif
35 
36   virtual void SetFavicons(
37       const std::vector<history::ImportedFaviconUsage>& favicons) = 0;
38 
39   virtual void SetHistoryItems(const std::vector<history::URLRow>& rows,
40                                history::VisitSource visit_source) = 0;
41 
42   virtual void SetKeywords(const std::vector<TemplateURL*>& template_urls,
43                            int default_keyword_index,
44                            bool unique_on_host_and_path) = 0;
45 
46   virtual void SetPasswordForm(const webkit_glue::PasswordForm& form) = 0;
47 
48   // Notifies the coordinator that the import operation has begun.
49   virtual void NotifyStarted() = 0;
50 
51   // Notifies the coordinator that the collection of data for the specified
52   // item has begun.
53   virtual void NotifyItemStarted(importer::ImportItem item) = 0;
54 
55   // Notifies the coordinator that the collection of data for the specified
56   // item has completed.
57   virtual void NotifyItemEnded(importer::ImportItem item) = 0;
58 
59   // Notifies the coordinator that the entire import operation has completed.
60   virtual void NotifyEnded() = 0;
61 
62   // For InProcessImporters this calls l10n_util. For ExternalProcessImporters
63   // this calls the set of strings we've ported over to the external process.
64   // It's good to avoid having to create a separate ResourceBundle for the
65   // external import process, since the importer only needs a few strings.
66   virtual string16 GetLocalizedString(int message_id) = 0;
67 
68  protected:
69   friend class base::RefCountedThreadSafe<ImporterBridge>;
70   // TODO: In order to run Toolbar5Importer OOP we need to cut this
71   // connection, but as an interim step we allow Toolbar5Import to break
72   // the abstraction here and assume import is in-process.
73   friend class Toolbar5Importer;
74 
75   virtual ~ImporterBridge();
76 
77   DISALLOW_COPY_AND_ASSIGN(ImporterBridge);
78 };
79 
80 #endif  // CHROME_BROWSER_IMPORTER_IMPORTER_BRIDGE_H_
81