summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/profiles/avatar_menu_actions_chromeos.cc
blob: 2dc84fd70048cc38c06b326ec188d339ece89b89 (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 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 "chrome/browser/chromeos/profiles/avatar_menu_actions_chromeos.h"

#include "ash/multi_profile_uma.h"
#include "ash/shell.h"
#include "ash/system/tray/system_tray_delegate.h"
#include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/profiles/profile_info_util.h"
#include "chrome/browser/ui/browser.h"

// static
AvatarMenuActions* AvatarMenuActions::Create() {
  return new chromeos::AvatarMenuActionsChromeOS();
}

namespace chromeos {

AvatarMenuActionsChromeOS::AvatarMenuActionsChromeOS() {
}

AvatarMenuActionsChromeOS::~AvatarMenuActionsChromeOS() {
}

void AvatarMenuActionsChromeOS::AddNewProfile(ProfileMetrics::ProfileAdd type) {
  // Let the user add another account to the session.
  ash::MultiProfileUMA::RecordSigninUser(
      ash::MultiProfileUMA::SIGNIN_USER_BY_BROWSER_FRAME);
  ash::Shell::GetInstance()->system_tray_delegate()->ShowUserLogin();
}

void AvatarMenuActionsChromeOS::EditProfile(Profile* profile, size_t index) {
  NOTIMPLEMENTED();
}

bool AvatarMenuActionsChromeOS::ShouldShowAddNewProfileLink() const {
  // |browser_| can be NULL in unit_tests.
  return (!browser_ || !browser_->profile()->IsManaged()) &&
      UserManager::Get()->GetUsersAdmittedForMultiProfile().size();
}

bool AvatarMenuActionsChromeOS::ShouldShowEditProfileLink() const {
  return false;
}

void AvatarMenuActionsChromeOS::ActiveBrowserChanged(Browser* browser) {
  browser_ = browser;
}

}  // namespace chromeos