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

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

Issue 2477573002: [Presentation API] (3rd) (1-UA) Split PresentationServiceDelegateImpl(PSDImpl) (Closed)
Patch Set: fix windows compile error Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media/router/presentation_service_delegate_observers.cc
diff --git a/chrome/browser/media/router/presentation_service_delegate_observers.cc b/chrome/browser/media/router/presentation_service_delegate_observers.cc
new file mode 100644
index 0000000000000000000000000000000000000000..48595382a5c9e71f7d9133b4ecc9818b5556b5cd
--- /dev/null
+++ b/chrome/browser/media/router/presentation_service_delegate_observers.cc
@@ -0,0 +1,31 @@
+// Copyright 2016 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/router/presentation_service_delegate_observers.h"
+
+namespace media_router {
+
+PresentationServiceDelegateObservers::PresentationServiceDelegateObservers() {}
+
+PresentationServiceDelegateObservers::~PresentationServiceDelegateObservers() {
+ for (auto& observer_pair : observers_)
+ observer_pair.second->OnDelegateDestroyed();
+}
+
+void PresentationServiceDelegateObservers::AddObserver(
+ int render_process_id,
+ int render_frame_id,
+ content::PresentationServiceDelegate::Observer* observer) {
+ DCHECK(observer);
+
+ RenderFrameHostId rfh_id(render_process_id, render_frame_id);
+ DCHECK(!base::ContainsKey(observers_, rfh_id));
+ observers_[rfh_id] = observer;
+}
+
+void PresentationServiceDelegateObservers::RemoveObserver(int render_process_id,
+ int render_frame_id) {
+ observers_.erase(RenderFrameHostId(render_process_id, render_frame_id));
+}
+
+} // namespace media_router

Powered by Google App Engine
This is Rietveld 408576698