| 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 CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_RESOURCE_GETTER_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_RESOURCE_GETTER_IMPL_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_RESOURCE_GETTER_IMPL_H_ | 6 #define CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_RESOURCE_GETTER_IMPL_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/synchronization/waitable_event.h" | 13 #include "base/synchronization/waitable_event.h" |
| 14 #include "media/base/android/media_resource_getter.h" | 14 #include "media/base/android/media_resource_getter.h" |
| 15 #include "media/base/android/media_url_interceptor.h" | 15 #include "media/base/android/media_url_interceptor.h" |
| 16 #include "net/base/auth.h" | 16 #include "net/base/auth.h" |
| 17 #include "net/cookies/canonical_cookie.h" | 17 #include "net/cookies/canonical_cookie.h" |
| 18 | 18 |
| 19 namespace fileapi { | 19 namespace storage { |
| 20 class FileSystemContext; | 20 class FileSystemContext; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace net { | 23 namespace net { |
| 24 class URLRequestContextGetter; | 24 class URLRequestContextGetter; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace content { | 27 namespace content { |
| 28 | 28 |
| 29 class BrowserContext; | 29 class BrowserContext; |
| 30 class ResourceContext; | 30 class ResourceContext; |
| 31 | 31 |
| 32 // This class implements media::MediaResourceGetter to retrieve resources | 32 // This class implements media::MediaResourceGetter to retrieve resources |
| 33 // asynchronously on the UI thread. | 33 // asynchronously on the UI thread. |
| 34 class MediaResourceGetterImpl : public media::MediaResourceGetter { | 34 class MediaResourceGetterImpl : public media::MediaResourceGetter { |
| 35 public: | 35 public: |
| 36 // Construct a MediaResourceGetterImpl object. |browser_context| and | 36 // Construct a MediaResourceGetterImpl object. |browser_context| and |
| 37 // |render_process_id| are passed to retrieve the CookieStore. | 37 // |render_process_id| are passed to retrieve the CookieStore. |
| 38 // |file_system_context| are used to get the platform path. | 38 // |file_system_context| are used to get the platform path. |
| 39 MediaResourceGetterImpl(BrowserContext* browser_context, | 39 MediaResourceGetterImpl(BrowserContext* browser_context, |
| 40 fileapi::FileSystemContext* file_system_context, | 40 storage::FileSystemContext* file_system_context, |
| 41 int render_process_id, int render_frame_id); | 41 int render_process_id, |
| 42 int render_frame_id); |
| 42 virtual ~MediaResourceGetterImpl(); | 43 virtual ~MediaResourceGetterImpl(); |
| 43 | 44 |
| 44 // media::MediaResourceGetter implementation. | 45 // media::MediaResourceGetter implementation. |
| 45 // Must be called on the UI thread. | 46 // Must be called on the UI thread. |
| 46 virtual void GetAuthCredentials( | 47 virtual void GetAuthCredentials( |
| 47 const GURL& url, | 48 const GURL& url, |
| 48 const GetAuthCredentialsCB& callback) OVERRIDE; | 49 const GetAuthCredentialsCB& callback) OVERRIDE; |
| 49 virtual void GetCookies( | 50 virtual void GetCookies( |
| 50 const GURL& url, | 51 const GURL& url, |
| 51 const GURL& first_party_for_cookies, | 52 const GURL& first_party_for_cookies, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 77 const GetCookieCB& callback, const std::string& cookies); | 78 const GetCookieCB& callback, const std::string& cookies); |
| 78 | 79 |
| 79 // Called when GetPlatformPathFromFileSystemURL() finishes. | 80 // Called when GetPlatformPathFromFileSystemURL() finishes. |
| 80 void GetPlatformPathCallback( | 81 void GetPlatformPathCallback( |
| 81 const GetPlatformPathCB& callback, const std::string& platform_path); | 82 const GetPlatformPathCB& callback, const std::string& platform_path); |
| 82 | 83 |
| 83 // BrowserContext to retrieve URLRequestContext and ResourceContext. | 84 // BrowserContext to retrieve URLRequestContext and ResourceContext. |
| 84 BrowserContext* browser_context_; | 85 BrowserContext* browser_context_; |
| 85 | 86 |
| 86 // FileSystemContext to be used on FILE thread. | 87 // FileSystemContext to be used on FILE thread. |
| 87 fileapi::FileSystemContext* file_system_context_; | 88 storage::FileSystemContext* file_system_context_; |
| 88 | 89 |
| 89 // Render process id, used to check whether the process can access cookies. | 90 // Render process id, used to check whether the process can access cookies. |
| 90 int render_process_id_; | 91 int render_process_id_; |
| 91 | 92 |
| 92 // Render frame id, used to check tab specific cookie policy. | 93 // Render frame id, used to check tab specific cookie policy. |
| 93 int render_frame_id_; | 94 int render_frame_id_; |
| 94 | 95 |
| 95 // NOTE: Weak pointers must be invalidated before all other member variables. | 96 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 96 base::WeakPtrFactory<MediaResourceGetterImpl> weak_factory_; | 97 base::WeakPtrFactory<MediaResourceGetterImpl> weak_factory_; |
| 97 | 98 |
| 98 DISALLOW_COPY_AND_ASSIGN(MediaResourceGetterImpl); | 99 DISALLOW_COPY_AND_ASSIGN(MediaResourceGetterImpl); |
| 99 }; | 100 }; |
| 100 | 101 |
| 101 } // namespace content | 102 } // namespace content |
| 102 | 103 |
| 103 #endif // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_RESOURCE_GETTER_IMPL_H_ | 104 #endif // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_RESOURCE_GETTER_IMPL_H_ |
| OLD | NEW |