OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_PROFILE_IMPORT_PROCESS_CLIENT_H_ | 5 #ifndef CHROME_BROWSER_IMPORTER_PROFILE_IMPORT_PROCESS_CLIENT_H_ |
6 #define CHROME_BROWSER_IMPORTER_PROFILE_IMPORT_PROCESS_CLIENT_H_ | 6 #define CHROME_BROWSER_IMPORTER_PROFILE_IMPORT_PROCESS_CLIENT_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 14 matching lines...) Expand all Loading... |
25 } | 25 } |
26 | 26 |
27 namespace webkit_glue { | 27 namespace webkit_glue { |
28 struct PasswordForm; | 28 struct PasswordForm; |
29 } | 29 } |
30 | 30 |
31 // An interface that must be implemented by consumers of the profile import | 31 // An interface that must be implemented by consumers of the profile import |
32 // process in order to get results back from the process host. The | 32 // process in order to get results back from the process host. The |
33 // ProfileImportProcessHost calls the client's functions on the thread passed to | 33 // ProfileImportProcessHost calls the client's functions on the thread passed to |
34 // it when it's created. | 34 // it when it's created. |
35 class ProfileImportProcessClient : | 35 class ProfileImportProcessClient |
36 public base::RefCountedThreadSafe<ProfileImportProcessClient> { | 36 : public base::RefCountedThreadSafe<ProfileImportProcessClient> { |
37 public: | 37 public: |
38 ProfileImportProcessClient(); | 38 ProfileImportProcessClient(); |
39 | 39 |
40 // These methods are used by the ProfileImportProcessHost to pass messages | 40 // These methods are used by the ProfileImportProcessHost to pass messages |
41 // received from the external process back to the ImportProcessClient in | 41 // received from the external process back to the ImportProcessClient in |
42 // ImporterHost. | 42 // ImporterHost. |
43 virtual void OnProcessCrashed(int exit_status); | 43 virtual void OnProcessCrashed(int exit_status); |
44 virtual void OnImportStart(); | 44 virtual void OnImportStart(); |
45 virtual void OnImportFinished(bool succeeded, const std::string& error_msg); | 45 virtual void OnImportFinished(bool succeeded, const std::string& error_msg); |
46 virtual void OnImportItemStart(int item); | 46 virtual void OnImportItemStart(int item); |
47 virtual void OnImportItemFinished(int item); | 47 virtual void OnImportItemFinished(int item); |
48 virtual void OnImportItemFailed(const std::string& error_msg); | 48 virtual void OnImportItemFailed(const std::string& error_msg); |
49 | 49 |
50 // These methods pass back data to be written to the user's profile from | 50 // These methods pass back data to be written to the user's profile from |
51 // the external process to the process host client. | 51 // the external process to the process host client. |
52 virtual void OnHistoryImportStart(size_t total_history_rows_count); | 52 virtual void OnHistoryImportStart(size_t total_history_rows_count); |
53 virtual void OnHistoryImportGroup( | 53 virtual void OnHistoryImportGroup( |
54 const std::vector<history::URLRow>& history_rows_group, | 54 const std::vector<history::URLRow>& history_rows_group, |
55 int visit_source); // visit_source has history::VisitSource type. | 55 int visit_source); // visit_source has history::VisitSource type. |
56 | 56 |
57 virtual void OnHomePageImportReady(const GURL& home_page); | 57 virtual void OnHomePageImportReady(const GURL& home_page); |
58 | 58 |
59 virtual void OnBookmarksImportStart( | 59 virtual void OnBookmarksImportStart(const string16& first_folder_name, |
60 const string16& first_folder_name, | 60 int options, |
61 int options, | 61 size_t total_bookmarks_count); |
62 size_t total_bookmarks_count); | |
63 virtual void OnBookmarksImportGroup( | 62 virtual void OnBookmarksImportGroup( |
64 const std::vector<ProfileWriter::BookmarkEntry>& bookmarks); | 63 const std::vector<ProfileWriter::BookmarkEntry>& bookmarks); |
65 | 64 |
66 virtual void OnFaviconsImportStart(size_t total_favicons_count); | 65 virtual void OnFaviconsImportStart(size_t total_favicons_count); |
67 virtual void OnFaviconsImportGroup( | 66 virtual void OnFaviconsImportGroup( |
68 const std::vector<history::ImportedFaviconUsage>& favicons_group); | 67 const std::vector<history::ImportedFaviconUsage>& favicons_group); |
69 | 68 |
70 virtual void OnPasswordFormImportReady( | 69 virtual void OnPasswordFormImportReady( |
71 const webkit_glue::PasswordForm& form); | 70 const webkit_glue::PasswordForm& form); |
72 | 71 |
73 virtual void OnKeywordsImportReady( | 72 virtual void OnKeywordsImportReady( |
74 const std::vector<TemplateURL>& template_urls, | 73 const std::vector<TemplateURL>& template_urls, |
75 int default_keyword_index, | 74 int default_keyword_index, |
76 bool unique_on_host_and_path); | 75 bool unique_on_host_and_path); |
77 | 76 |
78 virtual bool OnMessageReceived(const IPC::Message& message); | 77 virtual bool OnMessageReceived(const IPC::Message& message); |
79 | 78 |
80 protected: | 79 protected: |
81 friend class base::RefCountedThreadSafe<ProfileImportProcessClient>; | 80 friend class base::RefCountedThreadSafe<ProfileImportProcessClient>; |
82 | 81 |
83 virtual ~ProfileImportProcessClient(); | 82 virtual ~ProfileImportProcessClient(); |
84 | 83 |
85 private: | 84 private: |
86 friend class ProfileImportProcessHost; | 85 friend class ProfileImportProcessHost; |
87 | 86 |
88 DISALLOW_COPY_AND_ASSIGN(ProfileImportProcessClient); | 87 DISALLOW_COPY_AND_ASSIGN(ProfileImportProcessClient); |
89 }; | 88 }; |
90 | 89 |
91 #endif // CHROME_BROWSER_IMPORTER_PROFILE_IMPORT_PROCESS_CLIENT_H_ | 90 #endif // CHROME_BROWSER_IMPORTER_PROFILE_IMPORT_PROCESS_CLIENT_H_ |
OLD | NEW |