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

Side by Side Diff: chrome/browser/media/android/remote/remote_media_player_bridge.h

Issue 1403703005: Refactor Clank cast connect logic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix trybot detected error. Created 5 years, 2 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
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_ANDROID_REMOTE_REMOTE_MEDIA_PLAYER_BRIDGE_H_ 5 #ifndef CHROME_BROWSER_MEDIA_ANDROID_REMOTE_REMOTE_MEDIA_PLAYER_BRIDGE_H_
6 #define CHROME_BROWSER_MEDIA_ANDROID_REMOTE_REMOTE_MEDIA_PLAYER_BRIDGE_H_ 6 #define CHROME_BROWSER_MEDIA_ANDROID_REMOTE_REMOTE_MEDIA_PLAYER_BRIDGE_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 bool CanSeekBackward() override; 52 bool CanSeekBackward() override;
53 bool IsPlayerReady() override; 53 bool IsPlayerReady() override;
54 GURL GetUrl() override; 54 GURL GetUrl() override;
55 GURL GetFirstPartyForCookies() override; 55 GURL GetFirstPartyForCookies() override;
56 56
57 // JNI functions 57 // JNI functions
58 base::android::ScopedJavaLocalRef<jstring> GetFrameUrl( 58 base::android::ScopedJavaLocalRef<jstring> GetFrameUrl(
59 JNIEnv* env, jobject obj); 59 JNIEnv* env, jobject obj);
60 void OnPlaying(JNIEnv* env, jobject obj); 60 void OnPlaying(JNIEnv* env, jobject obj);
61 void OnPaused(JNIEnv* env, jobject obj); 61 void OnPaused(JNIEnv* env, jobject obj);
62 void OnRouteSelected(JNIEnv* env, jobject obj, jstring castingMessage);
63 void OnRouteUnselected(JNIEnv* env, jobject obj); 62 void OnRouteUnselected(JNIEnv* env, jobject obj);
64 void OnPlaybackFinished(JNIEnv* env, jobject obj); 63 void OnPlaybackFinished(JNIEnv* env, jobject obj);
65 void OnRouteAvailabilityChanged(JNIEnv* env, jobject obj, jboolean available); 64 void OnRouteAvailabilityChanged(JNIEnv* env, jobject obj, jboolean available);
66 base::android::ScopedJavaLocalRef<jstring> GetTitle(JNIEnv* env, jobject obj); 65 base::android::ScopedJavaLocalRef<jstring> GetTitle(JNIEnv* env, jobject obj);
66 void PauseLocal(JNIEnv* env, jobject obj);
67 jint GetLocalPosition(JNIEnv* env, jobject obj);
68 void OnCastStarting(JNIEnv* env, jobject obj, jstring casting_message);
69 void OnCastStopping(JNIEnv* env, jobject obj);
67 70
68 // Wrappers for calls to Java used by the remote media player manager 71 // Wrappers for calls to Java used by the remote media player manager
69 void RequestRemotePlayback(); 72 void RequestRemotePlayback();
70 void RequestRemotePlaybackControl(); 73 void RequestRemotePlaybackControl();
71 void SetNativePlayer(); 74 void SetNativePlayer();
72 void OnPlayerCreated(); 75 void OnPlayerCreated();
73 void OnPlayerDestroyed(); 76 void OnPlayerDestroyed();
74 bool IsRemotePlaybackAvailable() const; 77 bool TakesOverCastDevice();
75 bool IsRemotePlaybackPreferredForFrame() const;
76
77 // Returns true if the we can play the media remotely
78 bool IsMediaPlayableRemotely() const;
79 78
80 // Gets the message to display on the embedded player while casting. 79 // Gets the message to display on the embedded player while casting.
81 std::string GetCastingMessage(); 80 std::string GetCastingMessage();
82 81
83 // Tell the java side about the poster image for a given media. 82 // Tell the java side about the poster image for a given media.
84 void SetPosterBitmap(const std::vector<SkBitmap>& bitmaps); 83 void SetPosterBitmap(const std::vector<SkBitmap>& bitmaps);
85 84
86 protected: 85 protected:
87 // MediaPlayerAndroid implementation. 86 // MediaPlayerAndroid implementation.
88 void OnVideoSizeChanged(int width, int height) override; 87 void OnVideoSizeChanged(int width, int height) override;
89 void OnPlaybackComplete() override; 88 void OnPlaybackComplete() override;
90 void OnMediaInterrupted() override; 89 void OnMediaInterrupted() override;
91 void OnMediaPrepared() override;
92 90
93 private: 91 private:
94 // Functions that implements media player control. 92 // Functions that implements media player control.
95 void StartInternal(); 93 void StartInternal();
96 void PauseInternal(); 94 void PauseInternal();
97 void SeekInternal(base::TimeDelta time);
98 95
99 // Called when |time_update_timer_| fires. 96 // Called when |time_update_timer_| fires.
100 void OnTimeUpdateTimerFired(); 97 void OnTimeUpdateTimerFired();
101 98
102 // Callback function passed to |resource_getter_|. Called when the cookies 99 // Callback function passed to |resource_getter_|. Called when the cookies
103 // are retrieved. 100 // are retrieved.
104 void OnCookiesRetrieved(const std::string& cookies); 101 void OnCookiesRetrieved(const std::string& cookies);
105 102
106 void PendingSeekInternal(const base::TimeDelta& time);
107
108 // Prepare the player for playback, asynchronously. When succeeds, 103 // Prepare the player for playback, asynchronously. When succeeds,
109 // OnMediaPrepared() will be called. Otherwise, OnMediaError() will 104 // OnMediaPrepared() will be called. Otherwise, OnMediaError() will
110 // be called with an error type. 105 // be called with an error type.
111 void Prepare(); 106 void Prepare();
112 107
113 long start_position_millis_; 108 long start_position_millis_;
114 MediaPlayerAndroid* local_player_; 109 MediaPlayerAndroid* local_player_;
115 bool in_use_;
116 bool prepared_;
117 bool pending_play_;
118 int width_; 110 int width_;
119 int height_; 111 int height_;
120 base::RepeatingTimer time_update_timer_; 112 base::RepeatingTimer time_update_timer_;
121 base::TimeDelta duration_; 113 base::TimeDelta duration_;
122 bool should_seek_on_prepare_;
123 base::TimeDelta pending_seek_;
124 114
125 // Hide url log from media player. 115 // Hide url log from media player.
126 bool hide_url_log_; 116 bool hide_url_log_;
127 117
128 // Volume of playback. 118 // Volume of playback.
129 double volume_; 119 double volume_;
130 120
131 // Url for playback. 121 // Url for playback.
132 GURL url_; 122 GURL url_;
133 123
(...skipping 11 matching lines...) Expand all
145 135
146 // NOTE: Weak pointers must be invalidated before all other member variables. 136 // NOTE: Weak pointers must be invalidated before all other member variables.
147 base::WeakPtrFactory<RemoteMediaPlayerBridge> weak_factory_; 137 base::WeakPtrFactory<RemoteMediaPlayerBridge> weak_factory_;
148 138
149 DISALLOW_COPY_AND_ASSIGN(RemoteMediaPlayerBridge); 139 DISALLOW_COPY_AND_ASSIGN(RemoteMediaPlayerBridge);
150 }; 140 };
151 141
152 } // namespace remote_media 142 } // namespace remote_media
153 143
154 #endif // CHROME_BROWSER_MEDIA_ANDROID_REMOTE_REMOTE_MEDIA_PLAYER_BRIDGE_H_ 144 #endif // CHROME_BROWSER_MEDIA_ANDROID_REMOTE_REMOTE_MEDIA_PLAYER_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698