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 "base/callback.h" | 8 #include "base/callback.h" |
9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
| 10 //#include "content/common/presentation/presentation_message.h" |
10 #include "content/public/browser/presentation_session.h" | 11 #include "content/public/browser/presentation_session.h" |
11 | 12 |
12 namespace content { | 13 namespace content { |
13 | 14 |
14 class PresentationScreenAvailabilityListener; | 15 class PresentationScreenAvailabilityListener; |
15 | 16 |
16 // An interface implemented by embedders to handle presentation API calls | 17 // An interface implemented by embedders to handle presentation API calls |
17 // forwarded from PresentationServiceImpl. | 18 // forwarded from PresentationServiceImpl. |
18 class CONTENT_EXPORT PresentationServiceDelegate { | 19 class CONTENT_EXPORT PresentationServiceDelegate { |
19 public: | 20 public: |
20 // Observer interface to listen for changes to PresentationServiceDelegate. | 21 // Observer interface to listen for changes to PresentationServiceDelegate. |
21 class CONTENT_EXPORT Observer { | 22 class CONTENT_EXPORT Observer { |
22 public: | 23 public: |
23 // Called when the PresentationServiceDelegate is being destroyed. | 24 // Called when the PresentationServiceDelegate is being destroyed. |
24 virtual void OnDelegateDestroyed() = 0; | 25 virtual void OnDelegateDestroyed() = 0; |
25 | 26 |
26 protected: | 27 protected: |
27 virtual ~Observer() {} | 28 virtual ~Observer() {} |
28 }; | 29 }; |
29 | 30 |
30 using PresentationSessionSuccessCallback = | 31 using PresentationSessionSuccessCallback = |
31 base::Callback<void(const PresentationSessionInfo&)>; | 32 base::Callback<void(const PresentationSessionInfo&)>; |
32 using PresentationSessionErrorCallback = | 33 using PresentationSessionErrorCallback = |
33 base::Callback<void(const PresentationError&)>; | 34 base::Callback<void(const PresentationError&)>; |
| 35 using SendMessageCallback = base::Callback<void()>; |
34 | 36 |
35 virtual ~PresentationServiceDelegate() {} | 37 virtual ~PresentationServiceDelegate() {} |
36 | 38 |
37 // Registers an observer with this class to listen for updates to this class. | 39 // Registers an observer with this class to listen for updates to this class. |
38 // This class does not own the observer. | 40 // This class does not own the observer. |
39 // It is an error to add an observer if it has already been added before. | 41 // It is an error to add an observer if it has already been added before. |
40 virtual void AddObserver(Observer* observer) = 0; | 42 virtual void AddObserver(Observer* observer) = 0; |
41 // Unregisters an observer with this class. | 43 // Unregisters an observer with this class. |
42 virtual void RemoveObserver(Observer* observer) = 0; | 44 virtual void RemoveObserver(Observer* observer) = 0; |
43 | 45 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // |success_cb|: Invoked with session info, if presentation session joined | 110 // |success_cb|: Invoked with session info, if presentation session joined |
109 // successfully. | 111 // successfully. |
110 // |error_cb|: Invoked with error reason, if joining failed. | 112 // |error_cb|: Invoked with error reason, if joining failed. |
111 virtual void JoinSession( | 113 virtual void JoinSession( |
112 int render_process_id, | 114 int render_process_id, |
113 int render_frame_id, | 115 int render_frame_id, |
114 const std::string& presentation_url, | 116 const std::string& presentation_url, |
115 const std::string& presentation_id, | 117 const std::string& presentation_id, |
116 const PresentationSessionSuccessCallback& success_cb, | 118 const PresentationSessionSuccessCallback& success_cb, |
117 const PresentationSessionErrorCallback& error_cb) = 0; | 119 const PresentationSessionErrorCallback& error_cb) = 0; |
| 120 |
| 121 // Sends a message (string or binary data) to a presentation session. |
| 122 // |render_process_id|, |render_frame_id|: ID of originating frame. |
| 123 // |message_request|: Contains Presentation URL, ID and message to be sent. |
| 124 // TODO(s.singapati): Need to move presentation_message.h |
| 125 /* |
| 126 virtual void SendMessage( |
| 127 int render_process_id, |
| 128 int render_frame_id, |
| 129 MessageRequest* message_request) = 0; |
| 130 */ |
118 }; | 131 }; |
119 | 132 |
120 } // namespace content | 133 } // namespace content |
121 | 134 |
122 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ | 135 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ |
OLD | NEW |