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

Unified Diff: ash/frame/header_view.cc

Issue 2910773002: cros: CustomFrameViewAsh avatar icon from a window prop (Closed)
Patch Set: add test Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/frame/header_view.h ('k') | ash/metrics/user_metrics_recorder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/frame/header_view.cc
diff --git a/ash/frame/header_view.cc b/ash/frame/header_view.cc
index c59c5774b4fe34a00977d05bd1801c147549afc7..85d0537a3409847cbd1877eec2772623b25df57f 100644
--- a/ash/frame/header_view.cc
+++ b/ash/frame/header_view.cc
@@ -6,11 +6,8 @@
#include "ash/frame/caption_buttons/frame_caption_button_container_view.h"
#include "ash/frame/default_header_painter.h"
-#include "ash/session/session_state_delegate.h"
#include "ash/shell.h"
-#include "ash/shell_port.h"
#include "ash/wm_window.h"
-#include "ui/gfx/canvas.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/widget/widget.h"
@@ -29,7 +26,6 @@ HeaderView::HeaderView(views::Widget* target_widget,
AddChildView(caption_button_container_);
header_painter_->Init(target_widget_, this, caption_button_container_);
- UpdateAvatarIcon();
Shell::Get()->AddShellObserver(this);
}
@@ -65,23 +61,20 @@ int HeaderView::GetMinimumWidth() const {
return header_painter_->GetMinimumHeaderWidth();
}
-void HeaderView::UpdateAvatarIcon() {
- SessionStateDelegate* delegate = ShellPort::Get()->GetSessionStateDelegate();
- WmWindow* window = WmWindow::Get(target_widget_->GetNativeWindow());
- bool show = delegate->ShouldShowAvatar(window);
+void HeaderView::SetAvatarIcon(const gfx::ImageSkia& avatar) {
+ const bool show = !avatar.isNull();
if (!show) {
if (!avatar_icon_)
return;
delete avatar_icon_;
avatar_icon_ = nullptr;
} else {
- gfx::ImageSkia image = delegate->GetAvatarImageForWindow(window);
- DCHECK_EQ(image.width(), image.height());
+ DCHECK_EQ(avatar.width(), avatar.height());
if (!avatar_icon_) {
avatar_icon_ = new views::ImageView();
AddChildView(avatar_icon_);
}
- avatar_icon_->SetImage(image);
+ avatar_icon_->SetImage(avatar);
}
header_painter_->UpdateLeftHeaderView(avatar_icon_);
Layout();
« no previous file with comments | « ash/frame/header_view.h ('k') | ash/metrics/user_metrics_recorder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698