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

Unified Diff: chrome/browser/media/router/presentation_connection_state_observer.cc

Issue 1430413003: [Media Router] Connection state change listening redesign part 2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile Created 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media/router/presentation_connection_state_observer.cc
diff --git a/chrome/browser/media/router/presentation_connection_state_observer.cc b/chrome/browser/media/router/presentation_connection_state_observer.cc
index 47f342cedabf8f9ec1ef1b694f5c2c80ce03feda..0d7d3e403e6118926e00c603de90db7dfc5d2c52 100644
--- a/chrome/browser/media/router/presentation_connection_state_observer.cc
+++ b/chrome/browser/media/router/presentation_connection_state_observer.cc
@@ -10,9 +10,15 @@
namespace media_router {
PresentationConnectionStateObserver::PresentationConnectionStateObserver(
- MediaRouter* router,
- const MediaRoute::Id& route_id)
- : router_(router), route_id_(route_id) {
+ const content::PresentationConnectionStateChangedCallback& state_changed_cb,
+ const content::PresentationSessionInfo& connection,
+ const MediaRoute::Id& route_id,
+ MediaRouter* router)
+ : state_changed_cb_(state_changed_cb),
+ connection_(connection),
+ route_id_(route_id),
+ router_(router) {
+ DCHECK(!state_changed_cb_.is_null());
DCHECK(router_);
router_->RegisterPresentationConnectionStateObserver(this);
}
@@ -21,4 +27,11 @@ PresentationConnectionStateObserver::~PresentationConnectionStateObserver() {
router_->UnregisterPresentationConnectionStateObserver(this);
}
+void PresentationConnectionStateObserver::OnStateChanged(
+ content::PresentationConnectionState state) {
+ DVLOG(2) << __FUNCTION__ << "presentation_id: " << connection_.presentation_id
+ << ", state: " << state;
+ state_changed_cb_.Run(connection_, state);
mark a. foltz 2015/11/12 04:19:38 All this observer object is doing is wrapping a ba
imcheng 2015/11/16 23:52:01 If we pass in a callback, the implementation will
+}
+
} // namespace media_router

Powered by Google App Engine
This is Rietveld 408576698