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

Side by Side Diff: content/renderer/presentation/presentation_dispatcher.h

Issue 1037483003: [PresentationAPI] Implementing send() from WebPresentationClient to the PresentationService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: No (c) in new files Copyright message. Created 5 years, 7 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 unified diff | Download patch
OLDNEW
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 "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/linked_ptr.h"
9 #include "content/common/content_export.h" 10 #include "content/common/content_export.h"
10 #include "content/common/presentation/presentation_service.mojom.h" 11 #include "content/common/presentation/presentation_service.mojom.h"
11 #include "content/public/renderer/render_frame_observer.h" 12 #include "content/public/renderer/render_frame_observer.h"
12 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nClient.h" 13 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nClient.h"
13 14
14 namespace blink { 15 namespace blink {
15 class WebString; 16 class WebString;
16 } // namespace blink 17 } // namespace blink
17 18
18 namespace content { 19 namespace content {
(...skipping 13 matching lines...) Expand all
32 blink::WebPresentationController* controller); 33 blink::WebPresentationController* controller);
33 virtual void updateAvailableChangeWatched(bool watched); 34 virtual void updateAvailableChangeWatched(bool watched);
34 virtual void startSession( 35 virtual void startSession(
35 const blink::WebString& presentationUrl, 36 const blink::WebString& presentationUrl,
36 const blink::WebString& presentationId, 37 const blink::WebString& presentationId,
37 blink::WebPresentationSessionClientCallbacks* callback); 38 blink::WebPresentationSessionClientCallbacks* callback);
38 virtual void joinSession( 39 virtual void joinSession(
39 const blink::WebString& presentationUrl, 40 const blink::WebString& presentationUrl,
40 const blink::WebString& presentationId, 41 const blink::WebString& presentationId,
41 blink::WebPresentationSessionClientCallbacks* callback); 42 blink::WebPresentationSessionClientCallbacks* callback);
43 virtual void sendString(
44 const blink::WebString& presentationUrl,
45 const blink::WebString& presentationId,
46 const blink::WebString& message);
47 virtual void sendArrayBuffer(
48 const blink::WebString& presentationUrl,
49 const blink::WebString& presentationId,
50 const uint8* data,
51 size_t length);
42 virtual void closeSession( 52 virtual void closeSession(
43 const blink::WebString& presentationUrl, 53 const blink::WebString& presentationUrl,
44 const blink::WebString& presentationId); 54 const blink::WebString& presentationId);
45 55
46 // RenderFrameObserver 56 // RenderFrameObserver implementation.
47 void DidChangeDefaultPresentation() override; 57 void DidChangeDefaultPresentation() override;
58 void DidCommitProvisionalLoad(
59 bool is_new_navigation,
60 bool is_same_page_navigation) override;
48 61
49 void OnScreenAvailabilityChanged( 62 void OnScreenAvailabilityChanged(
50 const std::string& presentation_url, 63 const std::string& presentation_url,
51 bool available); 64 bool available);
52 void OnSessionCreated( 65 void OnSessionCreated(
53 blink::WebPresentationSessionClientCallbacks* callback, 66 blink::WebPresentationSessionClientCallbacks* callback,
54 presentation::PresentationSessionInfoPtr session_info, 67 presentation::PresentationSessionInfoPtr session_info,
55 presentation::PresentationErrorPtr error); 68 presentation::PresentationErrorPtr error);
56 void OnDefaultSessionStarted( 69 void OnDefaultSessionStarted(
57 presentation::PresentationSessionInfoPtr session_info); 70 presentation::PresentationSessionInfoPtr session_info);
58 void OnSessionStateChange( 71 void OnSessionStateChange(
59 presentation::PresentationSessionInfoPtr session_info, 72 presentation::PresentationSessionInfoPtr session_info,
60 presentation::PresentationSessionState session_state); 73 presentation::PresentationSessionState session_state);
61 void OnSessionMessagesReceived( 74 void OnSessionMessagesReceived(
62 mojo::Array<presentation::SessionMessagePtr> messages); 75 mojo::Array<presentation::SessionMessagePtr> messages);
63 76
64 void ConnectToPresentationServiceIfNeeded(); 77 void ConnectToPresentationServiceIfNeeded();
65 78
66 void DoUpdateAvailableChangeWatched( 79 void DoUpdateAvailableChangeWatched(
67 const std::string& presentation_url, 80 const std::string& presentation_url,
68 bool watched); 81 bool watched);
69 82
83 void DoSendMessage(const presentation::SessionMessage& session_message);
84 void HandleSendMessageRequests(bool success);
85
70 // Used as a weak reference. Can be null since lifetime is bound to the frame. 86 // Used as a weak reference. Can be null since lifetime is bound to the frame.
71 blink::WebPresentationController* controller_; 87 blink::WebPresentationController* controller_;
72 presentation::PresentationServicePtr presentation_service_; 88 presentation::PresentationServicePtr presentation_service_;
89
90 // Message requests are queued here and only one message at a time is sent
91 // over mojo channel.
92 using MessageRequestQueue =
93 std::queue<linked_ptr<presentation::SessionMessage>>;
94 MessageRequestQueue message_request_queue_;
73 }; 95 };
74 96
75 } // namespace content 97 } // namespace content
76 98
77 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ 99 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_
OLDNEW
« no previous file with comments | « content/public/common/presentation_constants.cc ('k') | content/renderer/presentation/presentation_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698