| Index: ash/frame/header_painter.cc
|
| diff --git a/ash/frame/header_painter.cc b/ash/frame/header_painter.cc
|
| index 6e18d95de6b28edd8fc1af0d26b47e7da9e6e209..31063357a97746cdfcbceabb3cb220d9fdd28855 100644
|
| --- a/ash/frame/header_painter.cc
|
| +++ b/ash/frame/header_painter.cc
|
| @@ -143,6 +143,7 @@ HeaderPainter::HeaderPainter()
|
| : frame_(NULL),
|
| header_view_(NULL),
|
| window_icon_(NULL),
|
| + avatar_icon_(NULL),
|
| caption_button_container_(NULL),
|
| header_height_(0),
|
| previous_theme_frame_id_(0),
|
| @@ -170,6 +171,10 @@ void HeaderPainter::Init(
|
| caption_button_container_ = caption_button_container;
|
| }
|
|
|
| +void HeaderPainter::UpdateAvatarIcon(views::View* avatar_icon) {
|
| + avatar_icon_ = avatar_icon;
|
| +}
|
| +
|
| // static
|
| gfx::Rect HeaderPainter::GetBoundsForClientView(
|
| int header_height,
|
| @@ -363,12 +368,20 @@ void HeaderPainter::LayoutHeader() {
|
| caption_button_container_size.width(),
|
| caption_button_container_size.height());
|
|
|
| + if (avatar_icon_) {
|
| + int icon_offset_y =
|
| + GetCaptionButtonContainerCenterY() - avatar_icon_->height() / 2;
|
| + avatar_icon_->SetBounds(kIconOffsetX, icon_offset_y,
|
| + avatar_icon_->width(), avatar_icon_->height());
|
| + }
|
| +
|
| if (window_icon_) {
|
| // Vertically center the window icon with respect to the caption button
|
| // container.
|
| int icon_offset_y =
|
| GetCaptionButtonContainerCenterY() - window_icon_->height() / 2;
|
| - window_icon_->SetBounds(kIconOffsetX, icon_offset_y, kIconSize, kIconSize);
|
| + window_icon_->SetBounds(GetWindowIconOffsetX(), icon_offset_y,
|
| + kIconSize, kIconSize);
|
| }
|
| }
|
|
|
| @@ -592,11 +605,16 @@ gfx::Rect HeaderPainter::GetHeaderLocalBounds() const {
|
| }
|
|
|
| int HeaderPainter::GetTitleOffsetX() const {
|
| - return window_icon_ ?
|
| - window_icon_->bounds().right() + kTitleIconOffsetX :
|
| + views::View* left = window_icon_ ? window_icon_ : avatar_icon_;
|
| + return left ? left->bounds().right() + kTitleIconOffsetX :
|
| kTitleNoIconOffsetX;
|
| }
|
|
|
| +int HeaderPainter::GetWindowIconOffsetX() const {
|
| + return avatar_icon_ ?
|
| + avatar_icon_->bounds().right() + kIconOffsetX : kIconOffsetX;
|
| +}
|
| +
|
| int HeaderPainter::GetCaptionButtonContainerCenterY() const {
|
| return caption_button_container_->y() +
|
| caption_button_container_->height() / 2;
|
|
|