Cleanup: Pass std::string as const reference from chromeos/
[chromium-blink-merge.git] / ui / message_center / notifier_settings.cc
blob26546118b9e6a7a43f42679fc7a4b27ee9e1efec
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/logging.h"
6 #include "base/strings/string_number_conversions.h"
7 #include "ui/message_center/notifier_settings.h"
9 namespace message_center {
11 NotifierId::NotifierId(NotifierType type,
12 const std::string& id)
13 : type(type),
14 id(id) {
15 DCHECK(type != WEB_PAGE);
16 DCHECK(!id.empty());
19 NotifierId::NotifierId(const GURL& url)
20 : type(WEB_PAGE),
21 url(url) {}
23 NotifierId::NotifierId()
24 : type(SYSTEM_COMPONENT) {
27 bool NotifierId::operator==(const NotifierId& other) const {
28 if (type != other.type)
29 return false;
31 if (profile_id != other.profile_id)
32 return false;
34 if (type == WEB_PAGE)
35 return url == other.url;
37 return id == other.id;
40 bool NotifierId::operator<(const NotifierId& other) const {
41 if (type != other.type)
42 return type < other.type;
44 if (profile_id != other.profile_id)
45 return profile_id < other.profile_id;
47 if (type == WEB_PAGE)
48 return url < other.url;
50 return id < other.id;
53 Notifier::Notifier(const NotifierId& notifier_id,
54 const base::string16& name,
55 bool enabled)
56 : notifier_id(notifier_id),
57 name(name),
58 enabled(enabled) {
61 Notifier::~Notifier() {
64 NotifierGroup::NotifierGroup(const gfx::Image& icon,
65 const base::string16& name,
66 const base::string16& login_info,
67 size_t index)
68 : icon(icon), name(name), login_info(login_info), index(index) {}
70 NotifierGroup::~NotifierGroup() {}
72 } // namespace message_center