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

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: 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 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 "content/public/browser/presentation_service_delegate.h"
11 #include "content/public/browser/web_contents_user_data.h"
12
13 namespace content {
14 class WebContents;
15 } // namespace content
16
17 namespace media_router {
18
19 class OffscreenPresentationManager;
20
21 // Implements the receiver side of Presentation API for offscreen presentation.
22 // Created with offscreen WebContents for an offscreen presentation. Each
23 // instance is tied to a single offscreen presentation whose ID is given during
24 // construction. As such, the receiver APIs are contextual with the offscreen
25 // presentation. Only the main frame of the offscreen WebContents is allowed to
26 // make receiver Presentation API requests; requests made from any other frame
27 // will be rejected.
28 class ReceiverPresentationServiceDelegateImpl
29 : public content::WebContentsUserData<
30 ReceiverPresentationServiceDelegateImpl>,
31 public content::ReceiverPresentationServiceDelegate {
32 public:
33 // Creates an instance of ReceiverPresentationServiceDelegateImpl under
34 // |web_contents| and registers it as the receiver of the offscreen
35 // presentation |presentation_id| with OffscreenPresentationManager.
36 // No-op if a ReceiverPresentationServiceDelegateImpl instance already
37 // exists under |web_contents|. This class does not take ownership of
38 // |web_contents|.
39 static void CreateForWebContents(content::WebContents* web_contents,
40 const std::string& presentation_id);
41
42 // Resets the presentation state for the frame given by |render_process_id|
43 // and |render_frame_id|. It will unregister presentation with
44 // |presentation_id_| from OffscreenPresentationManager.
45 void Reset(int render_process_id, int render_frame_id) override;
46
47 // content::ReceiverPresentationServiceDelegate implementation.
48 void RegisterReceiverConnectionAvailableCallback(
49 const content::ReceiverConnectionAvailableCallback&
50 receiver_available_callback) override;
51
52 private:
53 friend class content::WebContentsUserData<
54 ReceiverPresentationServiceDelegateImpl>;
55
56 ReceiverPresentationServiceDelegateImpl(content::WebContents* web_contents,
57 const std::string& presentation_id);
58
59 // Reference to the WebContents that owns this instance.
60 content::WebContents* const web_contents_;
61
62 const std::string presentation_id_;
63
64 // This is an unowned pointer to the OffscreenPresentationManager.
65 OffscreenPresentationManager* const offscreen_presentation_manager_;
66
67 DISALLOW_COPY_AND_ASSIGN(ReceiverPresentationServiceDelegateImpl);
68 };
69
70 } // namespace media_router
71
72 #endif // CHROME_BROWSER_MEDIA_ROUTER_RECEIVER_PRESENTATION_SERVICE_DELEGATE_IM PL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698