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

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

Issue 1131053005: [Presentation API] Convert screen availability API into Client style. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 "content/common/content_export.h" 9 #include "content/common/content_export.h"
10 #include "content/common/presentation/presentation_service.mojom.h" 10 #include "content/common/presentation/presentation_service.mojom.h"
11 #include "content/public/renderer/render_frame_observer.h" 11 #include "content/public/renderer/render_frame_observer.h"
12 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nClient.h" 12 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nClient.h"
13 13
14 namespace blink { 14 namespace blink {
15 class WebString; 15 class WebString;
16 } // namespace blink 16 } // namespace blink
17 17
18 namespace content { 18 namespace content {
19 19
20 // PresentationDispatcher is a delegate for Presentation API messages used by 20 // PresentationDispatcher is a delegate for Presentation API messages used by
21 // Blink. It forwards the calls to the Mojo PresentationService. 21 // Blink. It forwards the calls to the Mojo PresentationService.
22 class CONTENT_EXPORT PresentationDispatcher 22 class CONTENT_EXPORT PresentationDispatcher
23 : public RenderFrameObserver, 23 : public RenderFrameObserver,
24 public NON_EXPORTED_BASE(blink::WebPresentationClient) { 24 public NON_EXPORTED_BASE(blink::WebPresentationClient),
25 public NON_EXPORTED_BASE(presentation::PresentationServiceClient) {
25 public: 26 public:
26 explicit PresentationDispatcher(RenderFrame* render_frame); 27 explicit PresentationDispatcher(RenderFrame* render_frame);
27 ~PresentationDispatcher() override; 28 ~PresentationDispatcher() override;
28 29
29 private:
30 // WebPresentationClient implementation. 30 // WebPresentationClient implementation.
31 virtual void setController( 31 virtual void setController(
32 blink::WebPresentationController* controller); 32 blink::WebPresentationController* controller);
33 virtual void updateAvailableChangeWatched(bool watched); 33 virtual void updateAvailableChangeWatched(bool watched);
34 virtual void startSession( 34 virtual void startSession(
35 const blink::WebString& presentationUrl, 35 const blink::WebString& presentationUrl,
36 const blink::WebString& presentationId, 36 const blink::WebString& presentationId,
37 blink::WebPresentationSessionClientCallbacks* callback); 37 blink::WebPresentationSessionClientCallbacks* callback);
38 virtual void joinSession( 38 virtual void joinSession(
39 const blink::WebString& presentationUrl, 39 const blink::WebString& presentationUrl,
40 const blink::WebString& presentationId, 40 const blink::WebString& presentationId,
41 blink::WebPresentationSessionClientCallbacks* callback); 41 blink::WebPresentationSessionClientCallbacks* callback);
42 virtual void closeSession( 42 virtual void closeSession(
43 const blink::WebString& presentationUrl, 43 const blink::WebString& presentationUrl,
44 const blink::WebString& presentationId); 44 const blink::WebString& presentationId);
45 45
46 private:
mark a. foltz 2015/05/09 07:01:32 Why does the WebPresentationClient implementation
imcheng (use chromium acct) 2015/05/11 22:01:54 Reverted placement of private: label. My bad.
46 // RenderFrameObserver 47 // RenderFrameObserver
47 void DidChangeDefaultPresentation() override; 48 void DidChangeDefaultPresentation() override;
48 49
49 void OnScreenAvailabilityChanged( 50 // presentation::PresentationServiceClient
50 const std::string& presentation_url, 51 void OnScreenAvailabilityUpdated(bool available) override;
51 bool available); 52
52 void OnSessionCreated( 53 void OnSessionCreated(
53 blink::WebPresentationSessionClientCallbacks* callback, 54 blink::WebPresentationSessionClientCallbacks* callback,
54 presentation::PresentationSessionInfoPtr session_info, 55 presentation::PresentationSessionInfoPtr session_info,
55 presentation::PresentationErrorPtr error); 56 presentation::PresentationErrorPtr error);
56 void OnDefaultSessionStarted( 57 void OnDefaultSessionStarted(
57 presentation::PresentationSessionInfoPtr session_info); 58 presentation::PresentationSessionInfoPtr session_info);
58 void OnSessionStateChange( 59 void OnSessionStateChange(
59 presentation::PresentationSessionInfoPtr session_info, 60 presentation::PresentationSessionInfoPtr session_info,
60 presentation::PresentationSessionState session_state); 61 presentation::PresentationSessionState session_state);
61 void OnSessionMessagesReceived( 62 void OnSessionMessagesReceived(
62 mojo::Array<presentation::SessionMessagePtr> messages); 63 mojo::Array<presentation::SessionMessagePtr> messages);
63 64
64 void ConnectToPresentationServiceIfNeeded(); 65 void ConnectToPresentationServiceIfNeeded();
65 66
66 void DoUpdateAvailableChangeWatched(
67 const std::string& presentation_url,
68 bool watched);
69
70 // Used as a weak reference. Can be null since lifetime is bound to the frame. 67 // Used as a weak reference. Can be null since lifetime is bound to the frame.
71 blink::WebPresentationController* controller_; 68 blink::WebPresentationController* controller_;
72 presentation::PresentationServicePtr presentation_service_; 69 presentation::PresentationServicePtr presentation_service_;
70 mojo::Binding<presentation::PresentationServiceClient> binding_;
73 }; 71 };
74 72
75 } // namespace content 73 } // namespace content
76 74
77 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ 75 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698