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 #include "chrome/utility/chrome_content_utility_client.h" | 5 #include "chrome/utility/chrome_content_utility_client.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 Send(new ChromeUtilityHostMsg_DecodeImage_Failed()); | 244 Send(new ChromeUtilityHostMsg_DecodeImage_Failed()); |
245 } | 245 } |
246 ReleaseProcessIfNeeded(); | 246 ReleaseProcessIfNeeded(); |
247 } | 247 } |
248 | 248 |
249 void ChromeContentUtilityClient::OnPatchFileBsdiff( | 249 void ChromeContentUtilityClient::OnPatchFileBsdiff( |
250 const base::FilePath& input_file, | 250 const base::FilePath& input_file, |
251 const base::FilePath& patch_file, | 251 const base::FilePath& patch_file, |
252 const base::FilePath& output_file) { | 252 const base::FilePath& output_file) { |
253 if (input_file.empty() || patch_file.empty() || output_file.empty()) { | 253 if (input_file.empty() || patch_file.empty() || output_file.empty()) { |
254 Send(new ChromeUtilityHostMsg_PatchFile_Failed(-1)); | 254 Send(new ChromeUtilityHostMsg_PatchFile_Finished(-1)); |
255 } else { | 255 } else { |
256 const int patch_status = courgette::ApplyBinaryPatch(input_file, | 256 const int patch_status = courgette::ApplyBinaryPatch(input_file, |
257 patch_file, | 257 patch_file, |
258 output_file); | 258 output_file); |
259 if (patch_status != courgette::OK) | 259 Send(new ChromeUtilityHostMsg_PatchFile_Finished(patch_status)); |
260 Send(new ChromeUtilityHostMsg_PatchFile_Failed(patch_status)); | |
261 else | |
262 Send(new ChromeUtilityHostMsg_PatchFile_Succeeded()); | |
263 } | 260 } |
264 ReleaseProcessIfNeeded(); | 261 ReleaseProcessIfNeeded(); |
265 } | 262 } |
266 | 263 |
267 void ChromeContentUtilityClient::OnPatchFileCourgette( | 264 void ChromeContentUtilityClient::OnPatchFileCourgette( |
268 const base::FilePath& input_file, | 265 const base::FilePath& input_file, |
269 const base::FilePath& patch_file, | 266 const base::FilePath& patch_file, |
270 const base::FilePath& output_file) { | 267 const base::FilePath& output_file) { |
271 if (input_file.empty() || patch_file.empty() || output_file.empty()) { | 268 if (input_file.empty() || patch_file.empty() || output_file.empty()) { |
272 Send(new ChromeUtilityHostMsg_PatchFile_Failed(-1)); | 269 Send(new ChromeUtilityHostMsg_PatchFile_Finished(-1)); |
273 } else { | 270 } else { |
274 const int patch_status = courgette::ApplyEnsemblePatch( | 271 const int patch_status = courgette::ApplyEnsemblePatch( |
275 input_file.value().c_str(), | 272 input_file.value().c_str(), |
276 patch_file.value().c_str(), | 273 patch_file.value().c_str(), |
277 output_file.value().c_str()); | 274 output_file.value().c_str()); |
278 if (patch_status != courgette::C_OK) | 275 Send(new ChromeUtilityHostMsg_PatchFile_Finished(patch_status)); |
279 Send(new ChromeUtilityHostMsg_PatchFile_Failed(patch_status)); | |
280 else | |
281 Send(new ChromeUtilityHostMsg_PatchFile_Succeeded()); | |
282 } | 276 } |
283 ReleaseProcessIfNeeded(); | 277 ReleaseProcessIfNeeded(); |
284 } | 278 } |
285 | 279 |
286 void ChromeContentUtilityClient::OnStartupPing() { | 280 void ChromeContentUtilityClient::OnStartupPing() { |
287 Send(new ChromeUtilityHostMsg_ProcessStarted); | 281 Send(new ChromeUtilityHostMsg_ProcessStarted); |
288 // Don't release the process, we assume further messages are on the way. | 282 // Don't release the process, we assume further messages are on the way. |
289 } | 283 } |
290 | 284 |
291 #if defined(FULL_SAFE_BROWSING) | 285 #if defined(FULL_SAFE_BROWSING) |
(...skipping 15 matching lines...) Expand all Loading... |
307 const std::string& mime_type, int64 total_size, bool get_attached_images) { | 301 const std::string& mime_type, int64 total_size, bool get_attached_images) { |
308 // Only one IPCDataSource may be created and added to the list of handlers. | 302 // Only one IPCDataSource may be created and added to the list of handlers. |
309 metadata::IPCDataSource* source = new metadata::IPCDataSource(total_size); | 303 metadata::IPCDataSource* source = new metadata::IPCDataSource(total_size); |
310 handlers_.push_back(source); | 304 handlers_.push_back(source); |
311 | 305 |
312 metadata::MediaMetadataParser* parser = new metadata::MediaMetadataParser( | 306 metadata::MediaMetadataParser* parser = new metadata::MediaMetadataParser( |
313 source, mime_type, get_attached_images); | 307 source, mime_type, get_attached_images); |
314 parser->Start(base::Bind(&FinishParseMediaMetadata, base::Owned(parser))); | 308 parser->Start(base::Bind(&FinishParseMediaMetadata, base::Owned(parser))); |
315 } | 309 } |
316 #endif | 310 #endif |
OLD | NEW |