- add sources.
[platform/framework/web/crosswalk.git] / src / ui / message_center / notifier_settings.cc
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.
4
5 #include "base/logging.h"
6 #include "ui/message_center/notifier_settings.h"
7
8 namespace message_center {
9
10 NotifierId::NotifierId(NotifierType type,
11                        const std::string& id)
12     : type(type),
13       id(id),
14       system_component_type(-1) {
15   DCHECK(type == APPLICATION || type == SYNCED_NOTIFICATION_SERVICE);
16   DCHECK(!id.empty());
17 }
18
19 NotifierId::NotifierId(const GURL& url)
20     : type(WEB_PAGE),
21       url(url),
22       system_component_type(-1) {}
23
24 NotifierId::NotifierId(int type)
25     : type(SYSTEM_COMPONENT),
26       system_component_type(type) {
27   DCHECK_LE(0, system_component_type);
28 }
29
30 NotifierId::NotifierId()
31     : type(SYSTEM_COMPONENT),
32       system_component_type(-1) {
33 }
34
35 bool NotifierId::operator==(const NotifierId& other) const {
36   if (type != other.type)
37     return false;
38
39   switch (type) {
40     case WEB_PAGE:
41       return url == other.url;
42     case SYSTEM_COMPONENT:
43       return system_component_type == other.system_component_type;
44     case APPLICATION:
45     case SYNCED_NOTIFICATION_SERVICE:
46       return id == other.id;
47   }
48
49   NOTREACHED();
50   return false;
51 }
52
53 Notifier::Notifier(const NotifierId& notifier_id,
54                    const string16& name,
55                    bool enabled)
56     : notifier_id(notifier_id),
57       name(name),
58       enabled(enabled) {
59 }
60
61 Notifier::~Notifier() {
62 }
63
64 NotifierGroup::NotifierGroup(const gfx::Image& icon,
65                              const string16& name,
66                              const string16& login_info,
67                              size_t index)
68     : icon(icon), name(name), login_info(login_info), index(index) {}
69
70 NotifierGroup::~NotifierGroup() {}
71
72 }  // namespace message_center