Chromium Code Reviews| Index: content/public/browser/presentation_service_delegate.h |
| diff --git a/content/public/browser/presentation_service_delegate.h b/content/public/browser/presentation_service_delegate.h |
| index 1f5e928483d0ef8830d372d5499a72d9690f330e..2376bbd11ebe46cc3faa0073231c85a89f8ee8fa 100644 |
| --- a/content/public/browser/presentation_service_delegate.h |
| +++ b/content/public/browser/presentation_service_delegate.h |
| @@ -19,6 +19,10 @@ namespace content { |
| class PresentationScreenAvailabilityListener; |
| +using PresentationSessionStartedCallback = |
| + base::Callback<void(const PresentationSessionInfo&)>; |
| +using PresentationSessionErrorCallback = |
| + base::Callback<void(const PresentationError&)>; |
| using SessionStateChangedCallback = |
| base::Callback<void(const PresentationSessionInfo&, |
| PresentationSessionState)>; |
| @@ -39,21 +43,10 @@ class CONTENT_EXPORT PresentationServiceDelegate { |
| // Called when the PresentationServiceDelegate is being destroyed. |
| virtual void OnDelegateDestroyed() = 0; |
| - // Called when the default presentation has been started outside of a |
| - // Presentation API context (e.g., browser action). This will not be called |
| - // if the session was created as a result of Presentation API's |
| - // StartSession()/JoinSession(). |
| - virtual void OnDefaultPresentationStarted( |
| - const PresentationSessionInfo& session) = 0; |
| - |
| protected: |
| virtual ~Observer() {} |
| }; |
| - using PresentationSessionSuccessCallback = |
| - base::Callback<void(const PresentationSessionInfo&)>; |
| - using PresentationSessionErrorCallback = |
| - base::Callback<void(const PresentationError&)>; |
| using SendMessageCallback = base::Callback<void(bool)>; |
| virtual ~PresentationServiceDelegate() {} |
| @@ -101,13 +94,16 @@ class CONTENT_EXPORT PresentationServiceDelegate { |
| int render_frame_id) = 0; |
| // Sets the default presentation URL for frame given by |render_process_id| |
| - // and |render_frame_id|. |
| + // and |render_frame_id|. When the default presentation is started on this |
| + // frame, |callback| will be invoked with the corresponding |
| + // PresentationSessionInfo object. |
| // If |default_presentation_url| is empty, the default presentation URL will |
| - // be cleared. |
| + // be cleared and the previously registered callback (if any) will be removed. |
| virtual void SetDefaultPresentationUrl( |
| int render_process_id, |
| int render_frame_id, |
| - const std::string& default_presentation_url) = 0; |
| + const std::string& default_presentation_url, |
| + const PresentationSessionStartedCallback& callback) = 0; |
|
mark a. foltz
2015/10/20 20:15:25
success_cb for consistency?
imcheng
2015/10/24 00:41:19
Since there's no error_cb, I don't think we should
|
| // Starts a new presentation session. The presentation id of the session will |
| // be the default presentation ID if any or a generated one otherwise. |
| @@ -123,7 +119,7 @@ class CONTENT_EXPORT PresentationServiceDelegate { |
| int render_process_id, |
| int render_frame_id, |
| const std::string& presentation_url, |
| - const PresentationSessionSuccessCallback& success_cb, |
| + const PresentationSessionStartedCallback& success_cb, |
| const PresentationSessionErrorCallback& error_cb) = 0; |
| // Joins an existing presentation session. Unlike StartSession(), this |
| @@ -139,7 +135,7 @@ class CONTENT_EXPORT PresentationServiceDelegate { |
| int render_frame_id, |
| const std::string& presentation_url, |
| const std::string& presentation_id, |
| - const PresentationSessionSuccessCallback& success_cb, |
| + const PresentationSessionStartedCallback& success_cb, |
| const PresentationSessionErrorCallback& error_cb) = 0; |
| // Close an existing presentation session. |