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
3 // found in the LICENSE file.
5 #ifndef CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_
6 #define CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_
8 #include "content/common/content_export.h"
12 class PresentationScreenAvailabilityListener
;
14 // An interface implemented by embedders to handle presentation API calls
15 // forwarded from PresentationServiceImpl.
16 class CONTENT_EXPORT PresentationServiceDelegate
{
18 // Observer interface to listen for changes to PresentationServiceDelegate.
19 class CONTENT_EXPORT Observer
{
21 // Called when the PresentationServiceDelegate is being destroyed.
22 virtual void OnDelegateDestroyed() = 0;
25 virtual ~Observer() {}
28 virtual ~PresentationServiceDelegate() {}
30 // Registers an observer with this class to listen for updates to this class.
31 // This class does not own the observer.
32 // It is an error to add an observer if it has already been added before.
33 virtual void AddObserver(Observer
* observer
) = 0;
34 // Unregisters an observer with this class.
35 virtual void RemoveObserver(Observer
* observer
) = 0;
37 // Registers |listener| to continuously listen for
38 // availability updates for a presentation URL, originated from the frame
39 // given by |render_process_id| and |render_frame_id|.
40 // This class does not own |listener|.
41 // Returns true on success.
42 // This call will return false if a listener with the same presentation URL
43 // from the same frame is already registered.
44 virtual bool AddScreenAvailabilityListener(
45 int render_process_id
,
47 PresentationScreenAvailabilityListener
* listener
) = 0;
49 // Unregisters |listener| originated from the frame given by
50 // |render_process_id| and |render_frame_id| from this class. The listener
51 // will no longer receive availability updates.
52 virtual void RemoveScreenAvailabilityListener(
53 int render_process_id
,
55 PresentationScreenAvailabilityListener
* listener
) = 0;
57 // Unregisters all listeners associated with the frame given by
58 // |render_process_id| and |render_frame_id|.
59 virtual void RemoveAllScreenAvailabilityListeners(
60 int render_process_id
,
61 int render_frame_id
) = 0;
64 } // namespace content
66 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_