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

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

Issue 2771413003: Move c/b/media/router/mojo/*.mojom to chrome/common/media_router/mojo/*.mojom (Closed)
Patch Set: Rebase Created 3 years, 8 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_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_ISSUE_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/logging.h"
12 #include "chrome/browser/media/router/media_route.h"
13
14 namespace media_router {
15
16 // Contains the information relevant to an issue.
17 struct IssueInfo {
18 public:
19 // Possible actions for an issue.
20 enum class Action {
21 DISMISS,
22 // NOTE: If LEARN_MORE is set as a possible action for an issue, then its
23 // |help_page_id_| must also be set to a valid value.
24 LEARN_MORE,
25
26 // Denotes enum value boundary. New values should be added above.
27 NUM_VALUES = LEARN_MORE
28 };
29
30 // Severity type of an issue. A FATAL issue is considered blocking. Although
31 // issues of other severity levels may also be blocking.
32 enum class Severity { FATAL, WARNING, NOTIFICATION };
33
34 static const int kUnknownHelpPageId = 0;
35
36 // Used by Mojo and testing only.
37 IssueInfo();
38
39 // |title|: The title for the issue.
40 // |default_action|: Default action user can take to resolve the issue.
41 // |severity|: The severity of the issue. If FATAL, then |is_blocking| is set
42 // to |true|.
43 IssueInfo(const std::string& title, Action default_action, Severity severity);
44 IssueInfo(const IssueInfo& other);
45 ~IssueInfo();
46
47 IssueInfo& operator=(const IssueInfo& other);
48 bool operator==(const IssueInfo& other) const;
49
50 // Fields set with values provided to the constructor.
51 std::string title;
52 Action default_action;
53 Severity severity;
54
55 // Description message for the issue.
56 std::string message;
57
58 // Options the user can take to resolve the issue in addition to the
59 // default action. Can be empty. If non-empty, currently only one secondary
60 // action is supported.
61 std::vector<Action> secondary_actions;
62
63 // ID of route associated with the Issue, or empty if no route is associated
64 // with it.
65 std::string route_id;
66
67 // |true| if the issue needs to be resolved before continuing. Note that a
68 // Issue of severity FATAL is considered blocking by default.
69 bool is_blocking;
70
71 // ID of help page to link to, if one of the actions is LEARN_MORE.
72 // Defaults to |kUnknownHelpPageId|.
73 int help_page_id;
74 };
75
76 // An issue that is associated with a globally unique ID. Created by
77 // IssueManager when an IssueInfo is added to it.
78 class Issue {
79 public:
80 using Id = int;
81 // ID is generated during construction.
82 explicit Issue(const IssueInfo& info);
83 Issue(const Issue& other) = default;
84 Issue& operator=(const Issue& other) = default;
85 ~Issue();
86
87 const Id& id() const { return id_; }
88 const IssueInfo& info() const { return info_; }
89
90 private:
91 Id id_;
92 IssueInfo info_;
93 };
94
95 } // namespace media_router
96
97 #endif // CHROME_BROWSER_MEDIA_ROUTER_ISSUE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698