| 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 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SAFE_AUDIO_VIDEO_CHECKER_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SAFE_AUDIO_VIDEO_CHECKER_H_ |
| 6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SAFE_AUDIO_VIDEO_CHECKER_H_ | 6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SAFE_AUDIO_VIDEO_CHECKER_H_ |
| 7 | 7 |
| 8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
| 9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 SafeAudioVideoChecker( | 27 SafeAudioVideoChecker( |
| 28 base::File file, | 28 base::File file, |
| 29 const storage::CopyOrMoveFileValidator::ResultCallback& callback); | 29 const storage::CopyOrMoveFileValidator::ResultCallback& callback); |
| 30 | 30 |
| 31 // Must be called on the IO thread. | 31 // Must be called on the IO thread. |
| 32 void Start(); | 32 void Start(); |
| 33 | 33 |
| 34 private: | 34 private: |
| 35 enum State { | 35 enum State { |
| 36 INITIAL_STATE, | 36 INITIAL_STATE, |
| 37 PINGED_STATE, | |
| 38 STARTED_STATE, | 37 STARTED_STATE, |
| 39 FINISHED_STATE | 38 FINISHED_STATE |
| 40 }; | 39 }; |
| 41 | 40 |
| 42 ~SafeAudioVideoChecker() override; | 41 ~SafeAudioVideoChecker() override; |
| 43 | 42 |
| 44 // Starts validation once the utility process has been started. | |
| 45 virtual void OnProcessStarted(); | |
| 46 | |
| 47 // Notification of the result from the utility process. | 43 // Notification of the result from the utility process. |
| 48 void OnCheckingFinished(bool valid); | 44 void OnCheckingFinished(bool valid); |
| 49 | 45 |
| 50 // UtilityProcessHostClient implementation. | 46 // UtilityProcessHostClient implementation. |
| 51 void OnProcessCrashed(int exit_code) override; | 47 void OnProcessCrashed(int exit_code) override; |
| 52 bool OnMessageReceived(const IPC::Message& message) override; | 48 bool OnMessageReceived(const IPC::Message& message) override; |
| 53 | 49 |
| 54 State state_; | 50 State state_; |
| 55 | 51 |
| 56 base::File file_; | 52 base::File file_; |
| 57 | 53 |
| 58 const storage::CopyOrMoveFileValidator::ResultCallback callback_; | 54 const storage::CopyOrMoveFileValidator::ResultCallback callback_; |
| 59 | 55 |
| 60 base::WeakPtr<content::UtilityProcessHost> utility_process_host_; | 56 base::WeakPtr<content::UtilityProcessHost> utility_process_host_; |
| 61 | 57 |
| 62 DISALLOW_COPY_AND_ASSIGN(SafeAudioVideoChecker); | 58 DISALLOW_COPY_AND_ASSIGN(SafeAudioVideoChecker); |
| 63 }; | 59 }; |
| 64 | 60 |
| 65 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SAFE_AUDIO_VIDEO_CHECKER_H_ | 61 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SAFE_AUDIO_VIDEO_CHECKER_H_ |
| OLD | NEW |