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" |
11 #include "base/process/process_handle.h" | 11 #include "base/process/process_handle.h" |
12 #include "chrome/common/chrome_utility_messages.h" | 12 #include "chrome/common/chrome_utility_messages.h" |
13 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" | 13 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" |
14 #include "content/public/browser/child_process_data.h" | 14 #include "content/public/browser/child_process_data.h" |
15 #include "content/public/browser/utility_process_host.h" | 15 #include "content/public/browser/utility_process_host.h" |
16 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
17 #include "ipc/ipc_message_macros.h" | 17 #include "ipc/ipc_message_macros.h" |
18 #include "ipc/ipc_platform_file.h" | 18 #include "ipc/ipc_platform_file.h" |
19 | 19 |
20 SafeAudioVideoChecker::SafeAudioVideoChecker( | 20 SafeAudioVideoChecker::SafeAudioVideoChecker( |
21 base::File file, | 21 base::File file, |
22 const fileapi::CopyOrMoveFileValidator::ResultCallback& callback) | 22 const storage::CopyOrMoveFileValidator::ResultCallback& callback) |
23 : state_(INITIAL_STATE), | 23 : state_(INITIAL_STATE), file_(file.Pass()), callback_(callback) { |
24 file_(file.Pass()), | |
25 callback_(callback) { | |
26 DCHECK(!callback.is_null()); | 24 DCHECK(!callback.is_null()); |
27 } | 25 } |
28 | 26 |
29 void SafeAudioVideoChecker::Start() { | 27 void SafeAudioVideoChecker::Start() { |
30 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 28 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
31 if (state_ != INITIAL_STATE) | 29 if (state_ != INITIAL_STATE) |
32 return; | 30 return; |
33 state_ = PINGED_STATE; | 31 state_ = PINGED_STATE; |
34 | 32 |
35 if (!file_.IsValid()) { | 33 if (!file_.IsValid()) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 bool handled = true; | 81 bool handled = true; |
84 IPC_BEGIN_MESSAGE_MAP(SafeAudioVideoChecker, message) | 82 IPC_BEGIN_MESSAGE_MAP(SafeAudioVideoChecker, message) |
85 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ProcessStarted, | 83 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ProcessStarted, |
86 OnProcessStarted) | 84 OnProcessStarted) |
87 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_CheckMediaFile_Finished, | 85 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_CheckMediaFile_Finished, |
88 OnCheckingFinished) | 86 OnCheckingFinished) |
89 IPC_MESSAGE_UNHANDLED(handled = false) | 87 IPC_MESSAGE_UNHANDLED(handled = false) |
90 IPC_END_MESSAGE_MAP() | 88 IPC_END_MESSAGE_MAP() |
91 return handled; | 89 return handled; |
92 } | 90 } |
OLD | NEW |