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

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: Added handling for overlapping requests, default presentation id, 1-UA fallback 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 and ID for frame given by
71 // |render_process_id| and |render_frame_id|.
72 // If |default_presentation_url| is empty, the default presentation URL will
73 // be cleared.
74 virtual void SetDefaultPresentationUrl(
75 int render_process_id,
76 int render_frame_id,
77 const std::string& default_presentation_url,
78 const std::string& default_presentation_id) = 0;
79
80 // Starts a new presentation session.
81 // This brings up a screen list for the user to select a screen to
82 // establish the presentation session on.
83 // |render_process_id|, |render_frame_id|: ID of originating frame.
84 // |presentation_url|: URL of the presentation. If empty, fall back to
85 // falling back on "1-UA" mode, i.e. offscreen tab rendering.
86 // |presentation_id|: The caller may provide an non-empty string to be used
87 // as the ID of the presentation. If this is an empty string, the embedder
88 // will automatically generate one.
89 // |success_cb|: Invoked with session info, if presentation session started
90 // successfully.
91 // |error_cb|: Invoked with error reason, if presentation session did not
92 // start.
93 virtual void StartSession(
94 int render_process_id,
95 int render_frame_id,
96 const std::string& presentation_url,
97 const std::string& presentation_id,
98 const PresentationSessionSuccessCallback& success_cb,
99 const PresentationSessionErrorCallback& error_cb) = 0;
100
101 // Joins an existing presentation session. Unlike StartSession(), this
102 // does not bring a screen list UI.
103 // |render_process_id|, |render_frame_id|: ID for originating frame.
104 // |presentation_url|: URL of the presentation. If empty, fall back to
105 // falling back on "1-UA" mode, i.e. offscreen tab rendering.
106 // |presentation_id|: The ID of the presentation to join.
107 // |success_cb|: Invoked with session info, if presentation session joined
108 // successfully.
109 // |error_cb|: Invoked with error reason, if joining failed.
110 virtual void JoinSession(
111 int render_process_id,
112 int render_frame_id,
113 const std::string& presentation_url,
114 const std::string& presentation_id,
115 const PresentationSessionSuccessCallback& success_cb,
116 const PresentationSessionErrorCallback& error_cb) = 0;
62 }; 117 };
63 118
64 } // namespace content 119 } // namespace content
65 120
66 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ 121 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698