| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 private: | 119 private: |
| 120 // Launch the new process. | 120 // Launch the new process. |
| 121 bool StartProcess(); | 121 bool StartProcess(); |
| 122 | 122 |
| 123 // Called by the external importer process to send messages back to the | 123 // Called by the external importer process to send messages back to the |
| 124 // ImportProcessClient. | 124 // ImportProcessClient. |
| 125 void OnMessageReceived(const IPC::Message& message); | 125 void OnMessageReceived(const IPC::Message& message); |
| 126 | 126 |
| 127 // Overridden from BrowserChildProcessHost: | 127 // Overridden from BrowserChildProcessHost: |
| 128 virtual void OnProcessCrashed(); | 128 virtual void OnProcessCrashed(int exit_code); |
| 129 virtual bool CanShutdown() { return true; } | 129 virtual bool CanShutdown() { return true; } |
| 130 virtual URLRequestContext* GetRequestContext( | 130 virtual URLRequestContext* GetRequestContext( |
| 131 uint32 request_id, | 131 uint32 request_id, |
| 132 const ViewHostMsg_Resource_Request& request_data) { | 132 const ViewHostMsg_Resource_Request& request_data) { |
| 133 return NULL; | 133 return NULL; |
| 134 } | 134 } |
| 135 | 135 |
| 136 // Receives messages to be passed back to the importer host. | 136 // Receives messages to be passed back to the importer host. |
| 137 scoped_refptr<ImportProcessClient> import_process_client_; | 137 scoped_refptr<ImportProcessClient> import_process_client_; |
| 138 | 138 |
| 139 // The thread where the import_process_client_ lives. | 139 // The thread where the import_process_client_ lives. |
| 140 ChromeThread::ID thread_id_; | 140 ChromeThread::ID thread_id_; |
| 141 | 141 |
| 142 DISALLOW_COPY_AND_ASSIGN(ProfileImportProcessHost); | 142 DISALLOW_COPY_AND_ASSIGN(ProfileImportProcessHost); |
| 143 }; | 143 }; |
| 144 | 144 |
| 145 #endif // CHROME_BROWSER_PROFILE_IMPORT_PROCESS_HOST_H_ | 145 #endif // CHROME_BROWSER_PROFILE_IMPORT_PROCESS_HOST_H_ |
| OLD | NEW |