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

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

Issue 2176613003: [Media Router] Clean up issues related code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix tests Created 4 years 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
« no previous file with comments | « chrome/browser/media/router/issue.h ('k') | chrome/browser/media/router/issue_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/media/router/issue.cc
diff --git a/chrome/browser/media/router/issue.cc b/chrome/browser/media/router/issue.cc
index 0dd3488c63b7b60a9904e79744228d9aa5731bb2..5f402689a07323b0f4379802f55f539d11dd2b4c 100644
--- a/chrome/browser/media/router/issue.cc
+++ b/chrome/browser/media/router/issue.cc
@@ -2,49 +2,49 @@
// 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 {
+#include "base/atomic_sequence_num.h"
-IssueAction::IssueAction(const IssueAction::Type type) : type_(type) {
-}
+namespace media_router {
-IssueAction::~IssueAction() {
+namespace {
+// ID generator for Issue.
+base::StaticAtomicSequenceNumber g_next_issue_id;
}
-Issue::Issue(const std::string& title,
- const std::string& message,
- const IssueAction& default_action,
- const std::vector<IssueAction>& secondary_actions,
- const MediaRoute::Id& route_id,
- const Issue::Severity severity,
- bool is_blocking,
- int help_page_id)
- : 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_page_id_(help_page_id) {
- DCHECK(!title_.empty());
- DCHECK(severity_ != FATAL || is_blocking_) << "Severity is " << severity_;
-
- // Check that the default and secondary actions are not of the same type.
- if (!secondary_actions_.empty())
- DCHECK_NE(default_action_.type(), secondary_actions_[0].type());
+IssueInfo::IssueInfo()
+ : default_action(IssueInfo::Action::DISMISS),
+ severity(IssueInfo::Severity::NOTIFICATION),
+ is_blocking(false),
+ help_page_id(IssueInfo::kUnknownHelpPageId) {}
+
+IssueInfo::IssueInfo(const std::string& title,
+ const Action default_action,
+ Severity severity)
+ : title(title),
+ default_action(default_action),
+ severity(severity),
+ is_blocking(severity == IssueInfo::Severity::FATAL),
+ help_page_id(IssueInfo::kUnknownHelpPageId) {}
+
+IssueInfo::IssueInfo(const IssueInfo& other) = default;
+
+IssueInfo::~IssueInfo() = default;
+
+IssueInfo& IssueInfo::operator=(const IssueInfo& other) = default;
+
+bool IssueInfo::operator==(const IssueInfo& other) const {
+ return title == other.title && default_action == other.default_action &&
+ severity == other.severity && message == other.message &&
+ secondary_actions == other.secondary_actions &&
+ route_id == other.route_id && is_blocking == other.is_blocking &&
+ help_page_id == other.help_page_id;
}
-Issue::Issue(const Issue& other) = default;
+Issue::Issue(const IssueInfo& info)
+ : id_(g_next_issue_id.GetNext()), info_(info) {}
-Issue::~Issue() {
-}
-
-bool Issue::Equals(const Issue& other) const {
- return id_ == other.id_;
-}
+Issue::~Issue() = default;
} // namespace media_router
« no previous file with comments | « chrome/browser/media/router/issue.h ('k') | chrome/browser/media/router/issue_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698