Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1507)

Unified Diff: content/browser/presentation/presentation_service_impl.h

Issue 2737413003: [Presentation API] Remove references to presentation sessions. (Closed)
Patch Set: Update PresentationServiceDelegateImpl unittest Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 475684068933eb38d405fb3c5afef23b64dbe17f..4381b4a931b6a6e18eb3579e26c1eb1f21a3d132 100644
--- a/content/browser/presentation/presentation_service_impl.h
+++ b/content/browser/presentation/presentation_service_impl.h
@@ -49,8 +49,8 @@ class CONTENT_EXPORT PresentationServiceImpl
public:
~PresentationServiceImpl() override;
- using NewSessionCallback =
- base::Callback<void(const base::Optional<PresentationSessionInfo>&,
+ using NewPresentationCallback =
+ base::Callback<void(const base::Optional<PresentationInfo>&,
const base::Optional<PresentationError>&)>;
// Static factory method to create an instance of PresentationServiceImpl.
@@ -77,17 +77,17 @@ class CONTENT_EXPORT PresentationServiceImpl
FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest,
ClearDefaultPresentationUrls);
FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest,
- ListenForDefaultSessionStart);
+ ListenForDefaultPresentationStart);
FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest,
- ListenForDefaultSessionStartAfterSet);
+ ListenForDefaultPresentationStartAfterSet);
FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest,
- DefaultSessionStartReset);
+ DefaultPresentationStartReset);
FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest,
ReceiveConnectionMessagesAfterReset);
FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest,
- MaxPendingStartSessionRequests);
+ MaxPendingStartPresentationRequests);
FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest,
- MaxPendingJoinSessionRequests);
+ MaxPendingReconnectPresentationRequests);
FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest,
ListenForConnectionStateChange);
FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest,
@@ -97,8 +97,8 @@ class CONTENT_EXPORT PresentationServiceImpl
FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest,
ReceiverPresentationServiceDelegate);
- // Maximum number of pending JoinSession requests at any given time.
- static const int kMaxNumQueuedSessionRequests = 10;
+ // Maximum number of pending ReconnectPresentation requests at any given time.
+ static const int kMaxQueuedRequests = 10;
using ConnectionMessagesCallback =
base::Callback<void(std::vector<PresentationConnectionMessage>)>;
@@ -124,21 +124,21 @@ class CONTENT_EXPORT PresentationServiceImpl
PresentationServiceImpl* const service_;
};
- // Ensures the provided NewSessionCallback is invoked exactly once
+ // Ensures the provided NewPresentationCallback is invoked exactly once
// before it goes out of scope.
- class NewSessionCallbackWrapper {
+ class NewPresentationCallbackWrapper {
public:
- explicit NewSessionCallbackWrapper(
- const NewSessionCallback& callback);
- ~NewSessionCallbackWrapper();
+ explicit NewPresentationCallbackWrapper(
+ const NewPresentationCallback& callback);
+ ~NewPresentationCallbackWrapper();
- void Run(const base::Optional<PresentationSessionInfo>& session_info,
+ void Run(const base::Optional<PresentationInfo>& presentation_info,
const base::Optional<PresentationError>& error);
private:
- NewSessionCallback callback_;
+ NewPresentationCallback callback_;
- DISALLOW_COPY_AND_ASSIGN(NewSessionCallbackWrapper);
+ DISALLOW_COPY_AND_ASSIGN(NewPresentationCallbackWrapper);
};
// |render_frame_host|: The RFH this instance is associated with.
@@ -161,19 +161,19 @@ class CONTENT_EXPORT PresentationServiceImpl
void SetClient(blink::mojom::PresentationServiceClientPtr client) override;
void ListenForScreenAvailability(const GURL& url) override;
void StopListeningForScreenAvailability(const GURL& url) override;
- void StartSession(const std::vector<GURL>& presentation_urls,
- const NewSessionCallback& callback) override;
- void JoinSession(const std::vector<GURL>& presentation_urls,
- const base::Optional<std::string>& presentation_id,
- const NewSessionCallback& callback) override;
+ void StartPresentation(const std::vector<GURL>& presentation_urls,
+ const NewPresentationCallback& callback) override;
+ void ReconnectPresentation(const std::vector<GURL>& presentation_urls,
+ const base::Optional<std::string>& presentation_id,
+ const NewPresentationCallback& callback) override;
void CloseConnection(const GURL& presentation_url,
const std::string& presentation_id) override;
void Terminate(const GURL& presentation_url,
const std::string& presentation_id) override;
void ListenForConnectionMessages(
- const PresentationSessionInfo& session_info) override;
+ const PresentationInfo& presentation_info) override;
void SetPresentationConnection(
- const PresentationSessionInfo& session_info,
+ const PresentationInfo& presentation_info,
blink::mojom::PresentationConnectionPtr controller_connection_ptr,
blink::mojom::PresentationConnectionRequest receiver_connection_request)
override;
@@ -191,17 +191,16 @@ class CONTENT_EXPORT PresentationServiceImpl
// Passed to embedder's implementation of PresentationServiceDelegate for
// later invocation when default presentation has started.
- void OnDefaultPresentationStarted(
- const PresentationSessionInfo& session_info);
-
- // Finds the callback from |pending_join_session_cbs_| using
- // |request_session_id|.
- // If it exists, invoke it with |session_info| and |error|, then erase it from
- // |pending_join_session_cbs_|.
- // Returns true if the callback was found.
- bool RunAndEraseJoinSessionMojoCallback(
- int request_session_id,
- const base::Optional<PresentationSessionInfo>& session_info,
+ void OnDefaultPresentationStarted(const PresentationInfo& presentation_info);
+
+ // Finds the callback from |pending_reconnect_presentation_cbs_| using
+ // |request_id|.
+ // If it exists, invoke it with |presentation_info| and |error|, then erase it
+ // from |pending_reconnect_presentation_cbs_|. Returns true if the callback
+ // was found.
+ bool RunAndEraseReconnectPresentationMojoCallback(
+ int request_id,
+ const base::Optional<PresentationInfo>& presentation_info,
const base::Optional<PresentationError>& error);
// Removes all listeners and resets default presentation URL on this instance
@@ -211,47 +210,43 @@ class CONTENT_EXPORT PresentationServiceImpl
// These functions are bound as base::Callbacks and passed to
// embedder's implementation of PresentationServiceDelegate for later
// invocation.
- void OnStartSessionSucceeded(
- int request_session_id,
- const PresentationSessionInfo& session_info);
- void OnStartSessionError(
- int request_session_id,
- const PresentationError& error);
- void OnJoinSessionSucceeded(
- int request_session_id,
- const PresentationSessionInfo& session_info);
- void OnJoinSessionError(
- int request_session_id,
- const PresentationError& error);
+ void OnStartPresentationSucceeded(int request_id,
+ const PresentationInfo& presentation_info);
+ void OnStartPresentationError(int request_id, const PresentationError& error);
+ void OnReconnectPresentationSucceeded(
+ int request_id,
+ const PresentationInfo& presentation_info);
+ void OnReconnectPresentationError(int request_id,
+ const PresentationError& error);
// Calls to |delegate_| to start listening for state changes for |connection|.
// State changes will be returned via |OnConnectionStateChanged|.
- void ListenForConnectionStateChange(
- const PresentationSessionInfo& connection);
+ void ListenForConnectionStateChange(const PresentationInfo& connection);
// Passed to embedder's implementation of PresentationServiceDelegate for
- // later invocation when session messages arrive.
+ // later invocation when connection messages arrive.
void OnConnectionMessages(
- const content::PresentationSessionInfo& session_info,
+ const content::PresentationInfo& presentation_info,
std::vector<content::PresentationConnectionMessage> messages);
// A callback registered to OffscreenPresentationManager when
// the PresentationServiceImpl for the presentation receiver is initialized.
// Calls |client_| to create a new PresentationConnection on receiver page.
void OnReceiverConnectionAvailable(
- const content::PresentationSessionInfo& session_info,
+ const content::PresentationInfo& presentation_info,
PresentationConnectionPtr controller_connection_ptr,
PresentationConnectionRequest receiver_connection_request);
- // Associates a JoinSession |callback| with a unique request ID and
+ // Associates a ReconnectPresentation |callback| with a unique request ID and
// stores it in a map.
// Returns a positive value on success.
- int RegisterJoinSessionCallback(const NewSessionCallback& callback);
+ int RegisterReconnectPresentationCallback(
+ const NewPresentationCallback& callback);
// Invoked by the embedder's PresentationServiceDelegate when a
// PresentationConnection's state has changed.
void OnConnectionStateChanged(
- const PresentationSessionInfo& connection,
+ const PresentationInfo& connection,
const PresentationConnectionStateChangeInfo& info);
// Returns true if this object is associated with |render_frame_host|.
@@ -281,14 +276,16 @@ class CONTENT_EXPORT PresentationServiceImpl
std::map<GURL, std::unique_ptr<ScreenAvailabilityListenerImpl>>;
ScreenAvailabilityListenerMap screen_availability_listeners_;
- // For StartSession requests.
- // Set to a positive value when a StartSession request is being processed.
- int start_session_request_id_;
- std::unique_ptr<NewSessionCallbackWrapper> pending_start_session_cb_;
+ // For StartPresentation requests.
+ // Set to a positive value when a StartPresentation request is being
+ // processed.
+ int start_presentation_request_id_;
+ std::unique_ptr<NewPresentationCallbackWrapper>
+ pending_start_presentation_cb_;
- // For JoinSession requests.
- base::hash_map<int, linked_ptr<NewSessionCallbackWrapper>>
- pending_join_session_cbs_;
+ // For ReconnectPresentation requests.
+ base::hash_map<int, linked_ptr<NewPresentationCallbackWrapper>>
+ pending_reconnect_presentation_cbs_;
// RAII binding of |this| to an Presentation interface request.
// The binding is removed when binding_ is cleared or goes out of scope.

Powered by Google App Engine
This is Rietveld 408576698