| 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_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
| 14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 15 #include "content/public/browser/presentation_session.h" | 15 #include "content/public/browser/presentation_session.h" |
| 16 #include "content/public/browser/presentation_session_message.h" | 16 #include "content/public/browser/presentation_session_message.h" |
| 17 | 17 |
| 18 class GURL; |
| 19 |
| 18 namespace content { | 20 namespace content { |
| 19 | 21 |
| 20 class PresentationScreenAvailabilityListener; | 22 class PresentationScreenAvailabilityListener; |
| 21 | 23 |
| 22 using PresentationSessionStartedCallback = | 24 using PresentationSessionStartedCallback = |
| 23 base::Callback<void(const PresentationSessionInfo&)>; | 25 base::Callback<void(const PresentationSessionInfo&)>; |
| 24 using PresentationSessionErrorCallback = | 26 using PresentationSessionErrorCallback = |
| 25 base::Callback<void(const PresentationError&)>; | 27 base::Callback<void(const PresentationError&)>; |
| 26 | 28 |
| 27 // Param #0: a vector of messages that are received. | 29 // Param #0: a vector of messages that are received. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 virtual void Reset( | 108 virtual void Reset( |
| 107 int render_process_id, | 109 int render_process_id, |
| 108 int render_frame_id) = 0; | 110 int render_frame_id) = 0; |
| 109 | 111 |
| 110 // Sets the default presentation URLs for frame given by |render_process_id| | 112 // Sets the default presentation URLs for frame given by |render_process_id| |
| 111 // and |render_frame_id|. When the default presentation is started on this | 113 // and |render_frame_id|. When the default presentation is started on this |
| 112 // frame, |callback| will be invoked with the corresponding | 114 // frame, |callback| will be invoked with the corresponding |
| 113 // PresentationSessionInfo object. | 115 // PresentationSessionInfo object. |
| 114 // If |default_presentation_urls| is empty, the default presentation URLs will | 116 // If |default_presentation_urls| is empty, the default presentation URLs will |
| 115 // be cleared and the previously registered callback (if any) will be removed. | 117 // be cleared and the previously registered callback (if any) will be removed. |
| 116 // TODO(crbug.com/632623): Use GURL instead of std::string for URLs | |
| 117 virtual void SetDefaultPresentationUrls( | 118 virtual void SetDefaultPresentationUrls( |
| 118 int render_process_id, | 119 int render_process_id, |
| 119 int render_frame_id, | 120 int render_frame_id, |
| 120 const std::vector<std::string>& default_presentation_urls, | 121 const std::vector<GURL>& default_presentation_urls, |
| 121 const PresentationSessionStartedCallback& callback) = 0; | 122 const PresentationSessionStartedCallback& callback) = 0; |
| 122 | 123 |
| 123 // Starts a new presentation session. The presentation id of the session will | 124 // Starts a new presentation session. The presentation id of the session will |
| 124 // be the default presentation ID if any or a generated one otherwise. | 125 // be the default presentation ID if any or a generated one otherwise. |
| 125 // Typically, the embedder will allow the user to select a screen to show | 126 // Typically, the embedder will allow the user to select a screen to show |
| 126 // one of the |presentation_urls|. | 127 // one of the |presentation_urls|. |
| 127 // |render_process_id|, |render_frame_id|: ID of originating frame. | 128 // |render_process_id|, |render_frame_id|: ID of originating frame. |
| 128 // |presentation_urls|: Possible URLs for the presentation. | 129 // |presentation_urls|: Possible URLs for the presentation. |
| 129 // |success_cb|: Invoked with session info, if presentation session started | 130 // |success_cb|: Invoked with session info, if presentation session started |
| 130 // successfully. | 131 // successfully. |
| 131 // |error_cb|: Invoked with error reason, if presentation session did not | 132 // |error_cb|: Invoked with error reason, if presentation session did not |
| 132 // start. | 133 // start. |
| 133 // TODO(crbug.com/632623): Use GURL instead of std::string for URLs | |
| 134 virtual void StartSession( | 134 virtual void StartSession( |
| 135 int render_process_id, | 135 int render_process_id, |
| 136 int render_frame_id, | 136 int render_frame_id, |
| 137 const std::vector<std::string>& presentation_urls, | 137 const std::vector<GURL>& presentation_urls, |
| 138 const PresentationSessionStartedCallback& success_cb, | 138 const PresentationSessionStartedCallback& success_cb, |
| 139 const PresentationSessionErrorCallback& error_cb) = 0; | 139 const PresentationSessionErrorCallback& error_cb) = 0; |
| 140 | 140 |
| 141 // Joins an existing presentation session. Unlike StartSession(), this | 141 // Joins an existing presentation session. Unlike StartSession(), this |
| 142 // does not bring a screen list UI. | 142 // does not bring a screen list UI. |
| 143 // |render_process_id|, |render_frame_id|: ID for originating frame. | 143 // |render_process_id|, |render_frame_id|: ID for originating frame. |
| 144 // |presentation_urls|: Possible URLs of the presentation. | 144 // |presentation_urls|: Possible URLs of the presentation. |
| 145 // |presentation_id|: The ID of the presentation to join. | 145 // |presentation_id|: The ID of the presentation to join. |
| 146 // |success_cb|: Invoked with session info, if presentation session joined | 146 // |success_cb|: Invoked with session info, if presentation session joined |
| 147 // successfully. | 147 // successfully. |
| 148 // |error_cb|: Invoked with error reason, if joining failed. | 148 // |error_cb|: Invoked with error reason, if joining failed. |
| 149 // TODO(crbug.com/632623): Use GURL instead of std::string for URLs | |
| 150 virtual void JoinSession( | 149 virtual void JoinSession( |
| 151 int render_process_id, | 150 int render_process_id, |
| 152 int render_frame_id, | 151 int render_frame_id, |
| 153 const std::vector<std::string>& presentation_urls, | 152 const std::vector<GURL>& presentation_urls, |
| 154 const std::string& presentation_id, | 153 const std::string& presentation_id, |
| 155 const PresentationSessionStartedCallback& success_cb, | 154 const PresentationSessionStartedCallback& success_cb, |
| 156 const PresentationSessionErrorCallback& error_cb) = 0; | 155 const PresentationSessionErrorCallback& error_cb) = 0; |
| 157 | 156 |
| 158 // Closes an existing presentation connection. | 157 // Closes an existing presentation connection. |
| 159 // |render_process_id|, |render_frame_id|: ID for originating frame. | 158 // |render_process_id|, |render_frame_id|: ID for originating frame. |
| 160 // |presentation_id|: The ID of the presentation to close. | 159 // |presentation_id|: The ID of the presentation to close. |
| 161 virtual void CloseConnection(int render_process_id, | 160 virtual void CloseConnection(int render_process_id, |
| 162 int render_frame_id, | 161 int render_frame_id, |
| 163 const std::string& presentation_id) = 0; | 162 const std::string& presentation_id) = 0; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 virtual void ListenForConnectionStateChange( | 200 virtual void ListenForConnectionStateChange( |
| 202 int render_process_id, | 201 int render_process_id, |
| 203 int render_frame_id, | 202 int render_frame_id, |
| 204 const PresentationSessionInfo& connection, | 203 const PresentationSessionInfo& connection, |
| 205 const PresentationConnectionStateChangedCallback& state_changed_cb) = 0; | 204 const PresentationConnectionStateChangedCallback& state_changed_cb) = 0; |
| 206 }; | 205 }; |
| 207 | 206 |
| 208 } // namespace content | 207 } // namespace content |
| 209 | 208 |
| 210 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ | 209 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ |
| OLD | NEW |