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

Side by Side Diff: chrome/browser/media/router/receiver_presentation_service_delegate_impl.h

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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_RECEIVER_PRESENTATION_SERVICE_DELEGATE_IMPL_ H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_RECEIVER_PRESENTATION_SERVICE_DELEGATE_IMPL_ H_
7
8 #include <string>
9
10 #include "chrome/browser/media/router/presentation_service_delegate_observers.h"
11 #include "content/public/browser/presentation_service_delegate.h"
12 #include "content/public/browser/web_contents_user_data.h"
13
14 namespace content {
15 class WebContents;
16 } // namespace content
17
18 namespace media_router {
19
20 class OffscreenPresentationManager;
21
22 // Implements the receiver side of Presentation API for offscreen presentation.
23 // Created with offscreen WebContents for an offscreen presentation. Each
24 // instance is tied to a single offscreen presentation whose ID is given during
25 // construction. As such, the receiver APIs are contextual with the offscreen
26 // presentation. Only the main frame of the offscreen WebContents is allowed to
27 // make receiver Presentation API requests; requests made from any other frame
28 // will be rejected.
29 class ReceiverPresentationServiceDelegateImpl
30 : public content::WebContentsUserData<
31 ReceiverPresentationServiceDelegateImpl>,
32 public content::ReceiverPresentationServiceDelegate {
33 public:
34 // Creates an instance of ReceiverPresentationServiceDelegateImpl under
35 // |web_contents| and registers it as the receiver of the offscreen
36 // presentation |presentation_id| with OffscreenPresentationManager.
37 // No-op if a ReceiverPresentationServiceDelegateImpl instance already
38 // exists under |web_contents|. This class does not take ownership of
39 // |web_contents|.
40 static void CreateForWebContents(content::WebContents* web_contents,
41 const std::string& presentation_id);
42
43 // content::ReceiverPresentationServiceDelegate implementation.
44 void AddObserver(
45 int render_process_id,
46 int render_frame_id,
47 content::PresentationServiceDelegate::Observer* observer) override;
48 void RemoveObserver(int render_process_id, int render_frame_id) override;
49 void Reset(int render_process_id, int render_frame_id) override;
50 void RegisterReceiverConnectionAvailableCallback(
51 const content::ReceiverConnectionAvailableCallback&
52 receiver_available_callback) override;
53
54 private:
55 friend class content::WebContentsUserData<
56 ReceiverPresentationServiceDelegateImpl>;
57
58 ReceiverPresentationServiceDelegateImpl(content::WebContents* web_contents,
59 const std::string& presentation_id);
60
61 // Reference to the WebContents that owns this instance.
62 content::WebContents* const web_contents_;
63
64 const std::string presentation_id_;
65
66 // This is an unowned pointer to the OffscreenPresentationManager.
67 OffscreenPresentationManager* const offscreen_presentation_manager_;
68
69 PresentationServiceDelegateObservers observers_;
70
71 DISALLOW_COPY_AND_ASSIGN(ReceiverPresentationServiceDelegateImpl);
72 };
73
74 } // namespace media_router
75
76 #endif // CHROME_BROWSER_MEDIA_ROUTER_RECEIVER_PRESENTATION_SERVICE_DELEGATE_IM PL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698