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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "chrome/browser/media/router/presentation_connection_state_observer.h" 5 #include "chrome/browser/media/router/presentation_connection_state_observer.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/media/router/media_router.h" 8 #include "chrome/browser/media/router/media_router.h"
9 9
10 namespace media_router { 10 namespace media_router {
11 11
12 PresentationConnectionStateObserver::PresentationConnectionStateObserver( 12 PresentationConnectionStateObserver::PresentationConnectionStateObserver(
13 MediaRouter* router, 13 const content::PresentationConnectionStateChangedCallback& state_changed_cb,
14 const MediaRoute::Id& route_id) 14 const content::PresentationSessionInfo& connection,
15 : router_(router), route_id_(route_id) { 15 const MediaRoute::Id& route_id,
16 MediaRouter* router)
17 : state_changed_cb_(state_changed_cb),
18 connection_(connection),
19 route_id_(route_id),
20 router_(router) {
21 DCHECK(!state_changed_cb_.is_null());
16 DCHECK(router_); 22 DCHECK(router_);
17 router_->RegisterPresentationConnectionStateObserver(this); 23 router_->RegisterPresentationConnectionStateObserver(this);
18 } 24 }
19 25
20 PresentationConnectionStateObserver::~PresentationConnectionStateObserver() { 26 PresentationConnectionStateObserver::~PresentationConnectionStateObserver() {
21 router_->UnregisterPresentationConnectionStateObserver(this); 27 router_->UnregisterPresentationConnectionStateObserver(this);
22 } 28 }
23 29
30 void PresentationConnectionStateObserver::OnStateChanged(
31 content::PresentationConnectionState state) {
32 DVLOG(2) << __FUNCTION__ << "presentation_id: " << connection_.presentation_id
33 << ", state: " << state;
34 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
35 }
36
24 } // namespace media_router 37 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698