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