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

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

Issue 935083002: [PresentationAPI] Implementing start/joinSession from WebPresentationClient to PresentationService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 <vector>
9
8 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/memory/linked_ptr.h"
9 #include "content/common/content_export.h" 12 #include "content/common/content_export.h"
10 #include "content/common/presentation/presentation_service.mojom.h" 13 #include "content/common/presentation/presentation_service.mojom.h"
11 #include "content/public/renderer/render_frame_observer.h" 14 #include "content/public/renderer/render_frame_observer.h"
15 #include "content/renderer/presentation/presentation_session_dispatcher.h"
12 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nClient.h" 16 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nClient.h"
13 17
14 namespace content { 18 namespace content {
15 19
16 // PresentationDispatcher is a delegate for Presentation API messages used by 20 // PresentationDispatcher is a delegate for Presentation API messages used by
17 // Blink. It forwards the calls to the Mojo PresentationService. 21 // Blink. It forwards the calls to the Mojo PresentationService.
18 class CONTENT_EXPORT PresentationDispatcher 22 class CONTENT_EXPORT PresentationDispatcher
19 : public RenderFrameObserver, 23 : public RenderFrameObserver,
20 public NON_EXPORTED_BASE(blink::WebPresentationClient) { 24 public NON_EXPORTED_BASE(blink::WebPresentationClient) {
21 public: 25 public:
22 explicit PresentationDispatcher(RenderFrame* render_frame); 26 explicit PresentationDispatcher(RenderFrame* render_frame);
23 ~PresentationDispatcher() override; 27 ~PresentationDispatcher() override;
24 28
25 private: 29 private:
26 // WebPresentationClient implementation. 30 // WebPresentationClient implementation.
27 virtual void setController( 31 virtual void setController(
28 blink::WebPresentationController* controller); 32 blink::WebPresentationController* controller);
29 virtual void updateAvailableChangeWatched(bool watched); 33 virtual void updateAvailableChangeWatched(bool watched);
34 virtual void startSession(
35 const blink::WebString& presentationUrl,
36 const blink::WebString& presentationId,
37 blink::WebPresentationSessionCreateCallback* callback);
38 virtual void joinSession(
39 const blink::WebString& presentationUrl,
40 const blink::WebString& presentationId,
41 blink::WebPresentationSessionCreateCallback* callback);
30 42
31 void OnScreenAvailabilityChanged(bool available); 43 void OnScreenAvailabilityChanged(bool available);
44 void OnSessionCreated(
45 blink::WebPresentationSessionCreateCallback* callback,
46 bool success,
47 mojo::InterfaceRequest<presentation::PresentationSession> session_request,
blundell 2015/02/18 15:35:16 Why is this called session_request? The idea is th
whywhat 2015/02/19 16:32:22 I misunderstood the concept of passing a Object?&
48 const mojo::String& url,
49 const mojo::String& id,
50 const mojo::String& error);
32 51
33 void ConnectToPresentationServiceIfNeeded(); 52 void ConnectToPresentationServiceIfNeeded();
34 53
35 // Used as a weak reference. Can be null since lifetime is bound to the frame. 54 // Used as a weak reference. Can be null since lifetime is bound to the frame.
36 blink::WebPresentationController* controller_; 55 blink::WebPresentationController* controller_;
37 presentation::PresentationServicePtr presentation_service_; 56 presentation::PresentationServicePtr presentation_service_;
57
58 // Wrappers around the PresentationSessionPtr corresponding to each Javascript
59 // PresentationSession object passed back to the frame.
60 typedef std::vector<linked_ptr<PresentationSessionDispatcher>>
blundell 2015/02/18 15:35:16 Why linked_ptr?
whywhat 2015/02/19 16:32:22 Forgot about the existence of ScopedPtr I guess.
61 PresentationSessions;
62 PresentationSessions presentation_sessions_;
38 }; 63 };
39 64
40 } // namespace content 65 } // namespace content
41 66
42 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ 67 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698