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

Side by Side Diff: content/public/browser/presentation_service_delegate.h

Issue 979413002: [Presentation API] Additional plumbing for PresentationServiceImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@REAL-NEW-MASTER
Patch Set: updated comments Created 5 years, 9 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_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_
6 #define CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ 6 #define CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_
7 7
8 #include "base/callback.h"
8 #include "content/common/content_export.h" 9 #include "content/common/content_export.h"
10 #include "content/public/browser/presentation_session.h"
9 11
10 namespace content { 12 namespace content {
11 13
12 class PresentationScreenAvailabilityListener; 14 class PresentationScreenAvailabilityListener;
13 15
14 // An interface implemented by embedders to handle presentation API calls 16 // An interface implemented by embedders to handle presentation API calls
15 // forwarded from PresentationServiceImpl. 17 // forwarded from PresentationServiceImpl.
16 class CONTENT_EXPORT PresentationServiceDelegate { 18 class CONTENT_EXPORT PresentationServiceDelegate {
17 public: 19 public:
18 // Observer interface to listen for changes to PresentationServiceDelegate. 20 // Observer interface to listen for changes to PresentationServiceDelegate.
19 class CONTENT_EXPORT Observer { 21 class CONTENT_EXPORT Observer {
20 public: 22 public:
21 // Called when the PresentationServiceDelegate is being destroyed. 23 // Called when the PresentationServiceDelegate is being destroyed.
22 virtual void OnDelegateDestroyed() = 0; 24 virtual void OnDelegateDestroyed() = 0;
23 25
24 protected: 26 protected:
25 virtual ~Observer() {} 27 virtual ~Observer() {}
26 }; 28 };
27 29
30 using PresentationSessionSuccessCallback =
31 base::Callback<void(const PresentationSessionInfo&)>;
32 using PresentationSessionErrorCallback =
33 base::Callback<void(const PresentationError&)>;
34
28 virtual ~PresentationServiceDelegate() {} 35 virtual ~PresentationServiceDelegate() {}
29 36
30 // Registers an observer with this class to listen for updates to this class. 37 // Registers an observer with this class to listen for updates to this class.
31 // This class does not own the observer. 38 // This class does not own the observer.
32 // It is an error to add an observer if it has already been added before. 39 // It is an error to add an observer if it has already been added before.
33 virtual void AddObserver(Observer* observer) = 0; 40 virtual void AddObserver(Observer* observer) = 0;
34 // Unregisters an observer with this class. 41 // Unregisters an observer with this class.
35 virtual void RemoveObserver(Observer* observer) = 0; 42 virtual void RemoveObserver(Observer* observer) = 0;
36 43
37 // Registers |listener| to continuously listen for 44 // Registers |listener| to continuously listen for
(...skipping 14 matching lines...) Expand all
52 virtual void RemoveScreenAvailabilityListener( 59 virtual void RemoveScreenAvailabilityListener(
53 int render_process_id, 60 int render_process_id,
54 int render_frame_id, 61 int render_frame_id,
55 PresentationScreenAvailabilityListener* listener) = 0; 62 PresentationScreenAvailabilityListener* listener) = 0;
56 63
57 // Unregisters all listeners associated with the frame given by 64 // Unregisters all listeners associated with the frame given by
58 // |render_process_id| and |render_frame_id|. 65 // |render_process_id| and |render_frame_id|.
59 virtual void RemoveAllScreenAvailabilityListeners( 66 virtual void RemoveAllScreenAvailabilityListeners(
60 int render_process_id, 67 int render_process_id,
61 int render_frame_id) = 0; 68 int render_frame_id) = 0;
69
70 // Sets the default presentation URL for frame given by |render_process_id|
71 // and |render_frame_id|.
72 // Pass in empty string to unset the default presentation URL.
73 virtual void SetDefaultPresentationUrl(
74 int render_process_id,
75 int render_frame_id,
76 const std::string& default_presentation_url) = 0;
77
78 // Starts a new presentation session.
79 // This brings up a screen list for the user to select a screen to
80 // establish the presentation session on.
81 // |render_process_id|, |render_frame_id|: ID of originating frame.
82 // |presentation_url|: URL of the presentation.
83 // |presentation_id|: The caller may provide an non-empty string to be used
84 // as the ID of the presentation. If this is an empty string, the embedder
85 // will automatically generate one.
86 // |success_cb|: Invoked with session info, if presentation session started
87 // successfully.
88 // |error_cb|: Invoked with error reason, if presentation session did not
89 // start.
90 virtual void StartSession(
91 int render_process_id,
92 int render_frame_id,
93 const std::string& presentation_url,
94 const std::string& presentation_id,
95 const PresentationSessionSuccessCallback& success_cb,
96 const PresentationSessionErrorCallback& error_cb) = 0;
97
98 // Joins an existing presentation session. Unlike StartSession(), this
99 // does not bring a screen list UI.
100 // |render_process_id|, |render_frame_id|: ID for originating frame.
101 // |presentation_url|: URL of the presentation.
102 // |presentation_id|: The ID of the presentation to join.
103 // |success_cb|: Invoked with session info, if presentation session joined
104 // successfully.
105 // |error_cb|: Invoked with error reason, if joining failed.
106 virtual void JoinSession(
107 int render_process_id,
108 int render_frame_id,
109 const std::string& presentation_url,
110 const std::string& presentation_id,
111 const PresentationSessionSuccessCallback& success_cb,
112 const PresentationSessionErrorCallback& error_cb) = 0;
62 }; 113 };
63 114
64 } // namespace content 115 } // namespace content
65 116
66 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ 117 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698