OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_PROFILE_IMPORT_PROCESS_HOST_H_ | 5 #ifndef CHROME_BROWSER_PROFILE_IMPORT_PROCESS_HOST_H_ |
6 #define CHROME_BROWSER_PROFILE_IMPORT_PROCESS_HOST_H_ | 6 #define CHROME_BROWSER_PROFILE_IMPORT_PROCESS_HOST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 22 matching lines...) Expand all Loading... |
33 // ProfileImportProcessHost calls the client's functions on the thread passed | 33 // ProfileImportProcessHost calls the client's functions on the thread passed |
34 // to it when it's created. | 34 // to it when it's created. |
35 class ImportProcessClient : | 35 class ImportProcessClient : |
36 public base::RefCountedThreadSafe<ImportProcessClient> { | 36 public base::RefCountedThreadSafe<ImportProcessClient> { |
37 public: | 37 public: |
38 ImportProcessClient(); | 38 ImportProcessClient(); |
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() {} | 43 virtual void OnProcessCrashed(int exit_status) {} |
44 virtual void OnImportStart() {} | 44 virtual void OnImportStart() {} |
45 virtual void OnImportFinished(bool succeeded, std::string error_msg) {} | 45 virtual void OnImportFinished(bool succeeded, 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(std::string error_msg) {} | 48 virtual void OnImportItemFailed(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( |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 119 |
120 private: | 120 private: |
121 // Launch the new process. | 121 // Launch the new process. |
122 bool StartProcess(); | 122 bool StartProcess(); |
123 | 123 |
124 // Called by the external importer process to send messages back to the | 124 // Called by the external importer process to send messages back to the |
125 // ImportProcessClient. | 125 // ImportProcessClient. |
126 virtual void OnMessageReceived(const IPC::Message& message); | 126 virtual void OnMessageReceived(const IPC::Message& message); |
127 | 127 |
128 // Overridden from BrowserChildProcessHost: | 128 // Overridden from BrowserChildProcessHost: |
129 virtual void OnProcessCrashed(); | 129 virtual void OnProcessCrashed(int exit_code); |
130 virtual bool CanShutdown(); | 130 virtual bool CanShutdown(); |
131 virtual URLRequestContext* GetRequestContext( | 131 virtual URLRequestContext* GetRequestContext( |
132 uint32 request_id, | 132 uint32 request_id, |
133 const ViewHostMsg_Resource_Request& request_data); | 133 const ViewHostMsg_Resource_Request& request_data); |
134 | 134 |
135 // Receives messages to be passed back to the importer host. | 135 // Receives messages to be passed back to the importer host. |
136 scoped_refptr<ImportProcessClient> import_process_client_; | 136 scoped_refptr<ImportProcessClient> import_process_client_; |
137 | 137 |
138 // The thread where the import_process_client_ lives. | 138 // The thread where the import_process_client_ lives. |
139 BrowserThread::ID thread_id_; | 139 BrowserThread::ID thread_id_; |
140 | 140 |
141 DISALLOW_COPY_AND_ASSIGN(ProfileImportProcessHost); | 141 DISALLOW_COPY_AND_ASSIGN(ProfileImportProcessHost); |
142 }; | 142 }; |
143 | 143 |
144 #endif // CHROME_BROWSER_PROFILE_IMPORT_PROCESS_HOST_H_ | 144 #endif // CHROME_BROWSER_PROFILE_IMPORT_PROCESS_HOST_H_ |
OLD | NEW |