| Index: content/browser/presentation/presentation_service_impl.h
|
| diff --git a/content/browser/presentation/presentation_service_impl.h b/content/browser/presentation/presentation_service_impl.h
|
| index 44fb0e10fa36897dc12fa01d084d7f756200b6d5..2bdc3e9029b4cc9b4334bf8576ffe27930700b7d 100644
|
| --- a/content/browser/presentation/presentation_service_impl.h
|
| +++ b/content/browser/presentation/presentation_service_impl.h
|
| @@ -10,6 +10,7 @@
|
| #include <memory>
|
| #include <string>
|
|
|
| +#include "base/callback.h"
|
| #include "base/compiler_specific.h"
|
| #include "base/containers/hash_tables.h"
|
| #include "base/gtest_prod_util.h"
|
| @@ -33,10 +34,6 @@ struct LoadCommittedDetails;
|
| struct PresentationSessionMessage;
|
| class RenderFrameHost;
|
|
|
| -using NewSessionMojoCallback =
|
| - mojo::Callback<void(blink::mojom::PresentationSessionInfoPtr,
|
| - blink::mojom::PresentationErrorPtr)>;
|
| -
|
| // Implementation of Mojo PresentationService.
|
| // It handles Presentation API requests coming from Blink / renderer process
|
| // and delegates the requests to the embedder's media router via
|
| @@ -50,6 +47,10 @@ class CONTENT_EXPORT PresentationServiceImpl
|
| public WebContentsObserver,
|
| public PresentationServiceDelegate::Observer {
|
| public:
|
| + using NewSessionCallback =
|
| + base::Callback<void(blink::mojom::PresentationSessionInfoPtr,
|
| + blink::mojom::PresentationErrorPtr)>;
|
| +
|
| ~PresentationServiceImpl() override;
|
|
|
| // Static factory method to create an instance of PresentationServiceImpl.
|
| @@ -95,11 +96,9 @@ class CONTENT_EXPORT PresentationServiceImpl
|
| // Maximum number of pending JoinSession requests at any given time.
|
| static const int kMaxNumQueuedSessionRequests = 10;
|
|
|
| - using PresentationSessionMojoCallback =
|
| - mojo::Callback<void(blink::mojom::PresentationSessionInfoPtr)>;
|
| using SessionMessagesCallback =
|
| - mojo::Callback<void(mojo::Array<blink::mojom::SessionMessagePtr>)>;
|
| - using SendMessageMojoCallback = mojo::Callback<void(bool)>;
|
| + base::Callback<void(mojo::Array<blink::mojom::SessionMessagePtr>)>;
|
| + using SendSessionMessageCallback = base::Callback<void(bool)>;
|
|
|
| // Listener implementation owned by PresentationServiceImpl. An instance of
|
| // this is created when PresentationRequest.getAvailability() is resolved.
|
| @@ -123,21 +122,21 @@ class CONTENT_EXPORT PresentationServiceImpl
|
| PresentationServiceImpl* const service_;
|
| };
|
|
|
| - // Ensures the provided NewSessionMojoCallback is invoked exactly once
|
| + // Ensures the provided NewSessionCallback is invoked exactly once
|
| // before it goes out of scope.
|
| - class NewSessionMojoCallbackWrapper {
|
| + class NewSessionCallbackWrapper {
|
| public:
|
| - explicit NewSessionMojoCallbackWrapper(
|
| - const NewSessionMojoCallback& callback);
|
| - ~NewSessionMojoCallbackWrapper();
|
| + explicit NewSessionCallbackWrapper(
|
| + const NewSessionCallback& callback);
|
| + ~NewSessionCallbackWrapper();
|
|
|
| void Run(blink::mojom::PresentationSessionInfoPtr session,
|
| blink::mojom::PresentationErrorPtr error);
|
|
|
| private:
|
| - NewSessionMojoCallback callback_;
|
| + NewSessionCallback callback_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(NewSessionMojoCallbackWrapper);
|
| + DISALLOW_COPY_AND_ASSIGN(NewSessionCallbackWrapper);
|
| };
|
|
|
| // |render_frame_host|: The RFH this instance is associated with.
|
| @@ -156,14 +155,14 @@ class CONTENT_EXPORT PresentationServiceImpl
|
| void StopListeningForScreenAvailability(const mojo::String& url) override;
|
| void StartSession(
|
| const mojo::String& presentation_url,
|
| - const NewSessionMojoCallback& callback) override;
|
| + const NewSessionCallback& callback) override;
|
| void JoinSession(
|
| const mojo::String& presentation_url,
|
| const mojo::String& presentation_id,
|
| - const NewSessionMojoCallback& callback) override;
|
| + const NewSessionCallback& callback) override;
|
| void SendSessionMessage(blink::mojom::PresentationSessionInfoPtr session_info,
|
| blink::mojom::SessionMessagePtr session_message,
|
| - const SendMessageMojoCallback& callback) override;
|
| + const SendSessionMessageCallback& callback) override;
|
| void CloseConnection(const mojo::String& presentation_url,
|
| const mojo::String& presentation_id) override;
|
| void Terminate(const mojo::String& presentation_url,
|
| @@ -236,7 +235,7 @@ class CONTENT_EXPORT PresentationServiceImpl
|
| // Associates a JoinSession |callback| with a unique request ID and
|
| // stores it in a map.
|
| // Returns a positive value on success.
|
| - int RegisterJoinSessionCallback(const NewSessionMojoCallback& callback);
|
| + int RegisterJoinSessionCallback(const NewSessionCallback& callback);
|
|
|
| // Invoked by the embedder's PresentationServiceDelegate when a
|
| // PresentationConnection's state has changed.
|
| @@ -264,10 +263,10 @@ class CONTENT_EXPORT PresentationServiceImpl
|
| // For StartSession requests.
|
| // Set to a positive value when a StartSession request is being processed.
|
| int start_session_request_id_;
|
| - std::unique_ptr<NewSessionMojoCallbackWrapper> pending_start_session_cb_;
|
| + std::unique_ptr<NewSessionCallbackWrapper> pending_start_session_cb_;
|
|
|
| // For JoinSession requests.
|
| - base::hash_map<int, linked_ptr<NewSessionMojoCallbackWrapper>>
|
| + base::hash_map<int, linked_ptr<NewSessionCallbackWrapper>>
|
| pending_join_session_cbs_;
|
|
|
| // RAII binding of |this| to an Presentation interface request.
|
| @@ -275,7 +274,7 @@ class CONTENT_EXPORT PresentationServiceImpl
|
| std::unique_ptr<mojo::Binding<blink::mojom::PresentationService>> binding_;
|
|
|
| // There can be only one send message request at a time.
|
| - std::unique_ptr<SendMessageMojoCallback> send_message_callback_;
|
| + std::unique_ptr<SendSessionMessageCallback> send_message_callback_;
|
|
|
| std::unique_ptr<SessionMessagesCallback> on_session_messages_callback_;
|
|
|
|
|