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 <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/containers/hash_tables.h" | 15 #include "base/containers/hash_tables.h" |
16 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
17 #include "base/macros.h" | 17 #include "base/macros.h" |
18 #include "base/memory/linked_ptr.h" | 18 #include "base/memory/linked_ptr.h" |
19 #include "base/memory/scoped_vector.h" | 19 #include "base/memory/scoped_vector.h" |
20 #include "base/memory/weak_ptr.h" | 20 #include "base/memory/weak_ptr.h" |
| 21 #include "base/optional.h" |
21 #include "content/common/content_export.h" | 22 #include "content/common/content_export.h" |
22 #include "content/public/browser/navigation_details.h" | 23 #include "content/public/browser/navigation_details.h" |
23 #include "content/public/browser/presentation_screen_availability_listener.h" | 24 #include "content/public/browser/presentation_screen_availability_listener.h" |
24 #include "content/public/browser/presentation_service_delegate.h" | 25 #include "content/public/browser/presentation_service_delegate.h" |
25 #include "content/public/browser/web_contents_observer.h" | 26 #include "content/public/browser/web_contents_observer.h" |
26 #include "content/public/common/frame_navigate_params.h" | 27 #include "content/public/common/frame_navigate_params.h" |
27 #include "mojo/public/cpp/bindings/binding.h" | 28 #include "mojo/public/cpp/bindings/binding.h" |
28 #include "third_party/WebKit/public/platform/modules/presentation/presentation.m
ojom.h" | 29 #include "third_party/WebKit/public/platform/modules/presentation/presentation.m
ojom.h" |
29 | 30 |
30 namespace content { | 31 namespace content { |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 // |render_frame_host|: The RFH this instance is associated with. | 143 // |render_frame_host|: The RFH this instance is associated with. |
143 // |web_contents|: The WebContents to observe. | 144 // |web_contents|: The WebContents to observe. |
144 // |delegate|: Where Presentation API requests are delegated to. Not owned | 145 // |delegate|: Where Presentation API requests are delegated to. Not owned |
145 // by this class. | 146 // by this class. |
146 PresentationServiceImpl( | 147 PresentationServiceImpl( |
147 RenderFrameHost* render_frame_host, | 148 RenderFrameHost* render_frame_host, |
148 WebContents* web_contents, | 149 WebContents* web_contents, |
149 PresentationServiceDelegate* delegate); | 150 PresentationServiceDelegate* delegate); |
150 | 151 |
151 // PresentationService implementation. | 152 // PresentationService implementation. |
152 void SetDefaultPresentationURL(const mojo::String& url) override; | 153 void SetDefaultPresentationURL(const std::string& url) override; |
153 void SetClient(blink::mojom::PresentationServiceClientPtr client) override; | 154 void SetClient(blink::mojom::PresentationServiceClientPtr client) override; |
154 void ListenForScreenAvailability(const mojo::String& url) override; | 155 void ListenForScreenAvailability(const std::string& url) override; |
155 void StopListeningForScreenAvailability(const mojo::String& url) override; | 156 void StopListeningForScreenAvailability(const std::string& url) override; |
156 void StartSession( | 157 void StartSession(const std::string& presentation_url, |
157 const mojo::String& presentation_url, | 158 const NewSessionCallback& callback) override; |
158 const NewSessionCallback& callback) override; | 159 void JoinSession(const std::string& presentation_url, |
159 void JoinSession( | 160 const base::Optional<std::string>& presentation_id, |
160 const mojo::String& presentation_url, | 161 const NewSessionCallback& callback) override; |
161 const mojo::String& presentation_id, | |
162 const NewSessionCallback& callback) override; | |
163 void SendSessionMessage(blink::mojom::PresentationSessionInfoPtr session_info, | 162 void SendSessionMessage(blink::mojom::PresentationSessionInfoPtr session_info, |
164 blink::mojom::SessionMessagePtr session_message, | 163 blink::mojom::SessionMessagePtr session_message, |
165 const SendSessionMessageCallback& callback) override; | 164 const SendSessionMessageCallback& callback) override; |
166 void CloseConnection(const mojo::String& presentation_url, | 165 void CloseConnection(const std::string& presentation_url, |
167 const mojo::String& presentation_id) override; | 166 const std::string& presentation_id) override; |
168 void Terminate(const mojo::String& presentation_url, | 167 void Terminate(const std::string& presentation_url, |
169 const mojo::String& presentation_id) override; | 168 const std::string& presentation_id) override; |
170 void ListenForSessionMessages( | 169 void ListenForSessionMessages( |
171 blink::mojom::PresentationSessionInfoPtr session) override; | 170 blink::mojom::PresentationSessionInfoPtr session) override; |
172 | 171 |
173 // Creates a binding between this object and |request|. | 172 // Creates a binding between this object and |request|. |
174 void Bind(mojo::InterfaceRequest<blink::mojom::PresentationService> request); | 173 void Bind(mojo::InterfaceRequest<blink::mojom::PresentationService> request); |
175 | 174 |
176 // WebContentsObserver override. | 175 // WebContentsObserver override. |
177 void DidNavigateAnyFrame( | 176 void DidNavigateAnyFrame( |
178 content::RenderFrameHost* render_frame_host, | 177 content::RenderFrameHost* render_frame_host, |
179 const content::LoadCommittedDetails& details, | 178 const content::LoadCommittedDetails& details, |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 | 283 |
285 // NOTE: Weak pointers must be invalidated before all other member variables. | 284 // NOTE: Weak pointers must be invalidated before all other member variables. |
286 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_; | 285 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_; |
287 | 286 |
288 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl); | 287 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl); |
289 }; | 288 }; |
290 | 289 |
291 } // namespace content | 290 } // namespace content |
292 | 291 |
293 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ | 292 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ |
OLD | NEW |