| 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 | 7 |
| 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
| 8 #include <string> | 11 #include <string> |
| 9 #include <vector> | 12 #include <vector> |
| 10 | 13 |
| 11 #include "base/basictypes.h" | |
| 12 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/macros.h" |
| 13 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 14 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
| 18 #include "build/build_config.h" |
| 15 #include "chrome/common/importer/importer_autofill_form_data_entry.h" | 19 #include "chrome/common/importer/importer_autofill_form_data_entry.h" |
| 16 #include "chrome/common/importer/importer_data_types.h" | 20 #include "chrome/common/importer/importer_data_types.h" |
| 17 #include "chrome/common/importer/importer_url_row.h" | 21 #include "chrome/common/importer/importer_url_row.h" |
| 18 #include "components/favicon_base/favicon_usage_data.h" | 22 #include "components/favicon_base/favicon_usage_data.h" |
| 19 #include "components/history/core/browser/history_types.h" | 23 #include "components/history/core/browser/history_types.h" |
| 20 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
| 21 #include "content/public/browser/utility_process_host_client.h" | 25 #include "content/public/browser/utility_process_host_client.h" |
| 22 | 26 |
| 23 class ExternalProcessImporterHost; | 27 class ExternalProcessImporterHost; |
| 24 struct ImportedBookmarkEntry; | 28 struct ImportedBookmarkEntry; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 41 } | 45 } |
| 42 | 46 |
| 43 // This class is the client for the out of process profile importing. It | 47 // This class is the client for the out of process profile importing. It |
| 44 // collects notifications from this process host and feeds data back to the | 48 // collects notifications from this process host and feeds data back to the |
| 45 // importer host, who actually does the writing. | 49 // importer host, who actually does the writing. |
| 46 class ExternalProcessImporterClient : public content::UtilityProcessHostClient { | 50 class ExternalProcessImporterClient : public content::UtilityProcessHostClient { |
| 47 public: | 51 public: |
| 48 ExternalProcessImporterClient( | 52 ExternalProcessImporterClient( |
| 49 base::WeakPtr<ExternalProcessImporterHost> importer_host, | 53 base::WeakPtr<ExternalProcessImporterHost> importer_host, |
| 50 const importer::SourceProfile& source_profile, | 54 const importer::SourceProfile& source_profile, |
| 51 uint16 items, | 55 uint16_t items, |
| 52 InProcessImporterBridge* bridge); | 56 InProcessImporterBridge* bridge); |
| 53 | 57 |
| 54 // Launches the task to start the external process. | 58 // Launches the task to start the external process. |
| 55 void Start(); | 59 void Start(); |
| 56 | 60 |
| 57 // Called by the ExternalProcessImporterHost on import cancel. | 61 // Called by the ExternalProcessImporterHost on import cancel. |
| 58 void Cancel(); | 62 void Cancel(); |
| 59 | 63 |
| 60 // UtilityProcessHostClient implementation: | 64 // UtilityProcessHostClient implementation: |
| 61 void OnProcessCrashed(int exit_code) override; | 65 void OnProcessCrashed(int exit_code) override; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 // OnProcessCrashed() after NotifyImportEnded()). | 144 // OnProcessCrashed() after NotifyImportEnded()). |
| 141 base::WeakPtr<ExternalProcessImporterHost> process_importer_host_; | 145 base::WeakPtr<ExternalProcessImporterHost> process_importer_host_; |
| 142 | 146 |
| 143 // Handles sending messages to the external process. Deletes itself when | 147 // Handles sending messages to the external process. Deletes itself when |
| 144 // the external process dies (see | 148 // the external process dies (see |
| 145 // BrowserChildProcessHost::OnChildDisconnected). | 149 // BrowserChildProcessHost::OnChildDisconnected). |
| 146 base::WeakPtr<content::UtilityProcessHost> utility_process_host_; | 150 base::WeakPtr<content::UtilityProcessHost> utility_process_host_; |
| 147 | 151 |
| 148 // Data to be passed from the importer host to the external importer. | 152 // Data to be passed from the importer host to the external importer. |
| 149 importer::SourceProfile source_profile_; | 153 importer::SourceProfile source_profile_; |
| 150 uint16 items_; | 154 uint16_t items_; |
| 151 | 155 |
| 152 // Takes import data coming over IPC and delivers it to be written by the | 156 // Takes import data coming over IPC and delivers it to be written by the |
| 153 // ProfileWriter. | 157 // ProfileWriter. |
| 154 scoped_refptr<InProcessImporterBridge> bridge_; | 158 scoped_refptr<InProcessImporterBridge> bridge_; |
| 155 | 159 |
| 156 // True if import process has been cancelled. | 160 // True if import process has been cancelled. |
| 157 bool cancelled_; | 161 bool cancelled_; |
| 158 | 162 |
| 159 DISALLOW_COPY_AND_ASSIGN(ExternalProcessImporterClient); | 163 DISALLOW_COPY_AND_ASSIGN(ExternalProcessImporterClient); |
| 160 }; | 164 }; |
| 161 | 165 |
| 162 #endif // CHROME_BROWSER_IMPORTER_EXTERNAL_PROCESS_IMPORTER_CLIENT_H_ | 166 #endif // CHROME_BROWSER_IMPORTER_EXTERNAL_PROCESS_IMPORTER_CLIENT_H_ |
| OLD | NEW |