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

Unified Diff: chrome/browser/media/router/presentation_frame_map.h

Issue 1132903002: [MediaRouter] Add implementation of PresentationServiceDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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_frame_map.h
diff --git a/chrome/browser/media/router/presentation_frame_map.h b/chrome/browser/media/router/presentation_frame_map.h
new file mode 100644
index 0000000000000000000000000000000000000000..e0762b650c890b09f2d3a74af24f8f3196eda4be
--- /dev/null
+++ b/chrome/browser/media/router/presentation_frame_map.h
@@ -0,0 +1,69 @@
+// Copyright 2015 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_ROUTER_PRESENTATION_FRAME_MAP_H_
+#define CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_FRAME_MAP_H_
+
+#include <map>
+
+#include "base/containers/scoped_ptr_hash_map.h"
+#include "base/memory/scoped_ptr.h"
+#include "content/public/browser/presentation_service_delegate.h"
+
+namespace content {
+class PresentationScreenAvailabilityListener;
+class WebContents;
+}
+
+namespace media_router {
+class PresentationFrame;
+
+// Helper class for PresentationServiceDelegateImpl to manage
mark a. foltz 2015/05/14 22:20:46 Similar comments to PresentationFrame: - If it is
haibinlu 2015/05/15 23:32:29 Merged to PSDI.cc
+// PresentationFrames.
+class PresentationFrameMap {
+ public:
+ using RenderFrameHostId =
+ content::PresentationServiceDelegate::RenderFrameHostId;
+ using DelegateObserver = content::PresentationServiceDelegate::Observer;
+
+ explicit PresentationFrameMap(content::WebContents* web_contents);
+ ~PresentationFrameMap();
mark a. foltz 2015/05/14 22:20:45 virtual
haibinlu 2015/05/15 23:32:29 Done.
+
+ bool AddScreenAvailabilityListener(
mark a. foltz 2015/05/14 22:20:45 Add docstrings to public method declarations
haibinlu 2015/05/15 23:32:29 Done.
+ int render_process_id,
+ int render_frame_id,
+ content::PresentationScreenAvailabilityListener* listener);
+ void RemoveScreenAvailabilityListener(
+ int render_process_id,
+ int render_frame_id,
+ content::PresentationScreenAvailabilityListener* listener);
+
+ void SetDefaultPresentationInfo(int render_process_id,
+ int render_frame_id,
+ const std::string& default_presentation_url,
+ const std::string& default_presentation_id);
+ // Return empty string if no default presentation ID is set in the frame.
+ std::string GetDefaultPresentationId(RenderFrameHostId rfh_id) const;
+
+ void SetDelegateObserver(int render_process_id,
+ int render_frame_id,
+ DelegateObserver* observer);
+ DelegateObserver* GetDelegateObserver(RenderFrameHostId rfh_id) const;
+
+ void Reset(int render_process_id, int render_frame_id);
+
+ private:
+ base::ScopedPtrHashMap<RenderFrameHostId, scoped_ptr<PresentationFrame>>
mark a. foltz 2015/05/14 22:20:45 Add a comment explaining this map, i.e. "Maps a fr
haibinlu 2015/05/15 23:32:29 Done.
+ frames_;
+
+ size_t num_sink_observers_;
mark a. foltz 2015/05/14 22:20:45 What is a sink observer in this context? Is it th
haibinlu 2015/05/15 23:32:29 Removed. Calculated # of screen availability liste
+
+ // Does not own these two objects.
mark a. foltz 2015/05/14 22:20:45 Please comment about why this is okay.
+ MediaRouter* router_;
+ content::WebContents* web_contents_;
+};
+
+} // namespace media_router
+
+#endif // CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_FRAME_MAP_H_

Powered by Google App Engine
This is Rietveld 408576698