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