OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_EXTERNAL_PROCESS_IMPORTER_CLIENT_H_ | 5 #ifndef CHROME_BROWSER_IMPORTER_EXTERNAL_PROCESS_IMPORTER_CLIENT_H_ |
6 #define CHROME_BROWSER_IMPORTER_EXTERNAL_PROCESS_IMPORTER_CLIENT_H_ | 6 #define CHROME_BROWSER_IMPORTER_EXTERNAL_PROCESS_IMPORTER_CLIENT_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 // This class is the client for the out of process profile importing. It | 33 // This class is the client for the out of process profile importing. It |
34 // collects notifications from this process host and feeds data back to the | 34 // collects notifications from this process host and feeds data back to the |
35 // importer host, who actually does the writing. | 35 // importer host, who actually does the writing. |
36 class ExternalProcessImporterClient : public content::UtilityProcessHostClient { | 36 class ExternalProcessImporterClient : public content::UtilityProcessHostClient { |
37 public: | 37 public: |
38 ExternalProcessImporterClient(ExternalProcessImporterHost* importer_host, | 38 ExternalProcessImporterClient(ExternalProcessImporterHost* importer_host, |
39 const importer::SourceProfile& source_profile, | 39 const importer::SourceProfile& source_profile, |
40 uint16 items, | 40 uint16 items, |
41 InProcessImporterBridge* bridge); | 41 InProcessImporterBridge* bridge); |
42 virtual ~ExternalProcessImporterClient(); | |
43 | 42 |
44 // Launches the task to start the external process. | 43 // Launches the task to start the external process. |
45 void Start(); | 44 void Start(); |
46 | 45 |
47 // Called by the ExternalProcessImporterHost on import cancel. | 46 // Called by the ExternalProcessImporterHost on import cancel. |
48 void Cancel(); | 47 void Cancel(); |
49 | 48 |
50 // UtilityProcessHostClient implementation: | 49 // UtilityProcessHostClient implementation: |
51 virtual void OnProcessCrashed(int exit_code) OVERRIDE; | 50 virtual void OnProcessCrashed(int exit_code) OVERRIDE; |
52 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 51 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
(...skipping 13 matching lines...) Expand all Loading... |
66 const std::vector<ProfileWriter::BookmarkEntry>& bookmarks_group); | 65 const std::vector<ProfileWriter::BookmarkEntry>& bookmarks_group); |
67 void OnFaviconsImportStart(size_t total_favicons_count); | 66 void OnFaviconsImportStart(size_t total_favicons_count); |
68 void OnFaviconsImportGroup( | 67 void OnFaviconsImportGroup( |
69 const std::vector<history::ImportedFaviconUsage>& favicons_group); | 68 const std::vector<history::ImportedFaviconUsage>& favicons_group); |
70 void OnPasswordFormImportReady(const webkit::forms::PasswordForm& form); | 69 void OnPasswordFormImportReady(const webkit::forms::PasswordForm& form); |
71 // WARNING: This function takes ownership of (and deletes) the pointers in | 70 // WARNING: This function takes ownership of (and deletes) the pointers in |
72 // |template_urls|! | 71 // |template_urls|! |
73 void OnKeywordsImportReady(const std::vector<TemplateURL*>& template_urls, | 72 void OnKeywordsImportReady(const std::vector<TemplateURL*>& template_urls, |
74 bool unique_on_host_and_path); | 73 bool unique_on_host_and_path); |
75 | 74 |
| 75 protected: |
| 76 virtual ~ExternalProcessImporterClient(); |
| 77 |
76 private: | 78 private: |
77 // Notifies the importerhost that import has finished, and calls Release(). | 79 // Notifies the importerhost that import has finished, and calls Release(). |
78 void Cleanup(); | 80 void Cleanup(); |
79 | 81 |
80 // Cancel import process on IO thread. | 82 // Cancel import process on IO thread. |
81 void CancelImportProcessOnIOThread(); | 83 void CancelImportProcessOnIOThread(); |
82 | 84 |
83 // Report item completely downloaded on IO thread. | 85 // Report item completely downloaded on IO thread. |
84 void NotifyItemFinishedOnIOThread(importer::ImportItem import_item); | 86 void NotifyItemFinishedOnIOThread(importer::ImportItem import_item); |
85 | 87 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 // ProfileWriter. | 126 // ProfileWriter. |
125 scoped_refptr<InProcessImporterBridge> bridge_; | 127 scoped_refptr<InProcessImporterBridge> bridge_; |
126 | 128 |
127 // True if import process has been cancelled. | 129 // True if import process has been cancelled. |
128 bool cancelled_; | 130 bool cancelled_; |
129 | 131 |
130 DISALLOW_COPY_AND_ASSIGN(ExternalProcessImporterClient); | 132 DISALLOW_COPY_AND_ASSIGN(ExternalProcessImporterClient); |
131 }; | 133 }; |
132 | 134 |
133 #endif // CHROME_BROWSER_IMPORTER_EXTERNAL_PROCESS_IMPORTER_CLIENT_H_ | 135 #endif // CHROME_BROWSER_IMPORTER_EXTERNAL_PROCESS_IMPORTER_CLIENT_H_ |
OLD | NEW |