1// Copyright 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 "chrome/browser/chromeos/profiles/avatar_menu_actions_chromeos.h"
6
7#include "ash/multi_profile_uma.h"
8#include "ash/shell.h"
9#include "ash/system/tray/system_tray_delegate.h"
10#include "chrome/browser/profiles/profile.h"
11#include "chrome/browser/profiles/profile_avatar_icon_util.h"
12#include "chrome/browser/ui/browser.h"
13#include "components/user_manager/user_manager.h"
14
15// static
16AvatarMenuActions* AvatarMenuActions::Create() {
17  return new chromeos::AvatarMenuActionsChromeOS();
18}
19
20namespace chromeos {
21
22AvatarMenuActionsChromeOS::AvatarMenuActionsChromeOS() {
23}
24
25AvatarMenuActionsChromeOS::~AvatarMenuActionsChromeOS() {
26}
27
28void AvatarMenuActionsChromeOS::AddNewProfile(ProfileMetrics::ProfileAdd type) {
29  // Let the user add another account to the session.
30  ash::MultiProfileUMA::RecordSigninUser(
31      ash::MultiProfileUMA::SIGNIN_USER_BY_BROWSER_FRAME);
32  ash::Shell::GetInstance()->system_tray_delegate()->ShowUserLogin();
33}
34
35void AvatarMenuActionsChromeOS::EditProfile(Profile* profile, size_t index) {
36  NOTIMPLEMENTED();
37}
38
39bool AvatarMenuActionsChromeOS::ShouldShowAddNewProfileLink() const {
40  // |browser_| can be NULL in unit_tests.
41  return (!browser_ || !browser_->profile()->IsSupervised()) &&
42         user_manager::UserManager::Get()
43             ->GetUsersAdmittedForMultiProfile()
44             .size();
45}
46
47bool AvatarMenuActionsChromeOS::ShouldShowEditProfileLink() const {
48  return false;
49}
50
51void AvatarMenuActionsChromeOS::ActiveBrowserChanged(Browser* browser) {
52  browser_ = browser;
53}
54
55}  // namespace chromeos
56