OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/media_galleries/fileapi/safe_audio_video_checker.h" | 5 #include "chrome/browser/media_galleries/fileapi/safe_audio_video_checker.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 DCHECK(file_closer_); | 35 DCHECK(file_closer_); |
36 if (*file_closer_.get() == base::kInvalidPlatformFileValue) { | 36 if (*file_closer_.get() == base::kInvalidPlatformFileValue) { |
37 callback_.Run(base::PLATFORM_FILE_ERROR_SECURITY); | 37 callback_.Run(base::PLATFORM_FILE_ERROR_SECURITY); |
38 state_ = FINISHED_STATE; | 38 state_ = FINISHED_STATE; |
39 return; | 39 return; |
40 } | 40 } |
41 | 41 |
42 utility_process_host_ = content::UtilityProcessHost::Create( | 42 utility_process_host_ = content::UtilityProcessHost::Create( |
43 this, base::MessageLoopProxy::current())->AsWeakPtr(); | 43 this, base::MessageLoopProxy::current())->AsWeakPtr(); |
44 utility_process_host_->EnableZygote(); | |
45 utility_process_host_->Send(new ChromeUtilityMsg_StartupPing); | 44 utility_process_host_->Send(new ChromeUtilityMsg_StartupPing); |
46 } | 45 } |
47 | 46 |
48 SafeAudioVideoChecker::~SafeAudioVideoChecker() {} | 47 SafeAudioVideoChecker::~SafeAudioVideoChecker() {} |
49 | 48 |
50 void SafeAudioVideoChecker::OnProcessStarted() { | 49 void SafeAudioVideoChecker::OnProcessStarted() { |
51 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 50 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
52 if (state_ != PINGED_STATE) | 51 if (state_ != PINGED_STATE) |
53 return; | 52 return; |
54 state_ = STARTED_STATE; | 53 state_ = STARTED_STATE; |
(...skipping 27 matching lines...) Expand all Loading... |
82 bool handled = true; | 81 bool handled = true; |
83 IPC_BEGIN_MESSAGE_MAP(SafeAudioVideoChecker, message) | 82 IPC_BEGIN_MESSAGE_MAP(SafeAudioVideoChecker, message) |
84 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ProcessStarted, | 83 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ProcessStarted, |
85 OnProcessStarted) | 84 OnProcessStarted) |
86 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_CheckMediaFile_Finished, | 85 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_CheckMediaFile_Finished, |
87 OnCheckingFinished) | 86 OnCheckingFinished) |
88 IPC_MESSAGE_UNHANDLED(handled = false) | 87 IPC_MESSAGE_UNHANDLED(handled = false) |
89 IPC_END_MESSAGE_MAP() | 88 IPC_END_MESSAGE_MAP() |
90 return handled; | 89 return handled; |
91 } | 90 } |
OLD | NEW |