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

Side by Side Diff: chrome/browser/media/router/issue_manager.h

Issue 1103273013: Upstream the Media Router's Issue class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added issue manager, issue observer. Created 5 years, 7 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
(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 CHROME_BROWSER_MEDIA_ROUTER_ISSUE_MANAGER_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_ISSUE_MANAGER_H_
7
8 #include <map>
9
10 #include "base/containers/hash_tables.h"
11 #include "base/observer_list.h"
12 #include "base/threading/thread_checker.h"
13 #include "chrome/browser/media/router/issue.h"
14 #include "chrome/browser/media/router/issues_observer.h"
15
16 namespace media_router {
17
18 // IssueManager keeps track of current issues related to casting
19 // connectivity and quality.
20 // TODO(apacible): Determine what other issues will be handled here.
21 class IssueManager {
22 public:
23 IssueManager();
24 ~IssueManager();
25
26 // Adds an issue.
27 // |issue|: Issue to be added. Must have unique ID.
28 void AddIssue(const Issue& issue);
29
30 // Removes an issue when user has noted it is resolved.
31 // |issue_id|: IssueId of the issue to be removed.
32 void ClearIssue(const IssueId& issue_id);
33
34 // Gets the number of unresolved issues.
35 size_t GetIssueCount() const;
36
37 // Removes all unresolved issues.
38 void ClearAllIssues();
39
40 // Removes all unresolved global issues.
41 void ClearGlobalIssues();
42
43 // Removes all unresolved issues with RouteId.
44 // |route_id|: MediaRouteId of the issues to be removed.
45 void ClearIssuesWithRouteId(const MediaRouteId& route_id);
46
47 // Registers |observer| in |issues_observers_|. If there is already an
48 // observer registered with this instance, do nothing. Does not take
49 // ownership of |observer|.
50 // |observer|: IssuesObserver to be registered.
51 void RegisterObserver(IssuesObserver* observer);
DaleCurtis 2015/04/30 18:18:15 Is it IssueObserver in that each observer will be
apacible 2015/04/30 19:02:06 All IssueObservers will be called for each issue t
Kevin M 2015/05/01 17:59:18 PTAL at the newest comments, hopefully it is clear
52
53 // Unregisters |observer| from |issues_observers_|.
54 // |observer|: IssuesObserver to be unregistered.
55 void UnregisterObserver(IssuesObserver* observer);
56
57 private:
58 // Checks if the current top issue has changed. Updates |top_issue_|.
59 // If |top_issue_| has changed, issues in |issues_observers_| will be
60 // notified of the new top issue.
61 void MaybeUpdateTopIssue();
62
63 base::hash_map<IssueId, Issue> media_issue_map_;
64
65 // Not owned by IssueManager.
66 ObserverList<IssuesObserver> issues_observers_;
67
68 Issue* top_issue_;
69
70 base::ThreadChecker thread_checker_;
71
72 DISALLOW_COPY_AND_ASSIGN(IssueManager);
73 };
74
75 } // namespace media_router
76
77 #endif // CHROME_BROWSER_MEDIA_ROUTER_ISSUE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698