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

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

Issue 1103273013: Upstream the Media Router's Issue class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resync with master. 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
« no previous file with comments | « chrome/browser/media/router/BUILD.gn ('k') | chrome/browser/media/router/issue.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // The text that corresponds with an action a user can take for a Issue.
17 class IssueAction {
18 public:
19 enum Type { OK, CANCEL, DISMISS, LEARN_MORE };
20
21 explicit IssueAction(const Type type);
22 ~IssueAction();
23
24 Type type() const { return type_; }
25
26 bool Equals(const IssueAction& other) const { return type_ == other.type_; }
27
28 private:
29 Type type_;
30 };
31
32 // Contains the information relevant to an issue.
33 class Issue {
34 public:
35 using IssueId = std::string;
36
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 MediaRouteId route_id() const { return route_id_; }
69 Severity severity() const { return severity_; }
70 const IssueId& id() const { return id_; }
71 bool is_blocking() const { return is_blocking_; }
72 bool is_global() const { return route_id_.empty(); }
73 const GURL& help_url() const { return help_url_; }
74
75 bool Equals(const Issue& other) const;
76
77 private:
78 std::string title_;
79 std::string message_;
80 IssueAction default_action_;
81 std::vector<IssueAction> secondary_actions_;
82 std::string route_id_;
83 Severity severity_;
84 IssueId id_;
85 bool is_blocking_;
86 GURL help_url_;
87 };
88
89 } // namespace media_router
90
91 #endif // CHROME_BROWSER_MEDIA_ROUTER_ISSUE_H_
OLDNEW
« no previous file with comments | « chrome/browser/media/router/BUILD.gn ('k') | chrome/browser/media/router/issue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698