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

Unified Diff: content/public/browser/presentation_service_delegate.cc

Issue 2477573002: [Presentation API] (3rd) (1-UA) Split PresentationServiceDelegateImpl(PSDImpl) (Closed)
Patch Set: merge with master Created 4 years 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: content/public/browser/presentation_service_delegate.cc
diff --git a/content/public/browser/presentation_service_delegate.cc b/content/public/browser/presentation_service_delegate.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3e53adb42a560b75b265598f713199cb1977cbab
--- /dev/null
+++ b/content/public/browser/presentation_service_delegate.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 "content/public/browser/presentation_service_delegate.h"
+
+namespace content {
+
+PresentationServiceDelegate::PresentationServiceDelegate() {}
+
+PresentationServiceDelegate::~PresentationServiceDelegate() {
+ for (auto& observer_pair : observers_)
+ observer_pair.second->OnDelegateDestroyed();
+}
+
+void PresentationServiceDelegate::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 PresentationServiceDelegate::RemoveObserver(int render_process_id,
+ int render_frame_id) {
+ observers_.erase(RenderFrameHostID(render_process_id, render_frame_id));
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698