summaryrefslogtreecommitdiffstats
path: root/chrome/browser/media/router/issue.cc
blob: 6798d950fe55dd71d71302379d5cf6fa68429548 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// 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 MediaRoute::Id& 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_) << "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());
}

Issue::~Issue() {
}

bool Issue::Equals(const Issue& other) const {
  return id_ == other.id_;
}

}  // namespace media_router