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

Side by Side 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: Created 4 years, 5 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/guid.h"
6 #include "chrome/browser/media/router/issue.h" 5 #include "chrome/browser/media/router/issue.h"
7 6
8 namespace media_router { 7 namespace media_router {
9 8
10 IssueAction::IssueAction(const IssueAction::Type type) : type_(type) { 9 namespace {
11 } 10 // ID generator for Issues.
12 11 Issue::Id next_issue_id = 0;
mark a. foltz 2016/07/27 18:52:03 Please use a threadsafe sequence number: https://
imcheng 2016/09/13 20:27:54 Done in IssueManager.
13 IssueAction::~IssueAction() {
14 } 12 }
15 13
16 Issue::Issue(const std::string& title, 14 Issue::Issue(const std::string& title,
17 const std::string& message, 15 const ActionType& default_action,
18 const IssueAction& default_action, 16 Severity severity)
19 const std::vector<IssueAction>& secondary_actions, 17 : id_(next_issue_id++),
20 const MediaRoute::Id& route_id, 18 title_(title),
21 const Issue::Severity severity,
22 bool is_blocking,
23 int help_page_id)
24 : title_(title),
25 message_(message),
26 default_action_(default_action), 19 default_action_(default_action),
27 secondary_actions_(secondary_actions),
28 route_id_(route_id),
29 severity_(severity), 20 severity_(severity),
30 id_(base::GenerateGUID()), 21 is_blocking_(false),
31 is_blocking_(is_blocking), 22 help_page_id_(-1) {}
32 help_page_id_(help_page_id) {
33 DCHECK(!title_.empty());
34 DCHECK(severity_ != FATAL || is_blocking_) << "Severity is " << severity_;
35
36 // Check that the default and secondary actions are not of the same type.
37 if (!secondary_actions_.empty())
38 DCHECK_NE(default_action_.type(), secondary_actions_[0].type());
39 }
40 23
41 Issue::Issue(const Issue& other) = default; 24 Issue::Issue(const Issue& other) = default;
42 25
43 Issue::~Issue() { 26 Issue::~Issue() = default;
27
28 bool Issue::IsBlocking() const {
29 return severity_ == Issue::Severity::FATAL || is_blocking_;
mark a. foltz 2016/07/27 18:52:03 or initialize is_blocking_ to severity_ == Issue::
imcheng 2016/09/13 20:27:54 Done.
44 } 30 }
45 31
46 bool Issue::Equals(const Issue& other) const { 32 bool Issue::IsGlobal() const {
47 return id_ == other.id_; 33 return route_id_.empty();
48 } 34 }
49 35
50 } // namespace media_router 36 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698