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

Unified Diff: chrome/browser/media/router/issue.cc

Issue 1103273013: Upstream the Media Router's Issue class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added issue manager, issue observer. Created 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media/router/issue.cc
diff --git a/chrome/browser/media/router/issue.cc b/chrome/browser/media/router/issue.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ba537ef4cd258ddf1d78e407b1ec00bfa7714f28
--- /dev/null
+++ b/chrome/browser/media/router/issue.cc
@@ -0,0 +1,56 @@
+// 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.
+
+#include "base/guid.h"
+#include "chrome/browser/media/router/issue.h"
+
+namespace media_router {
+
+IssueAction::IssueAction(const IssueAction::Type type) : type_(type) {
+}
+
+IssueAction::~IssueAction() {
+}
+
+Issue::Issue(const std::string& title,
+ const std::string& message,
+ const IssueAction& default_action,
+ const std::vector<IssueAction>& secondary_actions,
+ const MediaRouteId& route_id,
+ const Issue::Severity severity,
+ bool is_blocking,
+ const std::string& help_url)
+ : title_(title),
+ message_(message),
+ default_action_(default_action),
+ secondary_actions_(secondary_actions),
+ route_id_(route_id),
+ severity_(severity),
+ id_(base::GenerateGUID()),
+ is_blocking_(is_blocking),
+ help_url_(GURL(help_url)) {
+ DCHECK(!title_.empty());
+ DCHECK(severity_ != FATAL || is_blocking_);
DaleCurtis 2015/04/30 18:18:14 If you don't split this DCHECK() out the contents
Kevin M 2015/05/01 17:59:17 Great point. Fixed.
+
+ // Check that the default and secondary actions are not of the same type.
+ if (!secondary_actions_.empty())
+ DCHECK(default_action_.type() != secondary_actions_[0].type());
DaleCurtis 2015/04/30 18:18:14 DCHECK_NE
Kevin M 2015/05/01 17:59:17 Done.
+}
+
+Issue::~Issue() {
+}
+
+bool Issue::IsBlocking() const {
+ return is_blocking_;
+}
+
+bool Issue::IsGlobal() const {
+ return route_id_.empty();
+}
+
+bool Issue::Equals(const Issue& other) const {
+ return id_ == other.id_;
+}
+
+} // namespace media_router

Powered by Google App Engine
This is Rietveld 408576698