forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace MediaController with media::FlingingController
FlingingRenderer needs to be updated when status changes happen on a device that it is currently remoting to. Instead of coupling the MediaController interface to the MediaStatusObserver interface, it is simpler to add a new interface that groups the MC and MSO. The best name for this interface is probably MediaRouteController, but there is a naming collision with media_router::MediaRouteController. mr::MRC is a class with baked in desktop and Mojo concepts, and precise lifetime management, that is not immediatly extractable into an interface. It is simpler to add a new interface now, and have mr::MRC implement this interface later. This CL adds the FlingingController as a high level, simple interface. It will eventually be renamed to MediaRouteController, as part of the work to unify the desktop and mobile remoting experience (see crbug.com/820277). Bug: 790766 Change-Id: I8248f2fd4b2022c371f37a8fd73af267b3735e7e Reviewed-on: https://chromium-review.googlesource.com/1136008 Reviewed-by: Mounir Lamouri <mlamouri@chromium.org> Reviewed-by: Dmitry Gozman <dgozman@chromium.org> Reviewed-by: Takumi Fujimoto <takumif@chromium.org> Commit-Queue: Thomas Guilbert <tguilbert@chromium.org> Cr-Commit-Position: refs/heads/master@{#576942}
- Loading branch information
1 parent
7a20ffc
commit fc4431b
Showing
24 changed files
with
232 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
chrome/browser/media/android/remote/flinging_controller_bridge.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// Copyright 2018 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "chrome/browser/media/android/remote/flinging_controller_bridge.h" | ||
|
||
#include "jni/FlingingControllerBridge_jni.h" | ||
|
||
namespace media_router { | ||
|
||
FlingingControllerBridge::FlingingControllerBridge( | ||
base::android::ScopedJavaGlobalRef<jobject> controller) | ||
: j_flinging_controller_bridge_(controller) {} | ||
|
||
FlingingControllerBridge::~FlingingControllerBridge() = default; | ||
|
||
void FlingingControllerBridge::Play() { | ||
JNIEnv* env = base::android::AttachCurrentThread(); | ||
DCHECK(env); | ||
|
||
Java_FlingingControllerBridge_play(env, j_flinging_controller_bridge_); | ||
} | ||
|
||
void FlingingControllerBridge::Pause() { | ||
JNIEnv* env = base::android::AttachCurrentThread(); | ||
DCHECK(env); | ||
|
||
Java_FlingingControllerBridge_pause(env, j_flinging_controller_bridge_); | ||
} | ||
|
||
void FlingingControllerBridge::SetMute(bool mute) { | ||
JNIEnv* env = base::android::AttachCurrentThread(); | ||
DCHECK(env); | ||
|
||
Java_FlingingControllerBridge_setMute(env, j_flinging_controller_bridge_, | ||
mute); | ||
} | ||
|
||
void FlingingControllerBridge::SetVolume(float volume) { | ||
JNIEnv* env = base::android::AttachCurrentThread(); | ||
DCHECK(env); | ||
|
||
Java_FlingingControllerBridge_setVolume(env, j_flinging_controller_bridge_, | ||
volume); | ||
} | ||
|
||
void FlingingControllerBridge::Seek(base::TimeDelta time) { | ||
JNIEnv* env = base::android::AttachCurrentThread(); | ||
DCHECK(env); | ||
|
||
Java_FlingingControllerBridge_seek(env, j_flinging_controller_bridge_, | ||
time.InMilliseconds()); | ||
} | ||
|
||
media::MediaController* FlingingControllerBridge::GetMediaController() { | ||
return this; | ||
} | ||
|
||
void FlingingControllerBridge::AddMediaStatusObserver( | ||
media::MediaStatusObserver* observer) { | ||
NOTREACHED(); | ||
} | ||
void FlingingControllerBridge::RemoveMediaStatusObserver( | ||
media::MediaStatusObserver* observer) { | ||
NOTREACHED(); | ||
} | ||
|
||
base::TimeDelta FlingingControllerBridge::GetApproximateCurrentTime() { | ||
// TODO(https://crbug.com/830871): Implement this method. | ||
return base::TimeDelta(); | ||
} | ||
|
||
} // namespace media_router |
45 changes: 45 additions & 0 deletions
45
chrome/browser/media/android/remote/flinging_controller_bridge.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright 2018 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef CHROME_BROWSER_MEDIA_ANDROID_REMOTE_FLINGING_CONTROLLER_BRIDGE_H_ | ||
#define CHROME_BROWSER_MEDIA_ANDROID_REMOTE_FLINGING_CONTROLLER_BRIDGE_H_ | ||
|
||
#include "base/android/scoped_java_ref.h" | ||
#include "base/time/time.h" | ||
#include "media/base/flinging_controller.h" | ||
#include "media/base/media_controller.h" | ||
|
||
namespace media_router { | ||
|
||
// Allows native code to call into a Java FlingingController. | ||
class FlingingControllerBridge : public media::FlingingController, | ||
public media::MediaController { | ||
public: | ||
explicit FlingingControllerBridge( | ||
base::android::ScopedJavaGlobalRef<jobject> controller); | ||
~FlingingControllerBridge() override; | ||
|
||
// FlingingController implementation. | ||
media::MediaController* GetMediaController() override; | ||
void AddMediaStatusObserver(media::MediaStatusObserver* observer) override; | ||
void RemoveMediaStatusObserver(media::MediaStatusObserver* observer) override; | ||
base::TimeDelta GetApproximateCurrentTime() override; | ||
|
||
// MediaController implementation. | ||
void Play() override; | ||
void Pause() override; | ||
void SetMute(bool mute) override; | ||
void SetVolume(float volume) override; | ||
void Seek(base::TimeDelta time) override; | ||
|
||
private: | ||
// Java MediaControllerBridge instance. | ||
base::android::ScopedJavaGlobalRef<jobject> j_flinging_controller_bridge_; | ||
|
||
DISALLOW_COPY_AND_ASSIGN(FlingingControllerBridge); | ||
}; | ||
|
||
} // namespace media_router | ||
|
||
#endif // CHROME_BROWSER_MEDIA_ANDROID_REMOTE_FLINGING_CONTROLLER_BRIDGE_H_ |
53 changes: 0 additions & 53 deletions
53
chrome/browser/media/android/remote/media_controller_bridge.cc
This file was deleted.
Oops, something went wrong.
37 changes: 0 additions & 37 deletions
37
chrome/browser/media/android/remote/media_controller_bridge.h
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.