OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_IMPORTER_IMPORTER_BRIDGE_H_ | 5 #ifndef CHROME_BROWSER_IMPORTER_IMPORTER_BRIDGE_H_ |
6 #define CHROME_BROWSER_IMPORTER_IMPORTER_BRIDGE_H_ | 6 #define CHROME_BROWSER_IMPORTER_IMPORTER_BRIDGE_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/string16.h" | 13 #include "base/string16.h" |
14 | 14 |
15 #include "chrome/browser/importer/importer.h" | 15 #include "chrome/browser/importer/importer.h" |
16 // TODO: remove this, see friend declaration in ImporterBridge. | 16 // TODO: remove this, see friend declaration in ImporterBridge. |
17 #include "chrome/browser/importer/toolbar_importer.h" | 17 #include "chrome/browser/importer/toolbar_importer.h" |
18 | 18 |
19 class ImporterBridge : public base::RefCountedThreadSafe<ImporterBridge> { | 19 class ImporterBridge : public base::RefCountedThreadSafe<ImporterBridge> { |
20 public: | 20 public: |
21 ImporterBridge(ProfileWriter* writer, | 21 ImporterBridge(ProfileWriter* writer, |
22 MessageLoop* delegate_loop, | |
23 ImporterHost* host) | 22 ImporterHost* host) |
24 : writer_(writer), | 23 : writer_(writer), |
25 delegate_loop_(delegate_loop), | |
26 host_(host) { | 24 host_(host) { |
27 } | 25 } |
28 virtual ~ImporterBridge() {} | 26 virtual ~ImporterBridge() {} |
29 | 27 |
30 virtual void AddBookmarkEntries( | 28 virtual void AddBookmarkEntries( |
31 const std::vector<ProfileWriter::BookmarkEntry>& bookmarks, | 29 const std::vector<ProfileWriter::BookmarkEntry>& bookmarks, |
32 const std::wstring& first_folder_name, | 30 const std::wstring& first_folder_name, |
33 int options) = 0; | 31 int options) = 0; |
34 virtual void AddHomePage(const GURL &home_page) = 0; | 32 virtual void AddHomePage(const GURL &home_page) = 0; |
35 | 33 |
(...skipping 24 matching lines...) Expand all Loading... |
60 virtual void NotifyEnded() = 0; | 58 virtual void NotifyEnded() = 0; |
61 | 59 |
62 protected: | 60 protected: |
63 | 61 |
64 // TODO: In order to run Toolbar5Importer OOP we need to cut this | 62 // TODO: In order to run Toolbar5Importer OOP we need to cut this |
65 // connection, but as an interim step we allow Toolbar5Import to break | 63 // connection, but as an interim step we allow Toolbar5Import to break |
66 // the abstraction here and assume import is in-process. | 64 // the abstraction here and assume import is in-process. |
67 friend class Toolbar5Importer; | 65 friend class Toolbar5Importer; |
68 | 66 |
69 ProfileWriter* writer_; | 67 ProfileWriter* writer_; |
70 MessageLoop* delegate_loop_; | |
71 ImporterHost* host_; | 68 ImporterHost* host_; |
72 | 69 |
73 DISALLOW_COPY_AND_ASSIGN(ImporterBridge); | 70 DISALLOW_COPY_AND_ASSIGN(ImporterBridge); |
74 }; | 71 }; |
75 | 72 |
76 class InProcessImporterBridge : public ImporterBridge { | 73 class InProcessImporterBridge : public ImporterBridge { |
77 public: | 74 public: |
78 InProcessImporterBridge(ProfileWriter* writer, | 75 InProcessImporterBridge(ProfileWriter* writer, |
79 MessageLoop* delegate_loop, | |
80 ImporterHost* host); | 76 ImporterHost* host); |
81 | 77 |
82 // Methods inherited from ImporterBridge. | 78 // Methods inherited from ImporterBridge. |
83 virtual void AddBookmarkEntries( | 79 virtual void AddBookmarkEntries( |
84 const std::vector<ProfileWriter::BookmarkEntry>& bookmarks, | 80 const std::vector<ProfileWriter::BookmarkEntry>& bookmarks, |
85 const std::wstring& first_folder_name, | 81 const std::wstring& first_folder_name, |
86 int options); | 82 int options); |
87 virtual void AddHomePage(const GURL &home_page); | 83 virtual void AddHomePage(const GURL &home_page); |
88 | 84 |
89 #if defined(OS_WIN) | 85 #if defined(OS_WIN) |
90 virtual void AddIE7PasswordInfo(const IE7PasswordInfo password_info); | 86 virtual void AddIE7PasswordInfo(const IE7PasswordInfo password_info); |
91 #endif | 87 #endif |
92 | 88 |
93 virtual void SetFavIcons( | 89 virtual void SetFavIcons( |
94 const std::vector<history::ImportedFavIconUsage>& fav_icons); | 90 const std::vector<history::ImportedFavIconUsage>& fav_icons); |
95 virtual void SetHistoryItems(const std::vector<history::URLRow> &rows); | 91 virtual void SetHistoryItems(const std::vector<history::URLRow> &rows); |
96 virtual void SetKeywords(const std::vector<TemplateURL*>& template_urls, | 92 virtual void SetKeywords(const std::vector<TemplateURL*>& template_urls, |
97 int default_keyword_index, | 93 int default_keyword_index, |
98 bool unique_on_host_and_path); | 94 bool unique_on_host_and_path); |
99 virtual void SetPasswordForm(const webkit_glue::PasswordForm& form); | 95 virtual void SetPasswordForm(const webkit_glue::PasswordForm& form); |
100 | 96 |
101 virtual void NotifyItemStarted(ImportItem item); | 97 virtual void NotifyItemStarted(ImportItem item); |
102 virtual void NotifyItemEnded(ImportItem item); | 98 virtual void NotifyItemEnded(ImportItem item); |
103 virtual void NotifyStarted(); | 99 virtual void NotifyStarted(); |
104 virtual void NotifyEnded(); | 100 virtual void NotifyEnded(); |
105 | 101 |
106 private: | 102 private: |
107 MessageLoop* main_loop_; | |
108 MessageLoop* delegate_loop_; | |
109 DISALLOW_COPY_AND_ASSIGN(InProcessImporterBridge); | 103 DISALLOW_COPY_AND_ASSIGN(InProcessImporterBridge); |
110 }; | 104 }; |
111 | 105 |
112 #endif // CHROME_BROWSER_IMPORTER_IMPORTER_BRIDGE_H_ | 106 #endif // CHROME_BROWSER_IMPORTER_IMPORTER_BRIDGE_H_ |
OLD | NEW |