Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / chromeos / profiles / avatar_menu_chromeos.cc
blob23dacb7e0ecd795815843bea6ccc5ab124c4d0cc
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.
5 #include "chrome/browser/profiles/avatar_menu.h"
7 #include <string>
9 #include "chrome/browser/chromeos/login/user_manager.h"
10 #include "chrome/browser/chromeos/profiles/profile_helper.h"
11 #include "chrome/browser/profiles/profile_manager.h"
13 // static
14 void AvatarMenu::GetImageForMenuButton(Profile* profile,
15 gfx::Image* image,
16 bool* is_rectangle) {
17 // Find the user for this profile.
18 std::string user_id_hash =
19 chromeos::ProfileHelper::GetUserIdHashFromProfile(profile);
20 chromeos::UserList users = chromeos::UserManager::Get()->GetLoggedInUsers();
22 for (chromeos::UserList::const_iterator it = users.begin();
23 it != users.end(); ++it) {
24 if ((*it)->username_hash() == user_id_hash) {
25 *image = gfx::Image((*it)->image());
26 break;
30 // ChromeOS user images are rectangular, unlike Chrome profile avatars.
31 *is_rectangle = true;