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 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 using IssueId = std::string; | |
DaleCurtis
2015/04/30 18:18:14
I'm wary of having this live outside of a class de
Kevin M
2015/05/01 17:59:17
Moved it into Issue.
Regarding specialized IssueI
| |
17 | |
18 // The text that corresponds with an action a user can take for a Issue. | |
19 class IssueAction { | |
20 public: | |
21 enum Type { OK, CANCEL, DISMISS, LEARN_MORE }; | |
22 | |
23 explicit IssueAction(const Type type); | |
24 ~IssueAction(); | |
25 | |
26 Type type() const { return type_; } | |
27 | |
28 bool Equals(const IssueAction& other) const { return type_ == other.type_; } | |
29 | |
30 private: | |
31 Type type_; | |
32 }; | |
33 | |
34 // Contains the information relevant to an issue. | |
35 class Issue { | |
36 public: | |
37 enum Severity { FATAL, WARNING, NOTIFICATION }; | |
38 | |
39 // Creates a custom issue. | |
40 // |title|: The title for the issue. | |
41 // |message|: The optional description message for the issue. | |
42 // |default_action|: Default action user can take to resolve the issue. | |
43 // |secondary_actions|: Array of options user can take to resolve the | |
44 // issue. Can be empty. Currently only one secondary | |
45 // action is supported. | |
46 // |route_id|: The route id, or empty if global. | |
47 // |severity|: The severity of the issue. | |
48 // |is_blocking|: True if the issue needs to be resolved before continuing. | |
49 // |help_url|: Required if one of the actions is learn-more. | |
50 Issue(const std::string& title, | |
51 const std::string& message, | |
52 const IssueAction& default_action, | |
53 const std::vector<IssueAction>& secondary_actions, | |
54 const MediaRouteId& route_id, | |
55 const Severity severity, | |
56 bool is_blocking, | |
57 const std::string& helpUrl); | |
58 | |
59 ~Issue(); | |
60 | |
61 // See constructor comments for more information about these fields. | |
62 const std::string& title() const { return title_; } | |
63 const std::string& message() const { return message_; } | |
64 IssueAction default_action() const { return default_action_; } | |
65 const std::vector<IssueAction>& secondary_actions() const { | |
66 return secondary_actions_; | |
67 } | |
68 Severity severity() const { return severity_; } | |
apacible
2015/04/30 19:02:06
nit: Can you put these in the same order as the pa
Kevin M
2015/05/01 17:59:17
Done.
| |
69 MediaRouteId route_id() const { return route_id_; } | |
70 const GURL& help_url() const { return help_url_; } | |
71 | |
72 // Issue id. | |
73 const IssueId& id() const { return id_; } | |
74 | |
75 // Whether or not this issue makes casting unable to function. | |
76 bool IsBlocking() const; | |
DaleCurtis
2015/04/30 18:18:15
Seems like these should be hacker style too?
apacible
2015/04/30 19:02:06
What does hacker style mean?
DaleCurtis
2015/04/30 19:05:02
hacker_style()
Kevin M
2015/05/01 17:59:17
Done.
| |
77 | |
78 // Whether or not the issue is a global issue. | |
79 bool IsGlobal() const; | |
80 | |
81 bool Equals(const Issue& other) const; | |
82 | |
83 private: | |
84 const std::string title_; | |
85 const std::string message_; | |
86 const IssueAction default_action_; | |
87 const std::vector<IssueAction> secondary_actions_; | |
88 const std::string route_id_; | |
89 const Severity severity_; | |
90 const IssueId id_; | |
91 const bool is_blocking_; | |
92 const GURL help_url_; | |
DaleCurtis
2015/04/30 18:18:14
Const values will prevent copyable classes. Is tha
Kevin M
2015/05/01 17:59:17
Done for this class.
Re: IssueAction, it needs to
| |
93 }; | |
94 | |
95 } // namespace media_router | |
96 | |
97 #endif // CHROME_BROWSER_MEDIA_ROUTER_ISSUE_H_ | |
OLD | NEW |