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