Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(309)

Side by Side Diff: chrome/browser/ui/ash/session_util.cc

Issue 2910773002: cros: CustomFrameViewAsh avatar icon from a window prop (Closed)
Patch Set: add test Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/ash/session_util.h ('k') | ui/aura/client/aura_constants.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/ash/session_util.h" 5 #include "chrome/browser/ui/ash/session_util.h"
6 6
7 #include "ash/content/shell_content_state.h" 7 #include "ash/content/shell_content_state.h"
8 #include "ash/resources/grit/ash_resources.h" 8 #include "ash/resources/grit/ash_resources.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/browser/chromeos/profiles/profile_helper.h" 10 #include "chrome/browser/chromeos/profiles/profile_helper.h"
(...skipping 26 matching lines...) Expand all
37 if (owner_browser_context && active_browser_context && 37 if (owner_browser_context && active_browser_context &&
38 owner_browser_context != active_browser_context && 38 owner_browser_context != active_browser_context &&
39 shown_browser_context != active_browser_context) { 39 shown_browser_context != active_browser_context) {
40 return false; 40 return false;
41 } 41 }
42 } 42 }
43 return true; 43 return true;
44 } 44 }
45 45
46 gfx::ImageSkia GetAvatarImageForContext(content::BrowserContext* context) { 46 gfx::ImageSkia GetAvatarImageForContext(content::BrowserContext* context) {
47 return GetAvatarImageForUser(chromeos::ProfileHelper::Get()->GetUserByProfile(
48 Profile::FromBrowserContext(context)));
49 }
50
51 gfx::ImageSkia GetAvatarImageForUser(const user_manager::User* user) {
47 static const gfx::ImageSkia* holder = 52 static const gfx::ImageSkia* holder =
48 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 53 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
49 IDR_AVATAR_HOLDER); 54 IDR_AVATAR_HOLDER);
50 static const gfx::ImageSkia* holder_mask = 55 static const gfx::ImageSkia* holder_mask =
51 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 56 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
52 IDR_AVATAR_HOLDER_MASK); 57 IDR_AVATAR_HOLDER_MASK);
53 58
54 gfx::ImageSkia user_image = 59 gfx::ImageSkia user_image = user->GetImage();
55 chromeos::ProfileHelper::Get()
56 ->GetUserByProfile(Profile::FromBrowserContext(context))
57 ->GetImage();
58
59 gfx::ImageSkia resized = gfx::ImageSkiaOperations::CreateResizedImage( 60 gfx::ImageSkia resized = gfx::ImageSkiaOperations::CreateResizedImage(
60 user_image, skia::ImageOperations::RESIZE_BEST, holder->size()); 61 user_image, skia::ImageOperations::RESIZE_BEST, holder->size());
61 gfx::ImageSkia masked = 62 gfx::ImageSkia masked =
62 gfx::ImageSkiaOperations::CreateMaskedImage(resized, *holder_mask); 63 gfx::ImageSkiaOperations::CreateMaskedImage(resized, *holder_mask);
63 return gfx::ImageSkiaOperations::CreateSuperimposedImage(*holder, masked); 64 return gfx::ImageSkiaOperations::CreateSuperimposedImage(*holder, masked);
64 } 65 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/session_util.h ('k') | ui/aura/client/aura_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698