Chromium Code Reviews| 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 // If |issue| is nullptr, then there is currently no issue. |
|
mark a. foltz
2016/11/29 21:27:07
Document that the lifetime of |issue| is tied to t
imcheng
2016/12/05 23:18:17
Done.
| |
| 27 virtual void OnIssueUpdated(const Issue* issue) {} | 28 virtual void OnIssueUpdated(const Issue* issue) {} |
|
mark a. foltz
2016/11/29 21:27:07
Would it make more sense to pass a const reference
imcheng
2016/12/05 23:18:17
Unfortunately we are also using this API to notify
| |
| 28 | 29 |
| 29 private: | 30 private: |
| 30 MediaRouter* router_; | 31 MediaRouter* router_; |
| 32 bool initialized_; | |
| 31 | 33 |
| 32 DISALLOW_COPY_AND_ASSIGN(IssuesObserver); | 34 DISALLOW_COPY_AND_ASSIGN(IssuesObserver); |
| 33 }; | 35 }; |
| 34 | 36 |
| 35 } // namespace media_router | 37 } // namespace media_router |
| 36 | 38 |
| 37 #endif // CHROME_BROWSER_MEDIA_ROUTER_ISSUES_OBSERVER_H_ | 39 #endif // CHROME_BROWSER_MEDIA_ROUTER_ISSUES_OBSERVER_H_ |
| OLD | NEW |