OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ |
6 #define CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ | 6 #define CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/linked_ptr.h" | 13 #include "base/memory/linked_ptr.h" |
14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
15 #include "content/common/presentation/presentation_service.mojom.h" | 15 #include "content/common/presentation/presentation_service.mojom.h" |
| 16 #include "content/common/presentation/presentation_session.mojom.h" |
16 #include "content/public/browser/navigation_details.h" | 17 #include "content/public/browser/navigation_details.h" |
17 #include "content/public/browser/presentation_screen_availability_listener.h" | 18 #include "content/public/browser/presentation_screen_availability_listener.h" |
18 #include "content/public/browser/presentation_service_delegate.h" | 19 #include "content/public/browser/presentation_service_delegate.h" |
19 #include "content/public/browser/web_contents_observer.h" | 20 #include "content/public/browser/web_contents_observer.h" |
20 #include "content/public/common/frame_navigate_params.h" | 21 #include "content/public/common/frame_navigate_params.h" |
21 | 22 |
22 namespace content { | 23 namespace content { |
23 | 24 |
24 struct FrameNavigateParams; | 25 struct FrameNavigateParams; |
25 struct LoadCommittedDetails; | 26 struct LoadCommittedDetails; |
(...skipping 17 matching lines...) Expand all Loading... |
43 | 44 |
44 // Static factory method to create an instance of PresentationServiceImpl. | 45 // Static factory method to create an instance of PresentationServiceImpl. |
45 // |render_frame_host|: The RFH the instance is associated with. | 46 // |render_frame_host|: The RFH the instance is associated with. |
46 // |request|: The instance will be bound to this request. Used for Mojo setup. | 47 // |request|: The instance will be bound to this request. Used for Mojo setup. |
47 static void CreateMojoService( | 48 static void CreateMojoService( |
48 RenderFrameHost* render_frame_host, | 49 RenderFrameHost* render_frame_host, |
49 mojo::InterfaceRequest<presentation::PresentationService> request); | 50 mojo::InterfaceRequest<presentation::PresentationService> request); |
50 | 51 |
51 private: | 52 private: |
52 typedef mojo::Callback<void(bool)> ScreenAvailabilityMojoCallback; | 53 typedef mojo::Callback<void(bool)> ScreenAvailabilityMojoCallback; |
| 54 typedef mojo::Callback<void( |
| 55 bool, |
| 56 mojo::InterfaceRequest<presentation::PresentationSession>, |
| 57 mojo::String, |
| 58 mojo::String, |
| 59 mojo::String)> NewSessionMojoCallback; |
53 | 60 |
54 friend class PresentationServiceImplTest; | 61 friend class PresentationServiceImplTest; |
55 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, RemoveAllListeners); | 62 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, RemoveAllListeners); |
56 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, | 63 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, |
57 DidNavigateThisFrame); | 64 DidNavigateThisFrame); |
58 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, | 65 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, |
59 DidNavigateNotThisFrame); | 66 DidNavigateNotThisFrame); |
60 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, | 67 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, |
61 ThisRenderFrameDeleted); | 68 ThisRenderFrameDeleted); |
62 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, | 69 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, |
63 NotThisRenderFrameDeleted); | 70 NotThisRenderFrameDeleted); |
64 | 71 |
65 // |render_frame_host|: The RFH this instance is associated with. | 72 // |render_frame_host|: The RFH this instance is associated with. |
66 // |web_contents|: The WebContents to observe. | 73 // |web_contents|: The WebContents to observe. |
67 // |delegate|: Where Presentation API requests are delegated to. Not owned | 74 // |delegate|: Where Presentation API requests are delegated to. Not owned |
68 // by this class. | 75 // by this class. |
69 PresentationServiceImpl( | 76 PresentationServiceImpl( |
70 RenderFrameHost* render_frame_host, | 77 RenderFrameHost* render_frame_host, |
71 WebContents* web_contents, | 78 WebContents* web_contents, |
72 PresentationServiceDelegate* delegate); | 79 PresentationServiceDelegate* delegate); |
73 | 80 |
74 // PresentationService implementation. | 81 // PresentationService implementation. |
75 void GetScreenAvailability( | 82 void GetScreenAvailability( |
76 const mojo::String& presentation_url, | 83 const mojo::String& presentation_url, |
77 const ScreenAvailabilityMojoCallback& callback) override; | 84 const ScreenAvailabilityMojoCallback& callback) override; |
78 void OnScreenAvailabilityListenerRemoved() override; | 85 void OnScreenAvailabilityListenerRemoved() override; |
| 86 void StartSession( |
| 87 const mojo::String& presentation_url, |
| 88 const mojo::String& presentation_id, |
| 89 const NewSessionMojoCallback& callback) override; |
| 90 void JoinSession( |
| 91 const mojo::String& presentation_url, |
| 92 const mojo::String& presentation_id, |
| 93 const NewSessionMojoCallback& callback) override; |
79 | 94 |
80 // mojo::InterfaceImpl override. | 95 // mojo::InterfaceImpl override. |
81 // Note that this is called when the RenderFrameHost is deleted. | 96 // Note that this is called when the RenderFrameHost is deleted. |
82 void OnConnectionError() override; | 97 void OnConnectionError() override; |
83 | 98 |
84 // WebContentsObserver override. | 99 // WebContentsObserver override. |
85 void DidNavigateAnyFrame( | 100 void DidNavigateAnyFrame( |
86 content::RenderFrameHost* render_frame_host, | 101 content::RenderFrameHost* render_frame_host, |
87 const content::LoadCommittedDetails& details, | 102 const content::LoadCommittedDetails& details, |
88 const content::FrameNavigateParams& params) override; | 103 const content::FrameNavigateParams& params) override; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 availability_contexts_; | 158 availability_contexts_; |
144 | 159 |
145 std::string default_presentation_url_; | 160 std::string default_presentation_url_; |
146 | 161 |
147 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl); | 162 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl); |
148 }; | 163 }; |
149 | 164 |
150 } // namespace content | 165 } // namespace content |
151 | 166 |
152 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ | 167 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ |
OLD | NEW |