blob: 6857f8a025a1fe295f9c612230e9a5bb2bbdb61b (
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
|
// Copyright 2014 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 "chrome/browser/ui/ash/stub_user_accounts_delegate.h"
#include <cctype>
#include "base/logging.h"
StubUserAccountsDelegate::StubUserAccountsDelegate(const std::string& owner_id)
: primary_account_(owner_id) {}
StubUserAccountsDelegate::~StubUserAccountsDelegate() {}
std::string StubUserAccountsDelegate::GetPrimaryAccount() {
return primary_account_;
}
std::vector<std::string> StubUserAccountsDelegate::GetSecondaryAccountsList() {
return secondary_accounts_;
}
std::string StubUserAccountsDelegate::GetAccountDisplayName(
const std::string& account_id) {
std::string res(1, std::toupper(account_id[0]));
res += account_id.substr(1);
return res;
}
void StubUserAccountsDelegate::DeleteAccount(const std::string& account_id) {
secondary_accounts_.erase(
std::remove(
secondary_accounts_.begin(), secondary_accounts_.end(), account_id),
secondary_accounts_.end());
NotifyAccountListChanged();
}
void StubUserAccountsDelegate::AddAccount(const std::string& account_id) {
if (primary_account_ == account_id)
return;
if (std::find(secondary_accounts_.begin(),
secondary_accounts_.end(),
account_id) != secondary_accounts_.end())
return;
secondary_accounts_.push_back(account_id);
NotifyAccountListChanged();
}
void StubUserAccountsDelegate::LaunchAddAccountDialog() {
NOTIMPLEMENTED();
}
|