Chromium Code Reviews| 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_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ | 5 #ifndef CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ |
| 6 #define CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ | 6 #define CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <memory> | 12 #include <memory> |
| 13 #include <queue> | 13 #include <queue> |
| 14 #include <set> | 14 #include <set> |
| 15 #include <string> | 15 #include <string> |
| 16 #include <vector> | 16 #include <vector> |
| 17 | 17 |
| 18 #include "base/compiler_specific.h" | 18 #include "base/compiler_specific.h" |
| 19 #include "base/id_map.h" | 19 #include "base/id_map.h" |
| 20 #include "base/macros.h" | 20 #include "base/macros.h" |
| 21 #include "content/common/content_export.h" | 21 #include "content/common/content_export.h" |
| 22 #include "content/public/common/presentation_session.h" | |
| 22 #include "content/public/renderer/render_frame_observer.h" | 23 #include "content/public/renderer/render_frame_observer.h" |
| 23 #include "mojo/public/cpp/bindings/binding.h" | 24 #include "mojo/public/cpp/bindings/binding.h" |
| 24 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nClient.h" | 25 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nClient.h" |
| 25 #include "third_party/WebKit/public/platform/modules/presentation/presentation.m ojom.h" | 26 #include "third_party/WebKit/public/platform/modules/presentation/presentation.m ojom.h" |
| 26 #include "url/gurl.h" | 27 #include "url/gurl.h" |
| 27 | 28 |
| 28 namespace blink { | 29 namespace blink { |
| 29 class WebPresentationAvailabilityObserver; | 30 class WebPresentationAvailabilityObserver; |
| 30 class WebPresentationReceiver; | 31 class WebPresentationReceiver; |
| 31 class WebString; | 32 class WebString; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 58 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestSendArrayBuffer); | 59 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestSendArrayBuffer); |
| 59 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestSendBlobData); | 60 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestSendBlobData); |
| 60 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestCloseSession); | 61 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestCloseSession); |
| 61 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestTerminateSession); | 62 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestTerminateSession); |
| 62 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, | 63 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, |
| 63 TestListenForScreenAvailability); | 64 TestListenForScreenAvailability); |
| 64 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, | 65 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, |
| 65 TestSetDefaultPresentationUrls); | 66 TestSetDefaultPresentationUrls); |
| 66 | 67 |
| 67 struct SendMessageRequest { | 68 struct SendMessageRequest { |
| 68 SendMessageRequest(blink::mojom::PresentationSessionInfoPtr session_info, | 69 SendMessageRequest(const PresentationSessionInfo& session_info, |
| 69 blink::mojom::ConnectionMessagePtr message); | 70 blink::mojom::ConnectionMessagePtr message); |
| 70 ~SendMessageRequest(); | 71 ~SendMessageRequest(); |
| 71 | 72 |
| 72 blink::mojom::PresentationSessionInfoPtr session_info; | 73 PresentationSessionInfo session_info; |
| 73 blink::mojom::ConnectionMessagePtr message; | 74 blink::mojom::ConnectionMessagePtr message; |
| 74 }; | 75 }; |
| 75 | 76 |
| 76 static SendMessageRequest* CreateSendTextMessageRequest( | 77 static SendMessageRequest* CreateSendTextMessageRequest( |
| 77 const blink::WebURL& presentationUrl, | 78 const blink::WebURL& presentationUrl, |
| 78 const blink::WebString& presentationId, | 79 const blink::WebString& presentationId, |
| 79 const blink::WebString& message); | 80 const blink::WebString& message); |
| 80 static SendMessageRequest* CreateSendBinaryMessageRequest( | 81 static SendMessageRequest* CreateSendBinaryMessageRequest( |
| 81 const blink::WebURL& presentationUrl, | 82 const blink::WebURL& presentationUrl, |
| 82 const blink::WebString& presentationId, | 83 const blink::WebString& presentationId, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 | 122 |
| 122 // RenderFrameObserver implementation. | 123 // RenderFrameObserver implementation. |
| 123 void DidCommitProvisionalLoad( | 124 void DidCommitProvisionalLoad( |
| 124 bool is_new_navigation, | 125 bool is_new_navigation, |
| 125 bool is_same_page_navigation) override; | 126 bool is_same_page_navigation) override; |
| 126 void OnDestruct() override; | 127 void OnDestruct() override; |
| 127 | 128 |
| 128 // blink::mojom::PresentationServiceClient | 129 // blink::mojom::PresentationServiceClient |
| 129 void OnScreenAvailabilityNotSupported(const GURL& url) override; | 130 void OnScreenAvailabilityNotSupported(const GURL& url) override; |
| 130 void OnScreenAvailabilityUpdated(const GURL& url, bool available) override; | 131 void OnScreenAvailabilityUpdated(const GURL& url, bool available) override; |
| 131 void OnConnectionStateChanged( | 132 void OnConnectionStateChanged(const PresentationSessionInfo& session_info, |
| 132 blink::mojom::PresentationSessionInfoPtr session_info, | 133 PresentationConnectionState state) override; |
| 133 blink::mojom::PresentationConnectionState state) override; | 134 void OnConnectionClosed(const PresentationSessionInfo& session_info, |
| 134 void OnConnectionClosed( | 135 PresentationConnectionCloseReason reason, |
| 135 blink::mojom::PresentationSessionInfoPtr session_info, | 136 const std::string& message) override; |
| 136 blink::mojom::PresentationConnectionCloseReason reason, | |
| 137 const std::string& message) override; | |
| 138 void OnConnectionMessagesReceived( | 137 void OnConnectionMessagesReceived( |
| 139 blink::mojom::PresentationSessionInfoPtr session_info, | 138 const PresentationSessionInfo& session_info, |
| 140 std::vector<blink::mojom::ConnectionMessagePtr> messages) override; | 139 std::vector<blink::mojom::ConnectionMessagePtr> messages) override; |
| 141 void OnDefaultSessionStarted( | 140 void OnDefaultSessionStarted( |
| 142 blink::mojom::PresentationSessionInfoPtr session_info) override; | 141 const PresentationSessionInfo& session_info) override; |
| 143 | 142 |
| 144 void OnSessionCreated( | 143 void OnSessionCreated( |
| 145 std::unique_ptr<blink::WebPresentationConnectionCallback> callback, | 144 std::unique_ptr<blink::WebPresentationConnectionCallback> callback, |
| 146 blink::mojom::PresentationSessionInfoPtr session_info, | 145 const base::Optional<PresentationSessionInfo>& session_info, |
| 147 blink::mojom::PresentationErrorPtr error); | 146 const base::Optional<PresentationError>& error); |
| 148 void OnReceiverConnectionAvailable( | 147 void OnReceiverConnectionAvailable( |
| 149 blink::mojom::PresentationSessionInfoPtr, | 148 const PresentationSessionInfo& session_info, |
| 150 blink::mojom::PresentationConnectionPtr, | 149 blink::mojom::PresentationConnectionPtr, |
|
imcheng
2017/01/24 23:31:40
nit: add names for the parameters.
nasko
2017/01/25 17:58:16
I wouldn't call this a nit, according to Chromium
mark a. foltz
2017/01/27 22:41:08
They're unused and should be commented out per sty
| |
| 151 blink::mojom::PresentationConnectionRequest) override; | 150 blink::mojom::PresentationConnectionRequest) override; |
| 152 | 151 |
| 153 // Call to PresentationService to send the message in |request|. | 152 // Call to PresentationService to send the message in |request|. |
| 154 // |session_info| and |message| of |reuqest| will be consumed. | 153 // |session_info| and |message| of |reuqest| will be consumed. |
| 155 // |HandleSendMessageRequests| will be invoked after the send is attempted. | 154 // |HandleSendMessageRequests| will be invoked after the send is attempted. |
| 156 void DoSendMessage(SendMessageRequest* request); | 155 void DoSendMessage(SendMessageRequest* request); |
| 157 void HandleSendMessageRequests(bool success); | 156 void HandleSendMessageRequests(bool success); |
| 158 | 157 |
| 159 virtual void ConnectToPresentationServiceIfNeeded(); | 158 virtual void ConnectToPresentationServiceIfNeeded(); |
| 160 | 159 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 201 // Updates the listening state of availability for |status| and notifies the | 200 // Updates the listening state of availability for |status| and notifies the |
| 202 // client. | 201 // client. |
| 203 void UpdateListeningState(AvailabilityStatus* status); | 202 void UpdateListeningState(AvailabilityStatus* status); |
| 204 | 203 |
| 205 DISALLOW_COPY_AND_ASSIGN(PresentationDispatcher); | 204 DISALLOW_COPY_AND_ASSIGN(PresentationDispatcher); |
| 206 }; | 205 }; |
| 207 | 206 |
| 208 } // namespace content | 207 } // namespace content |
| 209 | 208 |
| 210 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ | 209 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ |
| OLD | NEW |