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

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

Issue 1073893003: [Presentation API] Implement ondefaultsessionstart in PSImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use RunLoopFor 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
26 protected: 33 protected:
27 virtual ~Observer() {} 34 virtual ~Observer() {}
28 }; 35 };
29 36
30 using PresentationSessionSuccessCallback = 37 using PresentationSessionSuccessCallback =
31 base::Callback<void(const PresentationSessionInfo&)>; 38 base::Callback<void(const PresentationSessionInfo&)>;
32 using PresentationSessionErrorCallback = 39 using PresentationSessionErrorCallback =
33 base::Callback<void(const PresentationError&)>; 40 base::Callback<void(const PresentationError&)>;
34 41
35 virtual ~PresentationServiceDelegate() {} 42 virtual ~PresentationServiceDelegate() {}
36 43
37 // Registers an observer with this class to listen for updates to this class. 44 // Registers an observer associated with frame with |render_process_id|
45 // and |render_frame_id| with this class to listen for updates.
38 // This class does not own the observer. 46 // This class does not own the observer.
39 // It is an error to add an observer if it has already been added before. 47 // It is an error to add an observer if there is already an observer for that
40 virtual void AddObserver(Observer* observer) = 0; 48 // frame.
41 // Unregisters an observer with this class. 49 virtual void AddObserver(int render_process_id,
42 virtual void RemoveObserver(Observer* observer) = 0; 50 int render_frame_id,
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;
43 57
44 // Registers |listener| to continuously listen for 58 // Registers |listener| to continuously listen for
45 // availability updates for a presentation URL, originated from the frame 59 // availability updates for a presentation URL, originated from the frame
46 // given by |render_process_id| and |render_frame_id|. 60 // given by |render_process_id| and |render_frame_id|.
47 // This class does not own |listener|. 61 // This class does not own |listener|.
48 // Returns true on success. 62 // Returns true on success.
49 // This call will return false if a listener with the same presentation URL 63 // This call will return false if a listener with the same presentation URL
50 // from the same frame is already registered. 64 // from the same frame is already registered.
51 virtual bool AddScreenAvailabilityListener( 65 virtual bool AddScreenAvailabilityListener(
52 int render_process_id, 66 int render_process_id,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 int render_frame_id, 127 int render_frame_id,
114 const std::string& presentation_url, 128 const std::string& presentation_url,
115 const std::string& presentation_id, 129 const std::string& presentation_id,
116 const PresentationSessionSuccessCallback& success_cb, 130 const PresentationSessionSuccessCallback& success_cb,
117 const PresentationSessionErrorCallback& error_cb) = 0; 131 const PresentationSessionErrorCallback& error_cb) = 0;
118 }; 132 };
119 133
120 } // namespace content 134 } // namespace content
121 135
122 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ 136 #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