Index: chrome/browser/media/router/issue.h |
diff --git a/chrome/browser/media/router/issue.h b/chrome/browser/media/router/issue.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2767caf8799479eac5fd22991d96f1f110a126e6 |
--- /dev/null |
+++ b/chrome/browser/media/router/issue.h |
@@ -0,0 +1,97 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_MEDIA_ROUTER_ISSUE_H_ |
+#define CHROME_BROWSER_MEDIA_ROUTER_ISSUE_H_ |
+ |
+#include <string> |
+#include <vector> |
+ |
+#include "base/logging.h" |
+#include "chrome/browser/media/router/media_route.h" |
+ |
+namespace media_router { |
+ |
+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
|
+ |
+// The text that corresponds with an action a user can take for a Issue. |
+class IssueAction { |
+ public: |
+ enum Type { OK, CANCEL, DISMISS, LEARN_MORE }; |
+ |
+ explicit IssueAction(const Type type); |
+ ~IssueAction(); |
+ |
+ Type type() const { return type_; } |
+ |
+ bool Equals(const IssueAction& other) const { return type_ == other.type_; } |
+ |
+ private: |
+ Type type_; |
+}; |
+ |
+// Contains the information relevant to an issue. |
+class Issue { |
+ public: |
+ enum Severity { FATAL, WARNING, NOTIFICATION }; |
+ |
+ // Creates a custom issue. |
+ // |title|: The title for the issue. |
+ // |message|: The optional description message for the issue. |
+ // |default_action|: Default action user can take to resolve the issue. |
+ // |secondary_actions|: Array of options user can take to resolve the |
+ // issue. Can be empty. Currently only one secondary |
+ // action is supported. |
+ // |route_id|: The route id, or empty if global. |
+ // |severity|: The severity of the issue. |
+ // |is_blocking|: True if the issue needs to be resolved before continuing. |
+ // |help_url|: Required if one of the actions is learn-more. |
+ Issue(const std::string& title, |
+ const std::string& message, |
+ const IssueAction& default_action, |
+ const std::vector<IssueAction>& secondary_actions, |
+ const MediaRouteId& route_id, |
+ const Severity severity, |
+ bool is_blocking, |
+ const std::string& helpUrl); |
+ |
+ ~Issue(); |
+ |
+ // See constructor comments for more information about these fields. |
+ const std::string& title() const { return title_; } |
+ const std::string& message() const { return message_; } |
+ IssueAction default_action() const { return default_action_; } |
+ const std::vector<IssueAction>& secondary_actions() const { |
+ return secondary_actions_; |
+ } |
+ 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.
|
+ MediaRouteId route_id() const { return route_id_; } |
+ const GURL& help_url() const { return help_url_; } |
+ |
+ // Issue id. |
+ const IssueId& id() const { return id_; } |
+ |
+ // Whether or not this issue makes casting unable to function. |
+ 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.
|
+ |
+ // Whether or not the issue is a global issue. |
+ bool IsGlobal() const; |
+ |
+ bool Equals(const Issue& other) const; |
+ |
+ private: |
+ const std::string title_; |
+ const std::string message_; |
+ const IssueAction default_action_; |
+ const std::vector<IssueAction> secondary_actions_; |
+ const std::string route_id_; |
+ const Severity severity_; |
+ const IssueId id_; |
+ const bool is_blocking_; |
+ 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
|
+}; |
+ |
+} // namespace media_router |
+ |
+#endif // CHROME_BROWSER_MEDIA_ROUTER_ISSUE_H_ |