| OLD | NEW |
| 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 CHROME_BROWSER_MEDIA_ROUTER_ISSUES_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_ISSUES_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_MEDIA_ROUTER_ISSUES_OBSERVER_H_ | 6 #define CHROME_BROWSER_MEDIA_ROUTER_ISSUES_OBSERVER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "chrome/browser/media/router/issue.h" | 9 #include "chrome/browser/media/router/issue.h" |
| 10 | 10 |
| 11 namespace media_router { | 11 namespace media_router { |
| 12 | 12 |
| 13 class MediaRouter; | 13 class MediaRouter; |
| 14 | 14 |
| 15 // Base class for observing Media Router Issue. There is at most one Issue | 15 // Base class for observing Media Router Issue. There is at most one Issue |
| 16 // at any given time. | 16 // at any given time. |
| 17 class IssuesObserver { | 17 class IssuesObserver { |
| 18 public: | 18 public: |
| 19 explicit IssuesObserver(MediaRouter* router); | 19 explicit IssuesObserver(MediaRouter* router); |
| 20 virtual ~IssuesObserver(); | 20 virtual ~IssuesObserver(); |
| 21 | 21 |
| 22 void RegisterObserver(); | 22 // Registers with Media Router to start observing for Issues. No-ops if Init() |
| 23 void UnregisterObserver(); | 23 // has already been called before. |
| 24 void Init(); |
| 24 | 25 |
| 25 // Called when there is an updated Media Router Issue. | 26 // Called when there is an updated Media Router Issue. |
| 26 // If |issue| is nullptr, then there is currently no issue. | 27 // Note that |issue| is owned by the IssueManager that is calling the |
| 27 virtual void OnIssueUpdated(const Issue* issue) {} | 28 // observers. Implementations that wish to retain the data must make a copy |
| 29 // of |issue|. |
| 30 virtual void OnIssue(const Issue& issue) {} |
| 31 |
| 32 // Called when there are no more issues. |
| 33 virtual void OnIssuesCleared() {} |
| 28 | 34 |
| 29 private: | 35 private: |
| 30 MediaRouter* router_; | 36 MediaRouter* router_; |
| 37 bool initialized_; |
| 31 | 38 |
| 32 DISALLOW_COPY_AND_ASSIGN(IssuesObserver); | 39 DISALLOW_COPY_AND_ASSIGN(IssuesObserver); |
| 33 }; | 40 }; |
| 34 | 41 |
| 35 } // namespace media_router | 42 } // namespace media_router |
| 36 | 43 |
| 37 #endif // CHROME_BROWSER_MEDIA_ROUTER_ISSUES_OBSERVER_H_ | 44 #endif // CHROME_BROWSER_MEDIA_ROUTER_ISSUES_OBSERVER_H_ |
| OLD | NEW |