| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ash/common/frame/header_view.h" | 5 #include "ash/common/frame/header_view.h" |
| 6 | 6 |
| 7 #include "ash/common/frame/caption_buttons/frame_caption_button_container_view.h
" | 7 #include "ash/common/frame/caption_buttons/frame_caption_button_container_view.h
" |
| 8 #include "ash/common/frame/default_header_painter.h" | 8 #include "ash/common/frame/default_header_painter.h" |
| 9 #include "ash/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
| 10 #include "ash/common/wm_lookup.h" | |
| 11 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
| 11 #include "ash/common/wm_window.h" |
| 12 #include "ui/gfx/canvas.h" | 12 #include "ui/gfx/canvas.h" |
| 13 #include "ui/views/controls/image_view.h" | 13 #include "ui/views/controls/image_view.h" |
| 14 #include "ui/views/widget/widget.h" | 14 #include "ui/views/widget/widget.h" |
| 15 | 15 |
| 16 namespace ash { | 16 namespace ash { |
| 17 | 17 |
| 18 HeaderView::HeaderView(views::Widget* target_widget) | 18 HeaderView::HeaderView(views::Widget* target_widget) |
| 19 : target_widget_(target_widget), | 19 : target_widget_(target_widget), |
| 20 header_painter_(new DefaultHeaderPainter), | 20 header_painter_(new DefaultHeaderPainter), |
| 21 avatar_icon_(nullptr), | 21 avatar_icon_(nullptr), |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 Layout(); | 58 Layout(); |
| 59 return header_painter_->GetHeaderHeightForPainting(); | 59 return header_painter_->GetHeaderHeightForPainting(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 int HeaderView::GetMinimumWidth() const { | 62 int HeaderView::GetMinimumWidth() const { |
| 63 return header_painter_->GetMinimumHeaderWidth(); | 63 return header_painter_->GetMinimumHeaderWidth(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void HeaderView::UpdateAvatarIcon() { | 66 void HeaderView::UpdateAvatarIcon() { |
| 67 SessionStateDelegate* delegate = WmShell::Get()->GetSessionStateDelegate(); | 67 SessionStateDelegate* delegate = WmShell::Get()->GetSessionStateDelegate(); |
| 68 WmWindow* window = WmLookup::Get()->GetWindowForWidget(target_widget_); | 68 WmWindow* window = WmWindow::Get(target_widget_->GetNativeWindow()); |
| 69 bool show = delegate->ShouldShowAvatar(window); | 69 bool show = delegate->ShouldShowAvatar(window); |
| 70 if (!show) { | 70 if (!show) { |
| 71 if (!avatar_icon_) | 71 if (!avatar_icon_) |
| 72 return; | 72 return; |
| 73 delete avatar_icon_; | 73 delete avatar_icon_; |
| 74 avatar_icon_ = nullptr; | 74 avatar_icon_ = nullptr; |
| 75 } else { | 75 } else { |
| 76 gfx::ImageSkia image = delegate->GetAvatarImageForWindow(window); | 76 gfx::ImageSkia image = delegate->GetAvatarImageForWindow(window); |
| 77 DCHECK_EQ(image.width(), image.height()); | 77 DCHECK_EQ(image.width(), image.height()); |
| 78 if (!avatar_icon_) { | 78 if (!avatar_icon_) { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 gfx::Rect visible_bounds(GetVisibleBounds()); | 192 gfx::Rect visible_bounds(GetVisibleBounds()); |
| 193 gfx::Point visible_origin_in_screen(visible_bounds.origin()); | 193 gfx::Point visible_origin_in_screen(visible_bounds.origin()); |
| 194 views::View::ConvertPointToScreen(this, &visible_origin_in_screen); | 194 views::View::ConvertPointToScreen(this, &visible_origin_in_screen); |
| 195 std::vector<gfx::Rect> bounds_in_screen; | 195 std::vector<gfx::Rect> bounds_in_screen; |
| 196 bounds_in_screen.push_back( | 196 bounds_in_screen.push_back( |
| 197 gfx::Rect(visible_origin_in_screen, visible_bounds.size())); | 197 gfx::Rect(visible_origin_in_screen, visible_bounds.size())); |
| 198 return bounds_in_screen; | 198 return bounds_in_screen; |
| 199 } | 199 } |
| 200 | 200 |
| 201 } // namespace ash | 201 } // namespace ash |
| OLD | NEW |