OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_ANDROID_MEDIA_RESOURCE_GETTER_IMPL_H_ |
| 6 #define CONTENT_BROWSER_ANDROID_MEDIA_RESOURCE_GETTER_IMPL_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/synchronization/waitable_event.h" |
| 13 #include "media/base/android/media_resource_getter.h" |
| 14 #include "net/cookies/canonical_cookie.h" |
| 15 |
| 16 namespace fileapi { |
| 17 class FileSystemContext; |
| 18 } |
| 19 |
| 20 namespace net { |
| 21 class URLRequestContextGetter; |
| 22 } |
| 23 |
| 24 namespace content { |
| 25 |
| 26 class BrowserContext; |
| 27 class ResourceContext; |
| 28 |
| 29 // This class implements media::MediaResourceGetter to retrieve resources |
| 30 // asynchronously on the UI thread. |
| 31 class MediaResourceGetterImpl : public media::MediaResourceGetter { |
| 32 public: |
| 33 // Construct a MediaResourceGetterImpl object. |browser_context| and |
| 34 // |renderer_id| are passed to retrieve the CookieStore. |
| 35 // |file_system_context| are used to get the platform path. |
| 36 MediaResourceGetterImpl(BrowserContext* browser_context, |
| 37 fileapi::FileSystemContext* file_system_context, |
| 38 int renderer_id, int routing_id); |
| 39 virtual ~MediaResourceGetterImpl(); |
| 40 |
| 41 // media::MediaResourceGetter implementation. |
| 42 // Must be called on the UI thread. |
| 43 virtual void GetCookies(const GURL& url, |
| 44 const GURL& first_party_for_cookies, |
| 45 const GetCookieCB& callback) OVERRIDE; |
| 46 virtual void GetPlatformPathFromFileSystemURL( |
| 47 const GURL& url, |
| 48 const GetPlatformPathCB& callback) OVERRIDE; |
| 49 |
| 50 private: |
| 51 // Called when GetCookies() finishes. |
| 52 void GetCookiesCallback( |
| 53 const GetCookieCB& callback, const std::string& cookies); |
| 54 |
| 55 // Called when GetPlatformPathFromFileSystemURL() finishes. |
| 56 void GetPlatformPathCallback( |
| 57 const GetPlatformPathCB& callback, const std::string& platform_path); |
| 58 |
| 59 // BrowserContext to retrieve URLRequestContext and ResourceContext. |
| 60 BrowserContext* browser_context_; |
| 61 |
| 62 // FileSystemContext to be used on FILE thread. |
| 63 fileapi::FileSystemContext* file_system_context_; |
| 64 |
| 65 // Used to post tasks. |
| 66 base::WeakPtrFactory<MediaResourceGetterImpl> weak_this_; |
| 67 |
| 68 // Render process id, used to check whether the process can access cookies. |
| 69 int renderer_id_; |
| 70 |
| 71 // Routing id for the render view, used to check tab specific cookie policy. |
| 72 int routing_id_; |
| 73 |
| 74 DISALLOW_COPY_AND_ASSIGN(MediaResourceGetterImpl); |
| 75 }; |
| 76 |
| 77 } // namespace content |
| 78 |
| 79 #endif // CONTENT_BROWSER_ANDROID_MEDIA_RESOURCE_GETTER_IMPL_H_ |
OLD | NEW |