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

Side by Side Diff: content/renderer/media/android/media_info_loader.h

Issue 63253002: Rename WebKit namespace to blink (part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 CONTENT_RENDERER_MEDIA_ANDROID_MEDIA_INFO_LOADER_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_ANDROID_MEDIA_INFO_LOADER_H_
6 #define CONTENT_RENDERER_MEDIA_ANDROID_MEDIA_INFO_LOADER_H_ 6 #define CONTENT_RENDERER_MEDIA_ANDROID_MEDIA_INFO_LOADER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
14 #include "content/renderer/media/active_loader.h" 14 #include "content/renderer/media/active_loader.h"
15 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" 15 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h"
16 #include "third_party/WebKit/public/web/WebMediaPlayer.h" 16 #include "third_party/WebKit/public/web/WebMediaPlayer.h"
17 #include "url/gurl.h" 17 #include "url/gurl.h"
18 18
19 namespace WebKit { 19 namespace blink {
20 class WebFrame; 20 class WebFrame;
21 class WebURLLoader; 21 class WebURLLoader;
22 class WebURLRequest; 22 class WebURLRequest;
23 } 23 }
24 24
25 namespace content { 25 namespace content {
26 26
27 // This class provides additional information about a media URL. Currently it 27 // This class provides additional information about a media URL. Currently it
28 // can be used to determine if a media URL has a single security origin and 28 // can be used to determine if a media URL has a single security origin and
29 // whether the URL passes a CORS access check. 29 // whether the URL passes a CORS access check.
30 class CONTENT_EXPORT MediaInfoLoader : private WebKit::WebURLLoaderClient { 30 class CONTENT_EXPORT MediaInfoLoader : private blink::WebURLLoaderClient {
31 public: 31 public:
32 // Status codes for start operations on MediaInfoLoader. 32 // Status codes for start operations on MediaInfoLoader.
33 enum Status { 33 enum Status {
34 // The operation failed, which may have been due to: 34 // The operation failed, which may have been due to:
35 // - Page navigation 35 // - Page navigation
36 // - Server replied 4xx/5xx 36 // - Server replied 4xx/5xx
37 // - The response was invalid 37 // - The response was invalid
38 // - Connection was terminated 38 // - Connection was terminated
39 // 39 //
40 // At this point you should delete the loader. 40 // At this point you should delete the loader.
41 kFailed, 41 kFailed,
42 42
43 // Everything went as planned. 43 // Everything went as planned.
44 kOk, 44 kOk,
45 }; 45 };
46 46
47 // Start loading information about the given media URL. 47 // Start loading information about the given media URL.
48 // |url| - URL for the media resource to be loaded. 48 // |url| - URL for the media resource to be loaded.
49 // |cors_mode| - HTML media element's crossorigin attribute. 49 // |cors_mode| - HTML media element's crossorigin attribute.
50 // |ready_cb| - Called when media info has finished or failed loading. 50 // |ready_cb| - Called when media info has finished or failed loading.
51 typedef base::Callback<void(Status)> ReadyCB; 51 typedef base::Callback<void(Status)> ReadyCB;
52 MediaInfoLoader( 52 MediaInfoLoader(
53 const GURL& url, 53 const GURL& url,
54 WebKit::WebMediaPlayer::CORSMode cors_mode, 54 blink::WebMediaPlayer::CORSMode cors_mode,
55 const ReadyCB& ready_cb); 55 const ReadyCB& ready_cb);
56 virtual ~MediaInfoLoader(); 56 virtual ~MediaInfoLoader();
57 57
58 // Start loading media info. 58 // Start loading media info.
59 void Start(WebKit::WebFrame* frame); 59 void Start(blink::WebFrame* frame);
60 60
61 // Returns true if the media resource has a single origin, false otherwise. 61 // Returns true if the media resource has a single origin, false otherwise.
62 // Only valid to call after the loader becomes ready. 62 // Only valid to call after the loader becomes ready.
63 bool HasSingleOrigin() const; 63 bool HasSingleOrigin() const;
64 64
65 // Returns true if the media resource passed a CORS access control check. 65 // Returns true if the media resource passed a CORS access control check.
66 // Only valid to call after the loader becomes ready. 66 // Only valid to call after the loader becomes ready.
67 bool DidPassCORSAccessCheck() const; 67 bool DidPassCORSAccessCheck() const;
68 68
69 private: 69 private:
70 friend class MediaInfoLoaderTest; 70 friend class MediaInfoLoaderTest;
71 71
72 // WebKit::WebURLLoaderClient implementation. 72 // blink::WebURLLoaderClient implementation.
73 virtual void willSendRequest( 73 virtual void willSendRequest(
74 WebKit::WebURLLoader* loader, 74 blink::WebURLLoader* loader,
75 WebKit::WebURLRequest& newRequest, 75 blink::WebURLRequest& newRequest,
76 const WebKit::WebURLResponse& redirectResponse); 76 const blink::WebURLResponse& redirectResponse);
77 virtual void didSendData( 77 virtual void didSendData(
78 WebKit::WebURLLoader* loader, 78 blink::WebURLLoader* loader,
79 unsigned long long bytesSent, 79 unsigned long long bytesSent,
80 unsigned long long totalBytesToBeSent); 80 unsigned long long totalBytesToBeSent);
81 virtual void didReceiveResponse( 81 virtual void didReceiveResponse(
82 WebKit::WebURLLoader* loader, 82 blink::WebURLLoader* loader,
83 const WebKit::WebURLResponse& response); 83 const blink::WebURLResponse& response);
84 virtual void didDownloadData( 84 virtual void didDownloadData(
85 WebKit::WebURLLoader* loader, 85 blink::WebURLLoader* loader,
86 int data_length, 86 int data_length,
87 int encodedDataLength); 87 int encodedDataLength);
88 virtual void didReceiveData( 88 virtual void didReceiveData(
89 WebKit::WebURLLoader* loader, 89 blink::WebURLLoader* loader,
90 const char* data, 90 const char* data,
91 int data_length, 91 int data_length,
92 int encoded_data_length); 92 int encoded_data_length);
93 virtual void didReceiveCachedMetadata( 93 virtual void didReceiveCachedMetadata(
94 WebKit::WebURLLoader* loader, 94 blink::WebURLLoader* loader,
95 const char* data, int dataLength); 95 const char* data, int dataLength);
96 virtual void didFinishLoading( 96 virtual void didFinishLoading(
97 WebKit::WebURLLoader* loader, 97 blink::WebURLLoader* loader,
98 double finishTime); 98 double finishTime);
99 virtual void didFail( 99 virtual void didFail(
100 WebKit::WebURLLoader* loader, 100 blink::WebURLLoader* loader,
101 const WebKit::WebURLError&); 101 const blink::WebURLError&);
102 102
103 void DidBecomeReady(Status status); 103 void DidBecomeReady(Status status);
104 104
105 // Injected WebURLLoader instance for testing purposes. 105 // Injected WebURLLoader instance for testing purposes.
106 scoped_ptr<WebKit::WebURLLoader> test_loader_; 106 scoped_ptr<blink::WebURLLoader> test_loader_;
107 107
108 // Keeps track of an active WebURLLoader and associated state. 108 // Keeps track of an active WebURLLoader and associated state.
109 scoped_ptr<ActiveLoader> active_loader_; 109 scoped_ptr<ActiveLoader> active_loader_;
110 110
111 bool loader_failed_; 111 bool loader_failed_;
112 GURL url_; 112 GURL url_;
113 WebKit::WebMediaPlayer::CORSMode cors_mode_; 113 blink::WebMediaPlayer::CORSMode cors_mode_;
114 bool single_origin_; 114 bool single_origin_;
115 115
116 ReadyCB ready_cb_; 116 ReadyCB ready_cb_;
117 base::TimeTicks start_time_; 117 base::TimeTicks start_time_;
118 118
119 DISALLOW_COPY_AND_ASSIGN(MediaInfoLoader); 119 DISALLOW_COPY_AND_ASSIGN(MediaInfoLoader);
120 }; 120 };
121 121
122 } // namespace content 122 } // namespace content
123 123
124 #endif // CONTENT_RENDERER_MEDIA_ANDROID_MEDIA_INFO_LOADER_H_ 124 #endif // CONTENT_RENDERER_MEDIA_ANDROID_MEDIA_INFO_LOADER_H_
OLDNEW
« no previous file with comments | « content/renderer/media/android/audio_decoder_android.cc ('k') | content/renderer/media/android/media_info_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698