OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_MEDIA_FILE_SYSTEM_BACKEND_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MEDIA_FILE_SYSTEM_BACKEND_H_ |
6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MEDIA_FILE_SYSTEM_BACKEND_H_ | 6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MEDIA_FILE_SYSTEM_BACKEND_H_ |
7 | 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/callback.h" |
| 11 #include "base/files/file_path.h" |
8 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "chrome/browser/media_galleries/media_galleries_preferences.h" |
10 #include "webkit/browser/fileapi/file_system_backend.h" | 15 #include "webkit/browser/fileapi/file_system_backend.h" |
11 | 16 |
12 namespace base { | 17 namespace base { |
13 class SequencedTaskRunner; | 18 class SequencedTaskRunner; |
14 } | 19 } |
15 | 20 |
| 21 namespace fileapi { |
| 22 class FileSystemURL; |
| 23 } |
| 24 |
16 namespace net { | 25 namespace net { |
17 class URLRequest; | 26 class URLRequest; |
18 } | 27 } |
19 | 28 |
20 class MediaPathFilter; | 29 class MediaPathFilter; |
21 | |
22 class DeviceMediaAsyncFileUtil; | 30 class DeviceMediaAsyncFileUtil; |
23 | 31 |
24 class MediaFileSystemBackend : public fileapi::FileSystemBackend { | 32 class MediaFileSystemBackend : public fileapi::FileSystemBackend { |
25 public: | 33 public: |
26 static const char kMediaTaskRunnerName[]; | 34 static const char kMediaTaskRunnerName[]; |
27 | 35 |
28 MediaFileSystemBackend( | 36 MediaFileSystemBackend( |
29 const base::FilePath& profile_path, | 37 const base::FilePath& profile_path, |
30 base::SequencedTaskRunner* media_task_runner); | 38 base::SequencedTaskRunner* media_task_runner); |
31 virtual ~MediaFileSystemBackend(); | 39 virtual ~MediaFileSystemBackend(); |
32 | 40 |
33 static bool CurrentlyOnMediaTaskRunnerThread(); | 41 static bool CurrentlyOnMediaTaskRunnerThread(); |
34 static scoped_refptr<base::SequencedTaskRunner> MediaTaskRunner(); | 42 static scoped_refptr<base::SequencedTaskRunner> MediaTaskRunner(); |
35 | 43 |
| 44 // Construct the mount point for the gallery specified by |pref_id| in |
| 45 // the profile located in |profile_path|. |
| 46 static std::string ConstructMountName(const base::FilePath& profile_path, |
| 47 const std::string& extension_id, |
| 48 MediaGalleryPrefId pref_id); |
| 49 |
36 static bool AttemptAutoMountForURLRequest( | 50 static bool AttemptAutoMountForURLRequest( |
37 const net::URLRequest* url_request, | 51 const net::URLRequest* url_request, |
38 const fileapi::FileSystemURL& filesystem_url, | 52 const fileapi::FileSystemURL& filesystem_url, |
39 const std::string& storage_domain, | 53 const std::string& storage_domain, |
40 const base::Callback<void(base::File::Error result)>& callback); | 54 const base::Callback<void(base::File::Error result)>& callback); |
41 | 55 |
42 // FileSystemBackend implementation. | 56 // FileSystemBackend implementation. |
43 virtual bool CanHandleType(fileapi::FileSystemType type) const OVERRIDE; | 57 virtual bool CanHandleType(fileapi::FileSystemType type) const OVERRIDE; |
44 virtual void Initialize(fileapi::FileSystemContext* context) OVERRIDE; | 58 virtual void Initialize(fileapi::FileSystemContext* context) OVERRIDE; |
45 virtual void ResolveURL(const fileapi::FileSystemURL& url, | 59 virtual void ResolveURL(const fileapi::FileSystemURL& url, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 scoped_ptr<fileapi::AsyncFileUtil> itunes_file_util_; | 99 scoped_ptr<fileapi::AsyncFileUtil> itunes_file_util_; |
86 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 100 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
87 #if defined(OS_MACOSX) | 101 #if defined(OS_MACOSX) |
88 scoped_ptr<fileapi::AsyncFileUtil> iphoto_file_util_; | 102 scoped_ptr<fileapi::AsyncFileUtil> iphoto_file_util_; |
89 #endif // defined(OS_MACOSX) | 103 #endif // defined(OS_MACOSX) |
90 | 104 |
91 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemBackend); | 105 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemBackend); |
92 }; | 106 }; |
93 | 107 |
94 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MEDIA_FILE_SYSTEM_BACKEND_H_ | 108 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MEDIA_FILE_SYSTEM_BACKEND_H_ |
OLD | NEW |