| 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 <set> |
| 11 #include <string> | 12 #include <string> |
| 12 #include <vector> | 13 #include <vector> |
| 13 | 14 |
| 14 #include "base/callback.h" | 15 #include "base/callback.h" |
| 15 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
| 16 #include "base/containers/hash_tables.h" | 17 #include "base/containers/hash_tables.h" |
| 17 #include "base/gtest_prod_util.h" | 18 #include "base/gtest_prod_util.h" |
| 18 #include "base/macros.h" | 19 #include "base/macros.h" |
| 19 #include "base/memory/linked_ptr.h" | 20 #include "base/memory/linked_ptr.h" |
| 20 #include "base/memory/scoped_vector.h" | 21 #include "base/memory/scoped_vector.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 const NewSessionCallback& callback) override; | 165 const NewSessionCallback& callback) override; |
| 165 void SendSessionMessage(blink::mojom::PresentationSessionInfoPtr session_info, | 166 void SendSessionMessage(blink::mojom::PresentationSessionInfoPtr session_info, |
| 166 blink::mojom::SessionMessagePtr session_message, | 167 blink::mojom::SessionMessagePtr session_message, |
| 167 const SendSessionMessageCallback& callback) override; | 168 const SendSessionMessageCallback& callback) override; |
| 168 void CloseConnection(const GURL& presentation_url, | 169 void CloseConnection(const GURL& presentation_url, |
| 169 const std::string& presentation_id) override; | 170 const std::string& presentation_id) override; |
| 170 void Terminate(const GURL& presentation_url, | 171 void Terminate(const GURL& presentation_url, |
| 171 const std::string& presentation_id) override; | 172 const std::string& presentation_id) override; |
| 172 void ListenForSessionMessages( | 173 void ListenForSessionMessages( |
| 173 blink::mojom::PresentationSessionInfoPtr session) override; | 174 blink::mojom::PresentationSessionInfoPtr session) override; |
| 175 void SetPresentationConnection( |
| 176 blink::mojom::PresentationSessionInfoPtr session, |
| 177 blink::mojom::PresentationConnectionPtr connection) override; |
| 174 | 178 |
| 175 // Creates a binding between this object and |request|. | 179 // Creates a binding between this object and |request|. |
| 176 void Bind(mojo::InterfaceRequest<blink::mojom::PresentationService> request); | 180 void Bind(mojo::InterfaceRequest<blink::mojom::PresentationService> request); |
| 177 | 181 |
| 178 // WebContentsObserver override. | 182 // WebContentsObserver override. |
| 179 void DidNavigateAnyFrame( | 183 void DidNavigateAnyFrame( |
| 180 content::RenderFrameHost* render_frame_host, | 184 content::RenderFrameHost* render_frame_host, |
| 181 const content::LoadCommittedDetails& details, | 185 const content::LoadCommittedDetails& details, |
| 182 const content::FrameNavigateParams& params) override; | 186 const content::FrameNavigateParams& params) override; |
| 183 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override; | 187 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 void OnJoinSessionError( | 224 void OnJoinSessionError( |
| 221 int request_session_id, | 225 int request_session_id, |
| 222 const PresentationError& error); | 226 const PresentationError& error); |
| 223 void OnSendMessageCallback(bool sent); | 227 void OnSendMessageCallback(bool sent); |
| 224 | 228 |
| 225 // Calls to |delegate_| to start listening for state changes for |connection|. | 229 // Calls to |delegate_| to start listening for state changes for |connection|. |
| 226 // State changes will be returned via |OnConnectionStateChanged|. | 230 // State changes will be returned via |OnConnectionStateChanged|. |
| 227 void ListenForConnectionStateChange( | 231 void ListenForConnectionStateChange( |
| 228 const PresentationSessionInfo& connection); | 232 const PresentationSessionInfo& connection); |
| 229 | 233 |
| 230 // Passed to embedder's implementation of PresentationServiceDelegate for | |
| 231 // later invocation when session messages arrive. | |
| 232 void OnSessionMessages( | 234 void OnSessionMessages( |
| 233 const content::PresentationSessionInfo& session, | 235 const content::PresentationSessionInfo& session, |
| 234 const ScopedVector<PresentationSessionMessage>& messages, | 236 const ScopedVector<PresentationSessionMessage>& messages, |
| 235 bool pass_ownership); | 237 bool pass_ownership); |
| 236 | 238 |
| 239 // A callback registered to OffscreenPresentationManager when |
| 240 // receiver PSImpl inits. Calls |client_| to create a new |
| 241 // PresentationConnection on receiver page. |
| 242 void OnReceiverConnectionAvailable( |
| 243 const content::PresentationSessionInfo& session_info, |
| 244 PresentationConnectionPtr&& controller_connection); |
| 245 |
| 237 // Associates a JoinSession |callback| with a unique request ID and | 246 // Associates a JoinSession |callback| with a unique request ID and |
| 238 // stores it in a map. | 247 // stores it in a map. |
| 239 // Returns a positive value on success. | 248 // Returns a positive value on success. |
| 240 int RegisterJoinSessionCallback(const NewSessionCallback& callback); | 249 int RegisterJoinSessionCallback(const NewSessionCallback& callback); |
| 241 | 250 |
| 242 // Invoked by the embedder's PresentationServiceDelegate when a | 251 // Invoked by the embedder's PresentationServiceDelegate when a |
| 243 // PresentationConnection's state has changed. | 252 // PresentationConnection's state has changed. |
| 244 void OnConnectionStateChanged( | 253 void OnConnectionStateChanged( |
| 245 const PresentationSessionInfo& connection, | 254 const PresentationSessionInfo& connection, |
| 246 const PresentationConnectionStateChangeInfo& info); | 255 const PresentationConnectionStateChangeInfo& info); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 | 295 |
| 287 // NOTE: Weak pointers must be invalidated before all other member variables. | 296 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 288 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_; | 297 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_; |
| 289 | 298 |
| 290 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl); | 299 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl); |
| 291 }; | 300 }; |
| 292 | 301 |
| 293 } // namespace content | 302 } // namespace content |
| 294 | 303 |
| 295 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ | 304 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ |
| OLD | NEW |