Chromium Code Reviews| 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 <map> | |
|
mark a. foltz
2016/11/15 23:41:46
Only #include <string> seems to be necessary in th
zhaobin
2016/11/16 18:02:41
Done.
| |
| 9 #include <memory> | |
| 10 #include <string> | |
| 11 #include <utility> | |
| 12 #include <vector> | |
| 13 | |
| 14 #include "base/observer_list.h" | |
|
mark a. foltz
2016/11/15 23:41:46
Not needed
zhaobin
2016/11/16 18:02:41
Done.
| |
| 15 | |
|
mark a. foltz
2016/11/15 23:41:46
Nit: extra newline
zhaobin
2016/11/16 18:02:41
Done.
| |
| 16 #include "chrome/browser/media/router/offscreen_presentation_manager.h" | |
|
mark a. foltz
2016/11/15 23:41:46
Forward declare OffScreenPresentationManager and m
zhaobin
2016/11/16 18:02:41
Done.
| |
| 17 #include "chrome/browser/media/router/offscreen_presentation_manager_factory.h" | |
|
mark a. foltz
2016/11/15 23:41:46
Move to .cc
zhaobin
2016/11/16 18:02:41
Done.
| |
| 18 #include "chrome/browser/media/router/presentation_service_delegate_base_impl.h" | |
| 19 #include "chrome/browser/media/router/render_frame_host_id.h" | |
|
mark a. foltz
2016/11/15 23:41:46
Not needed?
zhaobin
2016/11/16 18:02:41
Done.
| |
| 20 #include "content/public/browser/presentation_service_delegate.h" | |
| 21 #include "content/public/browser/web_contents_user_data.h" | |
| 22 | |
| 23 namespace content { | |
| 24 class RenderFrameHost; | |
|
mark a. foltz
2016/11/15 23:41:46
In this list, it looks like only WebContents needs
zhaobin
2016/11/16 18:02:41
Done.
| |
| 25 class WebContents; | |
| 26 struct PresentationSessionInfo; | |
| 27 struct PresentationSessionMessage; | |
| 28 } // namespace content | |
| 29 | |
| 30 namespace media_router { | |
| 31 | |
| 32 // Implements the receiver side of presentation API for offscreen presentation. | |
|
mark a. foltz
2016/11/15 23:41:46
Nit: Presentation
zhaobin
2016/11/16 18:02:41
Done.
| |
| 33 // Created with offscreen WebContents for an offscreen presentation. Each | |
| 34 // instance is tied to a single offscreen presentation whose ID is given during | |
| 35 // construction. As such, the receiver APIs are contextual with the offscreen | |
| 36 // presentation. Only the main frame of the offscreen WebContents is allowed to | |
| 37 // make receiver Presentation API requests; requests made from any other frame | |
| 38 // will be rejected. | |
| 39 class ReceiverPresentationServiceDelegateImpl | |
| 40 : public content::WebContentsUserData< | |
| 41 ReceiverPresentationServiceDelegateImpl>, | |
| 42 public content::ReceiverPresentationServiceDelegate, | |
| 43 public PresentationServiceDelegateBaseImpl { | |
| 44 public: | |
| 45 // Creates an instance of ReceiverPresentationServiceDelegateImpl under | |
| 46 // |web_contents| and registers it as the receiver of the offscreen | |
| 47 // presentation |presentation_id| with OffscreenPresentationManager. | |
| 48 // No-op if a ReceiverPresentationServiceDelegateImpl instance already | |
| 49 // exists under |web_contents|. This class does not take ownership of | |
| 50 // |web_contents|. | |
| 51 static void CreateForWebContents(content::WebContents* web_contents, | |
| 52 const std::string& presentation_id); | |
| 53 | |
| 54 ~ReceiverPresentationServiceDelegateImpl() override; | |
| 55 | |
| 56 // content::PresentationServiceDelegateBase implementation. | |
| 57 void AddObserver( | |
| 58 int render_process_id, | |
| 59 int render_frame_id, | |
| 60 content::PresentationServiceDelegateBase::Observer* observer) override; | |
| 61 void RemoveObserver(int render_process_id, int render_frame_id) override; | |
| 62 void Reset(int render_process_id, int render_frame_id) override; | |
| 63 | |
| 64 // content::ReceiverPresentationServiceDelegate implementation. | |
| 65 void RegisterReceiverConnectionAvailableCallback( | |
| 66 const content::ReceiverConnectionAvailableCallback& | |
| 67 receiver_available_callback) override; | |
| 68 | |
| 69 private: | |
| 70 friend class content::WebContentsUserData< | |
| 71 ReceiverPresentationServiceDelegateImpl>; | |
| 72 | |
| 73 ReceiverPresentationServiceDelegateImpl(content::WebContents* web_contents, | |
| 74 const std::string& presentation_id); | |
| 75 | |
| 76 // Reference to the WebContents that owns this instance. | |
| 77 content::WebContents* const web_contents_; | |
| 78 | |
| 79 const std::string presentation_id_; | |
| 80 OffscreenPresentationManager* const offscreen_presentation_manager_; | |
| 81 | |
| 82 DISALLOW_COPY_AND_ASSIGN(ReceiverPresentationServiceDelegateImpl); | |
| 83 }; | |
| 84 | |
| 85 } // namespace media_router | |
| 86 | |
| 87 #endif // CHROME_BROWSER_MEDIA_ROUTER_RECEIVER_PRESENTATION_SERVICE_DELEGATE_IM PL_H_ | |
| OLD | NEW |