Only grant permissions to new extensions from sync if they have the expected version
[chromium-blink-merge.git] / chrome / browser / media / router / issue.h
blobf051f81ba1d8fd402c4aadf6c436db8498bc8047
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.
5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_ISSUE_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_ISSUE_H_
8 #include <string>
9 #include <vector>
11 #include "base/logging.h"
12 #include "chrome/browser/media/router/media_route.h"
14 namespace media_router {
16 // The text that corresponds with an action a user can take for a Issue.
17 class IssueAction {
18 public:
19 enum Type {
20 TYPE_DISMISS,
21 TYPE_LEARN_MORE,
22 TYPE_MAX /* Denotes enum value boundary. */
25 explicit IssueAction(const Type type);
26 ~IssueAction();
28 Type type() const { return type_; }
30 bool Equals(const IssueAction& other) const { return type_ == other.type_; }
32 private:
33 Type type_;
36 // Contains the information relevant to an issue.
37 class Issue {
38 public:
39 using Id = std::string;
41 enum Severity { FATAL, WARNING, NOTIFICATION };
43 // Creates a custom issue.
44 // |title|: The title for the issue.
45 // |message|: The optional description message for the issue.
46 // |default_action|: Default action user can take to resolve the issue.
47 // |secondary_actions|: Array of options user can take to resolve the
48 // issue. Can be empty. Currently only one secondary
49 // action is supported.
50 // |route_id|: The route id, or empty if global.
51 // |severity|: The severity of the issue.
52 // |is_blocking|: True if the issue needs to be resolved before continuing.
53 // |help_url|: Required if one of the actions is learn-more.
54 Issue(const std::string& title,
55 const std::string& message,
56 const IssueAction& default_action,
57 const std::vector<IssueAction>& secondary_actions,
58 const MediaRoute::Id& route_id,
59 const Severity severity,
60 bool is_blocking,
61 const std::string& helpUrl);
63 ~Issue();
65 // See constructor comments for more information about these fields.
66 const std::string& title() const { return title_; }
67 const std::string& message() const { return message_; }
68 IssueAction default_action() const { return default_action_; }
69 const std::vector<IssueAction>& secondary_actions() const {
70 return secondary_actions_;
72 MediaRoute::Id route_id() const { return route_id_; }
73 Severity severity() const { return severity_; }
74 const Issue::Id id() const { return id_; }
75 bool is_blocking() const { return is_blocking_; }
76 bool is_global() const { return route_id_.empty(); }
77 const GURL& help_url() const { return help_url_; }
79 bool Equals(const Issue& other) const;
81 private:
82 std::string title_;
83 std::string message_;
84 IssueAction default_action_;
85 std::vector<IssueAction> secondary_actions_;
86 std::string route_id_;
87 Severity severity_;
88 Issue::Id id_;
89 bool is_blocking_;
90 GURL help_url_;
93 } // namespace media_router
95 #endif // CHROME_BROWSER_MEDIA_ROUTER_ISSUE_H_