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