Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: chrome/browser/media_galleries/fileapi/safe_audio_video_checker.h

Issue 442383002: Move storage-related files from webkit/ to new top-level directory storage/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/callback_forward.h" 9 #include "base/callback_forward.h"
10 #include "base/files/file.h" 10 #include "base/files/file.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "content/public/browser/utility_process_host_client.h" 12 #include "content/public/browser/utility_process_host_client.h"
13 #include "webkit/browser/fileapi/copy_or_move_file_validator.h" 13 #include "storage/browser/fileapi/copy_or_move_file_validator.h"
14 14
15 namespace content { 15 namespace content {
16 class UtilityProcessHost; 16 class UtilityProcessHost;
17 } 17 }
18 18
19 // Uses a utility process to validate a media file. If the callback returns 19 // Uses a utility process to validate a media file. If the callback returns
20 // File::FILE_OK, then the file appears to be a valid media file. This does 20 // File::FILE_OK, then the file appears to be a valid media file. This does
21 // not attempt to decode the entire file, which may take a considerable amount 21 // not attempt to decode the entire file, which may take a considerable amount
22 // of time. This class may be constructed on any thread, but should run on the 22 // of time. This class may be constructed on any thread, but should run on the
23 // IO thread. 23 // IO thread.
24 class SafeAudioVideoChecker : public content::UtilityProcessHostClient { 24 class SafeAudioVideoChecker : public content::UtilityProcessHostClient {
25 public: 25 public:
26 // Takes responsibility for closing |file|. 26 // Takes responsibility for closing |file|.
27 SafeAudioVideoChecker( 27 SafeAudioVideoChecker(
28 base::File file, 28 base::File file,
29 const fileapi::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, 37 PINGED_STATE,
38 STARTED_STATE, 38 STARTED_STATE,
39 FINISHED_STATE 39 FINISHED_STATE
40 }; 40 };
41 41
42 virtual ~SafeAudioVideoChecker(); 42 virtual ~SafeAudioVideoChecker();
43 43
44 // Starts validation once the utility process has been started. 44 // Starts validation once the utility process has been started.
45 virtual void OnProcessStarted(); 45 virtual void OnProcessStarted();
46 46
47 // Notification of the result from the utility process. 47 // Notification of the result from the utility process.
48 void OnCheckingFinished(bool valid); 48 void OnCheckingFinished(bool valid);
49 49
50 // UtilityProcessHostClient implementation. 50 // UtilityProcessHostClient implementation.
51 virtual void OnProcessCrashed(int exit_code) OVERRIDE; 51 virtual void OnProcessCrashed(int exit_code) OVERRIDE;
52 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 52 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
53 53
54 State state_; 54 State state_;
55 55
56 base::File file_; 56 base::File file_;
57 57
58 const fileapi::CopyOrMoveFileValidator::ResultCallback callback_; 58 const storage::CopyOrMoveFileValidator::ResultCallback callback_;
59 59
60 base::WeakPtr<content::UtilityProcessHost> utility_process_host_; 60 base::WeakPtr<content::UtilityProcessHost> utility_process_host_;
61 61
62 DISALLOW_COPY_AND_ASSIGN(SafeAudioVideoChecker); 62 DISALLOW_COPY_AND_ASSIGN(SafeAudioVideoChecker);
63 }; 63 };
64 64
65 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SAFE_AUDIO_VIDEO_CHECKER_H_ 65 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SAFE_AUDIO_VIDEO_CHECKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698