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 #include "chrome/browser/profile_import_process_host.h" | 5 #include "chrome/browser/profile_import_process_host.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 Launch(no_exposed_directory, cmd_line); | 111 Launch(no_exposed_directory, cmd_line); |
112 #else | 112 #else |
113 base::environment_vector env; | 113 base::environment_vector env; |
114 | 114 |
115 Launch(false, env, cmd_line); | 115 Launch(false, env, cmd_line); |
116 #endif | 116 #endif |
117 | 117 |
118 return true; | 118 return true; |
119 } | 119 } |
120 | 120 |
121 void ProfileImportProcessHost::OnMessageReceived(const IPC::Message& message) { | 121 bool ProfileImportProcessHost::OnMessageReceived(const IPC::Message& message) { |
122 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 122 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
123 BrowserThread::PostTask( | 123 BrowserThread::PostTask( |
124 thread_id_, FROM_HERE, | 124 thread_id_, FROM_HERE, |
125 NewRunnableMethod(import_process_client_.get(), | 125 NewRunnableMethod(import_process_client_.get(), |
126 &ImportProcessClient::OnMessageReceived, | 126 &ImportProcessClient::OnMessageReceived, |
127 message)); | 127 message)); |
| 128 return true; |
128 } | 129 } |
129 | 130 |
130 void ProfileImportProcessHost::OnProcessCrashed(int exit_code) { | 131 void ProfileImportProcessHost::OnProcessCrashed(int exit_code) { |
131 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 132 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
132 BrowserThread::PostTask( | 133 BrowserThread::PostTask( |
133 thread_id_, FROM_HERE, | 134 thread_id_, FROM_HERE, |
134 NewRunnableMethod(import_process_client_.get(), | 135 NewRunnableMethod(import_process_client_.get(), |
135 &ImportProcessClient::OnProcessCrashed, | 136 &ImportProcessClient::OnProcessCrashed, |
136 exit_code)); | 137 exit_code)); |
137 } | 138 } |
138 | 139 |
139 bool ProfileImportProcessHost::CanShutdown() { | 140 bool ProfileImportProcessHost::CanShutdown() { |
140 return true; | 141 return true; |
141 } | 142 } |
142 | 143 |
143 ProfileImportProcessHost::ImportProcessClient::ImportProcessClient() {} | 144 ProfileImportProcessHost::ImportProcessClient::ImportProcessClient() {} |
144 | 145 |
145 ProfileImportProcessHost::ImportProcessClient::~ImportProcessClient() {} | 146 ProfileImportProcessHost::ImportProcessClient::~ImportProcessClient() {} |
146 | 147 |
147 void ProfileImportProcessHost::ImportProcessClient::OnMessageReceived( | 148 bool ProfileImportProcessHost::ImportProcessClient::OnMessageReceived( |
148 const IPC::Message& message) { | 149 const IPC::Message& message) { |
| 150 bool handled = true; |
149 IPC_BEGIN_MESSAGE_MAP(ProfileImportProcessHost, message) | 151 IPC_BEGIN_MESSAGE_MAP(ProfileImportProcessHost, message) |
150 // Notification messages about the state of the import process. | 152 // Notification messages about the state of the import process. |
151 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_Import_Started, | 153 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_Import_Started, |
152 ImportProcessClient::OnImportStart) | 154 ImportProcessClient::OnImportStart) |
153 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_Import_Finished, | 155 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_Import_Finished, |
154 ImportProcessClient::OnImportFinished) | 156 ImportProcessClient::OnImportFinished) |
155 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_ImportItem_Started, | 157 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_ImportItem_Started, |
156 ImportProcessClient::OnImportItemStart) | 158 ImportProcessClient::OnImportItemStart) |
157 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_ImportItem_Finished, | 159 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_ImportItem_Finished, |
158 ImportProcessClient::OnImportItemFinished) | 160 ImportProcessClient::OnImportItemFinished) |
(...skipping 10 matching lines...) Expand all Loading... |
169 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyBookmarksImportGroup, | 171 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyBookmarksImportGroup, |
170 ImportProcessClient::OnBookmarksImportGroup) | 172 ImportProcessClient::OnBookmarksImportGroup) |
171 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyFavIconsImportStart, | 173 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyFavIconsImportStart, |
172 ImportProcessClient::OnFavIconsImportStart) | 174 ImportProcessClient::OnFavIconsImportStart) |
173 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyFavIconsImportGroup, | 175 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyFavIconsImportGroup, |
174 ImportProcessClient::OnFavIconsImportGroup) | 176 ImportProcessClient::OnFavIconsImportGroup) |
175 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyPasswordFormReady, | 177 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyPasswordFormReady, |
176 ImportProcessClient::OnPasswordFormImportReady) | 178 ImportProcessClient::OnPasswordFormImportReady) |
177 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyKeywordsReady, | 179 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyKeywordsReady, |
178 ImportProcessClient::OnKeywordsImportReady) | 180 ImportProcessClient::OnKeywordsImportReady) |
| 181 IPC_MESSAGE_UNHANDLED(handled = false) |
179 IPC_END_MESSAGE_MAP_EX() | 182 IPC_END_MESSAGE_MAP_EX() |
| 183 return handled; |
180 } | 184 } |
OLD | NEW |