1 // Copyright 2014 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 "chrome/browser/ui/ash/stub_user_accounts_delegate.h" 6 7 #include <cctype> 8 9 #include "base/logging.h" 10 11 StubUserAccountsDelegate::StubUserAccountsDelegate(const std::string& owner_id) 12 : primary_account_(owner_id) {} 13 14 StubUserAccountsDelegate::~StubUserAccountsDelegate() {} 15 16 std::string StubUserAccountsDelegate::GetPrimaryAccountId() { 17 return primary_account_; 18 } 19 20 std::vector<std::string> StubUserAccountsDelegate::GetSecondaryAccountIds() { 21 return secondary_accounts_; 22 } 23 24 std::string StubUserAccountsDelegate::GetAccountDisplayName( 25 const std::string& account_id) { 26 std::string res(1, std::toupper(account_id[0])); 27 res += account_id.substr(1); 28 return res; 29 } 30 31 void StubUserAccountsDelegate::DeleteAccount(const std::string& account_id) { 32 secondary_accounts_.erase( 33 std::remove( 34 secondary_accounts_.begin(), secondary_accounts_.end(), account_id), 35 secondary_accounts_.end()); 36 NotifyAccountListChanged(); 37 } 38 39 void StubUserAccountsDelegate::AddAccount(const std::string& account_id) { 40 if (primary_account_ == account_id) 41 return; 42 if (std::find(secondary_accounts_.begin(), 43 secondary_accounts_.end(), 44 account_id) != secondary_accounts_.end()) 45 return; 46 secondary_accounts_.push_back(account_id); 47 NotifyAccountListChanged(); 48 } 49 50 void StubUserAccountsDelegate::LaunchAddAccountDialog() { 51 NOTIMPLEMENTED(); 52 } 53