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

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

Issue 1102683002: Revert of [Presentation API] Implement ondefaultsessionstart in PSImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 "base/callback.h"
9 #include "content/common/content_export.h" 9 #include "content/common/content_export.h"
10 #include "content/public/browser/presentation_session.h" 10 #include "content/public/browser/presentation_session.h"
11 11
12 namespace content { 12 namespace content {
13 13
14 class PresentationScreenAvailabilityListener; 14 class PresentationScreenAvailabilityListener;
15 15
16 // An interface implemented by embedders to handle presentation API calls 16 // An interface implemented by embedders to handle presentation API calls
17 // forwarded from PresentationServiceImpl. 17 // forwarded from PresentationServiceImpl.
18 class CONTENT_EXPORT PresentationServiceDelegate { 18 class CONTENT_EXPORT PresentationServiceDelegate {
19 public: 19 public:
20 // Observer interface to listen for changes to PresentationServiceDelegate. 20 // Observer interface to listen for changes to PresentationServiceDelegate.
21 class CONTENT_EXPORT Observer { 21 class CONTENT_EXPORT Observer {
22 public: 22 public:
23 // Called when the PresentationServiceDelegate is being destroyed. 23 // Called when the PresentationServiceDelegate is being destroyed.
24 virtual void OnDelegateDestroyed() = 0; 24 virtual void OnDelegateDestroyed() = 0;
25 25
26 // Called when the default presentation has been started outside of a
27 // Presentation API context (e.g., browser action). This will not be called
28 // if the session was created as a result of Presentation API's
29 // StartSession()/JoinSession().
30 virtual void OnDefaultPresentationStarted(
31 const PresentationSessionInfo& session) = 0;
32
33 protected: 26 protected:
34 virtual ~Observer() {} 27 virtual ~Observer() {}
35 }; 28 };
36 29
37 using PresentationSessionSuccessCallback = 30 using PresentationSessionSuccessCallback =
38 base::Callback<void(const PresentationSessionInfo&)>; 31 base::Callback<void(const PresentationSessionInfo&)>;
39 using PresentationSessionErrorCallback = 32 using PresentationSessionErrorCallback =
40 base::Callback<void(const PresentationError&)>; 33 base::Callback<void(const PresentationError&)>;
41 34
42 virtual ~PresentationServiceDelegate() {} 35 virtual ~PresentationServiceDelegate() {}
43 36
44 // Registers an observer associated with frame with |render_process_id| 37 // Registers an observer with this class to listen for updates to this class.
45 // and |render_frame_id| with this class to listen for updates.
46 // This class does not own the observer. 38 // This class does not own the observer.
47 // It is an error to add an observer if there is already an observer for that 39 // It is an error to add an observer if it has already been added before.
48 // frame. 40 virtual void AddObserver(Observer* observer) = 0;
49 virtual void AddObserver(int render_process_id, 41 // Unregisters an observer with this class.
50 int render_frame_id, 42 virtual void RemoveObserver(Observer* observer) = 0;
51 Observer* observer) = 0;
52
53 // Unregisters the observer associated with the frame with |render_process_id|
54 // and |render_frame_id|.
55 // The observer will no longer receive updates.
56 virtual void RemoveObserver(int render_process_id, int render_frame_id) = 0;
57 43
58 // Registers |listener| to continuously listen for 44 // Registers |listener| to continuously listen for
59 // availability updates for a presentation URL, originated from the frame 45 // availability updates for a presentation URL, originated from the frame
60 // given by |render_process_id| and |render_frame_id|. 46 // given by |render_process_id| and |render_frame_id|.
61 // This class does not own |listener|. 47 // This class does not own |listener|.
62 // Returns true on success. 48 // Returns true on success.
63 // This call will return false if a listener with the same presentation URL 49 // This call will return false if a listener with the same presentation URL
64 // from the same frame is already registered. 50 // from the same frame is already registered.
65 virtual bool AddScreenAvailabilityListener( 51 virtual bool AddScreenAvailabilityListener(
66 int render_process_id, 52 int render_process_id,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 int render_frame_id, 113 int render_frame_id,
128 const std::string& presentation_url, 114 const std::string& presentation_url,
129 const std::string& presentation_id, 115 const std::string& presentation_id,
130 const PresentationSessionSuccessCallback& success_cb, 116 const PresentationSessionSuccessCallback& success_cb,
131 const PresentationSessionErrorCallback& error_cb) = 0; 117 const PresentationSessionErrorCallback& error_cb) = 0;
132 }; 118 };
133 119
134 } // namespace content 120 } // namespace content
135 121
136 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ 122 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_
OLDNEW
« no previous file with comments | « content/common/presentation/presentation_service.mojom ('k') | content/renderer/presentation/presentation_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698