| 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_shell.h" | 10 #include "ash/common/wm_shell.h" |
| 11 #include "ash/common/wm_window.h" | 11 #include "ash/common/wm_window.h" |
| 12 #include "ash/shell.h" |
| 12 #include "ui/gfx/canvas.h" | 13 #include "ui/gfx/canvas.h" |
| 13 #include "ui/views/controls/image_view.h" | 14 #include "ui/views/controls/image_view.h" |
| 14 #include "ui/views/widget/widget.h" | 15 #include "ui/views/widget/widget.h" |
| 15 | 16 |
| 16 namespace ash { | 17 namespace ash { |
| 17 | 18 |
| 18 HeaderView::HeaderView(views::Widget* target_widget, | 19 HeaderView::HeaderView(views::Widget* target_widget, |
| 19 mojom::WindowStyle window_style) | 20 mojom::WindowStyle window_style) |
| 20 : target_widget_(target_widget), | 21 : target_widget_(target_widget), |
| 21 header_painter_(base::MakeUnique<DefaultHeaderPainter>(window_style)), | 22 header_painter_(base::MakeUnique<DefaultHeaderPainter>(window_style)), |
| 22 avatar_icon_(nullptr), | 23 avatar_icon_(nullptr), |
| 23 caption_button_container_(nullptr), | 24 caption_button_container_(nullptr), |
| 24 fullscreen_visible_fraction_(0) { | 25 fullscreen_visible_fraction_(0) { |
| 25 caption_button_container_ = | 26 caption_button_container_ = |
| 26 new FrameCaptionButtonContainerView(target_widget_); | 27 new FrameCaptionButtonContainerView(target_widget_); |
| 27 caption_button_container_->UpdateSizeButtonVisibility(); | 28 caption_button_container_->UpdateSizeButtonVisibility(); |
| 28 AddChildView(caption_button_container_); | 29 AddChildView(caption_button_container_); |
| 29 | 30 |
| 30 header_painter_->Init(target_widget_, this, caption_button_container_); | 31 header_painter_->Init(target_widget_, this, caption_button_container_); |
| 31 UpdateAvatarIcon(); | 32 UpdateAvatarIcon(); |
| 32 | 33 |
| 33 WmShell::Get()->AddShellObserver(this); | 34 Shell::GetInstance()->AddShellObserver(this); |
| 34 } | 35 } |
| 35 | 36 |
| 36 HeaderView::~HeaderView() { | 37 HeaderView::~HeaderView() { |
| 37 WmShell::Get()->RemoveShellObserver(this); | 38 Shell::GetInstance()->RemoveShellObserver(this); |
| 38 } | 39 } |
| 39 | 40 |
| 40 void HeaderView::SchedulePaintForTitle() { | 41 void HeaderView::SchedulePaintForTitle() { |
| 41 header_painter_->SchedulePaintForTitle(); | 42 header_painter_->SchedulePaintForTitle(); |
| 42 } | 43 } |
| 43 | 44 |
| 44 void HeaderView::ResetWindowControls() { | 45 void HeaderView::ResetWindowControls() { |
| 45 caption_button_container_->ResetWindowControls(); | 46 caption_button_container_->ResetWindowControls(); |
| 46 } | 47 } |
| 47 | 48 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 gfx::Rect visible_bounds(GetVisibleBounds()); | 194 gfx::Rect visible_bounds(GetVisibleBounds()); |
| 194 gfx::Point visible_origin_in_screen(visible_bounds.origin()); | 195 gfx::Point visible_origin_in_screen(visible_bounds.origin()); |
| 195 views::View::ConvertPointToScreen(this, &visible_origin_in_screen); | 196 views::View::ConvertPointToScreen(this, &visible_origin_in_screen); |
| 196 std::vector<gfx::Rect> bounds_in_screen; | 197 std::vector<gfx::Rect> bounds_in_screen; |
| 197 bounds_in_screen.push_back( | 198 bounds_in_screen.push_back( |
| 198 gfx::Rect(visible_origin_in_screen, visible_bounds.size())); | 199 gfx::Rect(visible_origin_in_screen, visible_bounds.size())); |
| 199 return bounds_in_screen; | 200 return bounds_in_screen; |
| 200 } | 201 } |
| 201 | 202 |
| 202 } // namespace ash | 203 } // namespace ash |
| OLD | NEW |