third_party/re2: Remove remove-static-initializers.patch.
[chromium-blink-merge.git] / content / renderer / presentation / presentation_dispatcher.h
blobfb6b4d9a83b02147194dd362b33dc6e1ef65fec0
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_
6 #define CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_
8 #include "base/compiler_specific.h"
9 #include "content/common/content_export.h"
10 #include "content/common/presentation/presentation_service.mojom.h"
11 #include "content/public/renderer/render_frame_observer.h"
12 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentationClient.h"
14 namespace blink {
15 class WebString;
16 } // namespace blink
18 namespace content {
20 // PresentationDispatcher is a delegate for Presentation API messages used by
21 // Blink. It forwards the calls to the Mojo PresentationService.
22 class CONTENT_EXPORT PresentationDispatcher
23 : public RenderFrameObserver,
24 public NON_EXPORTED_BASE(blink::WebPresentationClient) {
25 public:
26 explicit PresentationDispatcher(RenderFrame* render_frame);
27 ~PresentationDispatcher() override;
29 private:
30 // WebPresentationClient implementation.
31 virtual void setController(
32 blink::WebPresentationController* controller);
33 virtual void updateAvailableChangeWatched(bool watched);
34 virtual void startSession(
35 const blink::WebString& presentationUrl,
36 const blink::WebString& presentationId,
37 blink::WebPresentationSessionClientCallbacks* callback);
38 virtual void joinSession(
39 const blink::WebString& presentationUrl,
40 const blink::WebString& presentationId,
41 blink::WebPresentationSessionClientCallbacks* callback);
42 virtual void closeSession(
43 const blink::WebString& presentationUrl,
44 const blink::WebString& presentationId);
46 // RenderFrameObserver
47 void DidChangeDefaultPresentation() override;
49 void OnScreenAvailabilityChanged(
50 const std::string& presentation_url,
51 bool available);
52 void OnSessionCreated(
53 blink::WebPresentationSessionClientCallbacks* callback,
54 presentation::PresentationSessionInfoPtr session_info,
55 presentation::PresentationErrorPtr error);
56 void OnDefaultSessionStarted(
57 presentation::PresentationSessionInfoPtr session_info);
58 void OnSessionStateChange(
59 presentation::PresentationSessionInfoPtr session_info,
60 presentation::PresentationSessionState session_state);
62 void ConnectToPresentationServiceIfNeeded();
64 void DoUpdateAvailableChangeWatched(
65 const std::string& presentation_url,
66 bool watched);
68 // Used as a weak reference. Can be null since lifetime is bound to the frame.
69 blink::WebPresentationController* controller_;
70 presentation::PresentationServicePtr presentation_service_;
73 } // namespace content
75 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_