OLD | NEW |
---|---|
(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 void Reset(int render_process_id, int render_frame_id) override; | |
mark a. foltz
2016/12/02 22:09:05
Add documentation for this method.
zhaobin
2016/12/03 00:34:26
Done.
| |
43 | |
44 // content::ReceiverPresentationServiceDelegate implementation. | |
45 void RegisterReceiverConnectionAvailableCallback( | |
46 const content::ReceiverConnectionAvailableCallback& | |
47 receiver_available_callback) override; | |
48 | |
49 private: | |
50 friend class content::WebContentsUserData< | |
51 ReceiverPresentationServiceDelegateImpl>; | |
52 | |
53 ReceiverPresentationServiceDelegateImpl(content::WebContents* web_contents, | |
54 const std::string& presentation_id); | |
55 | |
56 // Reference to the WebContents that owns this instance. | |
57 content::WebContents* const web_contents_; | |
58 | |
59 const std::string presentation_id_; | |
60 OffscreenPresentationManager* const offscreen_presentation_manager_; | |
mark a. foltz
2016/12/02 22:09:05
Document that this is an unowned pointer to the Of
zhaobin
2016/12/03 00:34:26
Done.
| |
61 | |
62 DISALLOW_COPY_AND_ASSIGN(ReceiverPresentationServiceDelegateImpl); | |
63 }; | |
64 | |
65 } // namespace media_router | |
66 | |
67 #endif // CHROME_BROWSER_MEDIA_ROUTER_RECEIVER_PRESENTATION_SERVICE_DELEGATE_IM PL_H_ | |
OLD | NEW |