blob: f593ed9820f3dc9a67ded9f527541996bb301ecc (
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
// Copyright (c) 2013 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 "ui/message_center/fake_notifier_settings_provider.h"
#include "base/strings/utf_string_conversions.h"
#include "ui/gfx/image/image.h"
namespace message_center {
FakeNotifierSettingsProvider::NotifierGroupItem::NotifierGroupItem() {
}
FakeNotifierSettingsProvider::NotifierGroupItem::~NotifierGroupItem() {
}
FakeNotifierSettingsProvider::FakeNotifierSettingsProvider()
: closed_called_count_(0),
active_item_index_(0) {
}
FakeNotifierSettingsProvider::FakeNotifierSettingsProvider(
const std::vector<Notifier*>& notifiers)
: closed_called_count_(0),
active_item_index_(0) {
NotifierGroupItem item;
item.group = new NotifierGroup(gfx::Image(),
UTF8ToUTF16("Fake name"),
UTF8ToUTF16("fake@email.com"),
true);
item.notifiers = notifiers;
items_.push_back(item);
}
FakeNotifierSettingsProvider::~FakeNotifierSettingsProvider() {
for (size_t i = 0; i < items_.size(); ++i) {
delete items_[i].group;
}
}
size_t FakeNotifierSettingsProvider::GetNotifierGroupCount() const {
return items_.size();
}
const message_center::NotifierGroup&
FakeNotifierSettingsProvider::GetNotifierGroupAt(size_t index) const {
return *(items_[index].group);
}
bool FakeNotifierSettingsProvider::IsNotifierGroupActiveAt(
size_t index) const {
return active_item_index_ == index;
}
void FakeNotifierSettingsProvider::SwitchToNotifierGroup(size_t index) {
active_item_index_ = index;
}
const message_center::NotifierGroup&
FakeNotifierSettingsProvider::GetActiveNotifierGroup() const {
return *(items_[active_item_index_].group);
}
void FakeNotifierSettingsProvider::GetNotifierList(
std::vector<Notifier*>* notifiers) {
notifiers->clear();
for (size_t i = 0; i < items_[active_item_index_].notifiers.size(); ++i)
notifiers->push_back(items_[active_item_index_].notifiers[i]);
}
void FakeNotifierSettingsProvider::SetNotifierEnabled(const Notifier& notifier,
bool enabled) {
enabled_[¬ifier] = enabled;
}
void FakeNotifierSettingsProvider::OnNotifierSettingsClosing() {
closed_called_count_++;
}
void FakeNotifierSettingsProvider::AddObserver(
NotifierSettingsObserver* observer) {
}
void FakeNotifierSettingsProvider::RemoveObserver(
NotifierSettingsObserver* observer) {
}
bool FakeNotifierSettingsProvider::WasEnabled(const Notifier& notifier) {
return enabled_[¬ifier];
}
void FakeNotifierSettingsProvider::AddGroup(
NotifierGroup* group, const std::vector<Notifier*>& notifiers) {
NotifierGroupItem item;
item.group = group;
item.notifiers = notifiers;
items_.push_back(item);
}
int FakeNotifierSettingsProvider::closed_called_count() {
return closed_called_count_;
}
} // namespace message_center
|