| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/custom_frame_view_ash.h" | 5 #include "ash/common/frame/custom_frame_view_ash.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/aura/wm_window_aura.h" | |
| 11 #include "ash/common/ash_switches.h" | 10 #include "ash/common/ash_switches.h" |
| 12 #include "ash/common/frame/caption_buttons/frame_caption_button_container_view.h
" | 11 #include "ash/common/frame/caption_buttons/frame_caption_button_container_view.h
" |
| 13 #include "ash/common/frame/default_header_painter.h" | 12 #include "ash/common/frame/default_header_painter.h" |
| 14 #include "ash/common/frame/frame_border_hit_test.h" | 13 #include "ash/common/frame/frame_border_hit_test.h" |
| 15 #include "ash/common/frame/header_painter.h" | 14 #include "ash/common/frame/header_painter.h" |
| 16 #include "ash/common/material_design/material_design_controller.h" | 15 #include "ash/common/material_design/material_design_controller.h" |
| 17 #include "ash/common/session/session_state_delegate.h" | 16 #include "ash/common/session/session_state_delegate.h" |
| 18 #include "ash/common/shell_observer.h" | 17 #include "ash/common/shell_observer.h" |
| 18 #include "ash/common/wm/immersive/wm_immersive_fullscreen_controller.h" |
| 19 #include "ash/common/wm/immersive/wm_immersive_fullscreen_controller_delegate.h" |
| 19 #include "ash/common/wm/window_state.h" | 20 #include "ash/common/wm/window_state.h" |
| 20 #include "ash/common/wm/window_state_delegate.h" | 21 #include "ash/common/wm/window_state_delegate.h" |
| 21 #include "ash/common/wm/window_state_observer.h" | 22 #include "ash/common/wm/window_state_observer.h" |
| 22 #include "ash/common/wm_lookup.h" | 23 #include "ash/common/wm_lookup.h" |
| 23 #include "ash/common/wm_shell.h" | 24 #include "ash/common/wm_shell.h" |
| 24 #include "ash/frame/frame_border_hit_test_controller.h" | 25 #include "ash/common/wm_window.h" |
| 25 #include "ash/wm/immersive_fullscreen_controller.h" | 26 #include "ash/common/wm_window_observer.h" |
| 26 #include "ash/wm/window_state_aura.h" | 27 #include "ash/common/wm_window_property.h" |
| 27 #include "base/command_line.h" | |
| 28 #include "ui/aura/client/aura_constants.h" | |
| 29 #include "ui/aura/window.h" | |
| 30 #include "ui/aura/window_observer.h" | |
| 31 #include "ui/gfx/canvas.h" | 28 #include "ui/gfx/canvas.h" |
| 32 #include "ui/gfx/geometry/rect.h" | 29 #include "ui/gfx/geometry/rect.h" |
| 33 #include "ui/gfx/geometry/rect_conversions.h" | 30 #include "ui/gfx/geometry/rect_conversions.h" |
| 34 #include "ui/gfx/geometry/size.h" | 31 #include "ui/gfx/geometry/size.h" |
| 35 #include "ui/gfx/image/image.h" | 32 #include "ui/gfx/image/image.h" |
| 36 #include "ui/views/controls/image_view.h" | 33 #include "ui/views/controls/image_view.h" |
| 37 #include "ui/views/view.h" | 34 #include "ui/views/view.h" |
| 38 #include "ui/views/view_targeter.h" | 35 #include "ui/views/view_targeter.h" |
| 39 #include "ui/views/widget/widget.h" | 36 #include "ui/views/widget/widget.h" |
| 40 #include "ui/views/widget/widget_delegate.h" | 37 #include "ui/views/widget/widget_delegate.h" |
| 41 | 38 |
| 39 namespace ash { |
| 40 |
| 42 namespace { | 41 namespace { |
| 43 | 42 |
| 44 /////////////////////////////////////////////////////////////////////////////// | 43 /////////////////////////////////////////////////////////////////////////////// |
| 45 // CustomFrameViewAshWindowStateDelegate | 44 // CustomFrameViewAshWindowStateDelegate |
| 46 | 45 |
| 47 // Handles a user's fullscreen request (Shift+F4/F4). Puts the window into | 46 // Handles a user's fullscreen request (Shift+F4/F4). Puts the window into |
| 48 // immersive fullscreen if immersive fullscreen is enabled for non-browser | 47 // immersive fullscreen if immersive fullscreen is enabled for non-browser |
| 49 // windows. | 48 // windows. |
| 50 class CustomFrameViewAshWindowStateDelegate | 49 class CustomFrameViewAshWindowStateDelegate : public wm::WindowStateDelegate, |
| 51 : public ash::wm::WindowStateDelegate, | 50 public wm::WindowStateObserver, |
| 52 public ash::wm::WindowStateObserver, | 51 public WmWindowObserver { |
| 53 public aura::WindowObserver { | |
| 54 public: | 52 public: |
| 55 CustomFrameViewAshWindowStateDelegate( | 53 CustomFrameViewAshWindowStateDelegate(wm::WindowState* window_state, |
| 56 ash::wm::WindowState* window_state, | 54 CustomFrameViewAsh* custom_frame_view) |
| 57 ash::CustomFrameViewAsh* custom_frame_view) | 55 : window_state_(nullptr) { |
| 58 : window_state_(NULL) { | 56 immersive_fullscreen_controller_ = |
| 59 immersive_fullscreen_controller_.reset( | 57 WmShell::Get()->CreateImmersiveFullscreenController(); |
| 60 new ash::ImmersiveFullscreenController); | 58 if (immersive_fullscreen_controller_) { |
| 61 custom_frame_view->InitImmersiveFullscreenControllerForView( | 59 custom_frame_view->InitImmersiveFullscreenControllerForView( |
| 62 immersive_fullscreen_controller_.get()); | 60 immersive_fullscreen_controller_.get()); |
| 61 } |
| 63 | 62 |
| 64 // Add a window state observer to exit fullscreen properly in case | 63 // Add a window state observer to exit fullscreen properly in case |
| 65 // fullscreen is exited without going through | 64 // fullscreen is exited without going through |
| 66 // WindowState::ToggleFullscreen(). This is the case when exiting | 65 // WindowState::ToggleFullscreen(). This is the case when exiting |
| 67 // immersive fullscreen via the "Restore" window control. | 66 // immersive fullscreen via the "Restore" window control. |
| 68 // TODO(pkotwicz): This is a hack. Remove ASAP. http://crbug.com/319048 | 67 // TODO(pkotwicz): This is a hack. Remove ASAP. http://crbug.com/319048 |
| 69 window_state_ = window_state; | 68 window_state_ = window_state; |
| 70 window_state_->AddObserver(this); | 69 window_state_->AddObserver(this); |
| 71 GetAuraWindow()->AddObserver(this); | 70 window_state_->window()->AddObserver(this); |
| 72 } | 71 } |
| 73 ~CustomFrameViewAshWindowStateDelegate() override { | 72 ~CustomFrameViewAshWindowStateDelegate() override { |
| 74 if (window_state_) { | 73 if (window_state_) { |
| 75 window_state_->RemoveObserver(this); | 74 window_state_->RemoveObserver(this); |
| 76 GetAuraWindow()->RemoveObserver(this); | 75 window_state_->window()->RemoveObserver(this); |
| 77 } | 76 } |
| 78 } | 77 } |
| 79 | 78 |
| 80 private: | 79 private: |
| 81 aura::Window* GetAuraWindow() { | 80 // Overridden from wm::WindowStateDelegate: |
| 82 return ash::WmWindowAura::GetAuraWindow(window_state_->window()); | 81 bool ToggleFullscreen(wm::WindowState* window_state) override { |
| 83 } | |
| 84 | |
| 85 // Overridden from ash::wm::WindowStateDelegate: | |
| 86 bool ToggleFullscreen(ash::wm::WindowState* window_state) override { | |
| 87 bool enter_fullscreen = !window_state->IsFullscreen(); | 82 bool enter_fullscreen = !window_state->IsFullscreen(); |
| 88 if (enter_fullscreen) { | 83 if (enter_fullscreen) |
| 89 GetAuraWindow()->SetProperty(aura::client::kShowStateKey, | 84 window_state_->window()->SetShowState(ui::SHOW_STATE_FULLSCREEN); |
| 90 ui::SHOW_STATE_FULLSCREEN); | 85 else |
| 91 } else { | |
| 92 window_state->Restore(); | 86 window_state->Restore(); |
| 93 } | |
| 94 if (immersive_fullscreen_controller_) { | 87 if (immersive_fullscreen_controller_) { |
| 95 immersive_fullscreen_controller_->SetEnabled( | 88 immersive_fullscreen_controller_->SetEnabled( |
| 96 ash::ImmersiveFullscreenController::WINDOW_TYPE_OTHER, | 89 WmImmersiveFullscreenController::WINDOW_TYPE_OTHER, enter_fullscreen); |
| 97 enter_fullscreen); | |
| 98 } | 90 } |
| 99 return true; | 91 return true; |
| 100 } | 92 } |
| 101 // Overridden from aura::WindowObserver: | 93 // Overridden from WmWindowObserver: |
| 102 void OnWindowDestroying(aura::Window* window) override { | 94 void OnWindowDestroying(WmWindow* window) override { |
| 103 window_state_->RemoveObserver(this); | 95 window_state_->RemoveObserver(this); |
| 104 GetAuraWindow()->RemoveObserver(this); | 96 window->RemoveObserver(this); |
| 105 window_state_ = NULL; | 97 window_state_ = nullptr; |
| 106 } | 98 } |
| 107 // Overridden from ash::wm::WindowStateObserver: | 99 // Overridden from wm::WindowStateObserver: |
| 108 void OnPostWindowStateTypeChange(ash::wm::WindowState* window_state, | 100 void OnPostWindowStateTypeChange(wm::WindowState* window_state, |
| 109 ash::wm::WindowStateType old_type) override { | 101 wm::WindowStateType old_type) override { |
| 110 if (!window_state->IsFullscreen() && !window_state->IsMinimized() && | 102 if (!window_state->IsFullscreen() && !window_state->IsMinimized() && |
| 111 immersive_fullscreen_controller_.get() && | 103 immersive_fullscreen_controller_ && |
| 112 immersive_fullscreen_controller_->IsEnabled()) { | 104 immersive_fullscreen_controller_->IsEnabled()) { |
| 113 immersive_fullscreen_controller_->SetEnabled( | 105 immersive_fullscreen_controller_->SetEnabled( |
| 114 ash::ImmersiveFullscreenController::WINDOW_TYPE_OTHER, false); | 106 WmImmersiveFullscreenController::WINDOW_TYPE_OTHER, false); |
| 115 } | 107 } |
| 116 } | 108 } |
| 117 | 109 |
| 118 ash::wm::WindowState* window_state_; | 110 wm::WindowState* window_state_; |
| 119 std::unique_ptr<ash::ImmersiveFullscreenController> | 111 std::unique_ptr<WmImmersiveFullscreenController> |
| 120 immersive_fullscreen_controller_; | 112 immersive_fullscreen_controller_; |
| 121 | 113 |
| 122 DISALLOW_COPY_AND_ASSIGN(CustomFrameViewAshWindowStateDelegate); | 114 DISALLOW_COPY_AND_ASSIGN(CustomFrameViewAshWindowStateDelegate); |
| 123 }; | 115 }; |
| 124 | 116 |
| 125 } // namespace | 117 } // namespace |
| 126 | 118 |
| 127 namespace ash { | |
| 128 | |
| 129 /////////////////////////////////////////////////////////////////////////////// | 119 /////////////////////////////////////////////////////////////////////////////// |
| 130 // CustomFrameViewAsh::HeaderView | 120 // CustomFrameViewAsh::HeaderView |
| 131 | 121 |
| 132 // View which paints the header. It slides off and on screen in immersive | 122 // View which paints the header. It slides off and on screen in immersive |
| 133 // fullscreen. | 123 // fullscreen. |
| 134 class CustomFrameViewAsh::HeaderView | 124 class CustomFrameViewAsh::HeaderView |
| 135 : public views::View, | 125 : public views::View, |
| 136 public ImmersiveFullscreenController::Delegate, | 126 public WmImmersiveFullscreenControllerDelegate, |
| 137 public ShellObserver { | 127 public ShellObserver { |
| 138 public: | 128 public: |
| 139 // |frame| is the widget that the caption buttons act on. | 129 // |frame| is the widget that the caption buttons act on. |
| 140 explicit HeaderView(views::Widget* frame); | 130 explicit HeaderView(views::Widget* frame); |
| 141 ~HeaderView() override; | 131 ~HeaderView() override; |
| 142 | 132 |
| 143 // Schedules a repaint for the entire title. | 133 // Schedules a repaint for the entire title. |
| 144 void SchedulePaintForTitle(); | 134 void SchedulePaintForTitle(); |
| 145 | 135 |
| 146 // Tells the window controls to reset themselves to the normal state. | 136 // Tells the window controls to reset themselves to the normal state. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 172 void OnMaximizeModeStarted() override; | 162 void OnMaximizeModeStarted() override; |
| 173 void OnMaximizeModeEnded() override; | 163 void OnMaximizeModeEnded() override; |
| 174 | 164 |
| 175 FrameCaptionButtonContainerView* caption_button_container() { | 165 FrameCaptionButtonContainerView* caption_button_container() { |
| 176 return caption_button_container_; | 166 return caption_button_container_; |
| 177 } | 167 } |
| 178 | 168 |
| 179 views::View* avatar_icon() const { return avatar_icon_; } | 169 views::View* avatar_icon() const { return avatar_icon_; } |
| 180 | 170 |
| 181 private: | 171 private: |
| 182 // ImmersiveFullscreenController::Delegate: | 172 // WmImmersiveFullscreenControllerDelegate: |
| 183 void OnImmersiveRevealStarted() override; | 173 void OnImmersiveRevealStarted() override; |
| 184 void OnImmersiveRevealEnded() override; | 174 void OnImmersiveRevealEnded() override; |
| 185 void OnImmersiveFullscreenExited() override; | 175 void OnImmersiveFullscreenExited() override; |
| 186 void SetVisibleFraction(double visible_fraction) override; | 176 void SetVisibleFraction(double visible_fraction) override; |
| 187 std::vector<gfx::Rect> GetVisibleBoundsInScreen() const override; | 177 std::vector<gfx::Rect> GetVisibleBoundsInScreen() const override; |
| 188 | 178 |
| 189 // The widget that the caption buttons act on. | 179 // The widget that the caption buttons act on. |
| 190 views::Widget* frame_; | 180 views::Widget* frame_; |
| 191 | 181 |
| 192 // Helper for painting the header. | 182 // Helper for painting the header. |
| 193 std::unique_ptr<DefaultHeaderPainter> header_painter_; | 183 std::unique_ptr<DefaultHeaderPainter> header_painter_; |
| 194 | 184 |
| 195 views::ImageView* avatar_icon_; | 185 views::ImageView* avatar_icon_; |
| 196 | 186 |
| 197 // View which contains the window caption buttons. | 187 // View which contains the window caption buttons. |
| 198 FrameCaptionButtonContainerView* caption_button_container_; | 188 FrameCaptionButtonContainerView* caption_button_container_; |
| 199 | 189 |
| 200 // The fraction of the header's height which is visible while in fullscreen. | 190 // The fraction of the header's height which is visible while in fullscreen. |
| 201 // This value is meaningless when not in fullscreen. | 191 // This value is meaningless when not in fullscreen. |
| 202 double fullscreen_visible_fraction_; | 192 double fullscreen_visible_fraction_; |
| 203 | 193 |
| 204 DISALLOW_COPY_AND_ASSIGN(HeaderView); | 194 DISALLOW_COPY_AND_ASSIGN(HeaderView); |
| 205 }; | 195 }; |
| 206 | 196 |
| 207 CustomFrameViewAsh::HeaderView::HeaderView(views::Widget* frame) | 197 CustomFrameViewAsh::HeaderView::HeaderView(views::Widget* frame) |
| 208 : frame_(frame), | 198 : frame_(frame), |
| 209 header_painter_(new ash::DefaultHeaderPainter), | 199 header_painter_(new DefaultHeaderPainter), |
| 210 avatar_icon_(NULL), | 200 avatar_icon_(NULL), |
| 211 caption_button_container_(NULL), | 201 caption_button_container_(NULL), |
| 212 fullscreen_visible_fraction_(0) { | 202 fullscreen_visible_fraction_(0) { |
| 213 caption_button_container_ = new FrameCaptionButtonContainerView(frame_); | 203 caption_button_container_ = new FrameCaptionButtonContainerView(frame_); |
| 214 caption_button_container_->UpdateSizeButtonVisibility(); | 204 caption_button_container_->UpdateSizeButtonVisibility(); |
| 215 AddChildView(caption_button_container_); | 205 AddChildView(caption_button_container_); |
| 216 | 206 |
| 217 header_painter_->Init(frame_, this, caption_button_container_); | 207 header_painter_->Init(frame_, this, caption_button_container_); |
| 218 UpdateAvatarIcon(); | 208 UpdateAvatarIcon(); |
| 219 | 209 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 // size changes. | 298 // size changes. |
| 309 if (child != caption_button_container_) | 299 if (child != caption_button_container_) |
| 310 return; | 300 return; |
| 311 parent()->Layout(); | 301 parent()->Layout(); |
| 312 } | 302 } |
| 313 | 303 |
| 314 /////////////////////////////////////////////////////////////////////////////// | 304 /////////////////////////////////////////////////////////////////////////////// |
| 315 // CustomFrameViewAsh::HeaderView, ShellObserver overrides: | 305 // CustomFrameViewAsh::HeaderView, ShellObserver overrides: |
| 316 | 306 |
| 317 void CustomFrameViewAsh::HeaderView::OnOverviewModeStarting() { | 307 void CustomFrameViewAsh::HeaderView::OnOverviewModeStarting() { |
| 318 if (ash::MaterialDesignController::IsOverviewMaterial()) | 308 if (MaterialDesignController::IsOverviewMaterial()) |
| 319 caption_button_container_->SetVisible(false); | 309 caption_button_container_->SetVisible(false); |
| 320 } | 310 } |
| 321 | 311 |
| 322 void CustomFrameViewAsh::HeaderView::OnOverviewModeEnded() { | 312 void CustomFrameViewAsh::HeaderView::OnOverviewModeEnded() { |
| 323 if (ash::MaterialDesignController::IsOverviewMaterial()) | 313 if (MaterialDesignController::IsOverviewMaterial()) |
| 324 caption_button_container_->SetVisible(true); | 314 caption_button_container_->SetVisible(true); |
| 325 } | 315 } |
| 326 | 316 |
| 327 void CustomFrameViewAsh::HeaderView::OnMaximizeModeStarted() { | 317 void CustomFrameViewAsh::HeaderView::OnMaximizeModeStarted() { |
| 328 caption_button_container_->UpdateSizeButtonVisibility(); | 318 caption_button_container_->UpdateSizeButtonVisibility(); |
| 329 parent()->Layout(); | 319 parent()->Layout(); |
| 330 } | 320 } |
| 331 | 321 |
| 332 void CustomFrameViewAsh::HeaderView::OnMaximizeModeEnded() { | 322 void CustomFrameViewAsh::HeaderView::OnMaximizeModeEnded() { |
| 333 caption_button_container_->UpdateSizeButtonVisibility(); | 323 caption_button_container_->UpdateSizeButtonVisibility(); |
| 334 parent()->Layout(); | 324 parent()->Layout(); |
| 335 } | 325 } |
| 336 | 326 |
| 337 /////////////////////////////////////////////////////////////////////////////// | 327 /////////////////////////////////////////////////////////////////////////////// |
| 338 // CustomFrameViewAsh::HeaderView, | 328 // CustomFrameViewAsh::HeaderView, |
| 339 // ImmersiveFullscreenController::Delegate overrides: | 329 // WmImmersiveFullscreenControllerDelegate overrides: |
| 340 | 330 |
| 341 void CustomFrameViewAsh::HeaderView::OnImmersiveRevealStarted() { | 331 void CustomFrameViewAsh::HeaderView::OnImmersiveRevealStarted() { |
| 342 fullscreen_visible_fraction_ = 0; | 332 fullscreen_visible_fraction_ = 0; |
| 343 SetPaintToLayer(true); | 333 SetPaintToLayer(true); |
| 344 layer()->SetFillsBoundsOpaquely(false); | 334 layer()->SetFillsBoundsOpaquely(false); |
| 345 parent()->Layout(); | 335 parent()->Layout(); |
| 346 } | 336 } |
| 347 | 337 |
| 348 void CustomFrameViewAsh::HeaderView::OnImmersiveRevealEnded() { | 338 void CustomFrameViewAsh::HeaderView::OnImmersiveRevealEnded() { |
| 349 fullscreen_visible_fraction_ = 0; | 339 fullscreen_visible_fraction_ = 0; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 return header_view_->HitTestRect(rect); | 431 return header_view_->HitTestRect(rect); |
| 442 } | 432 } |
| 443 | 433 |
| 444 //////////////////////////////////////////////////////////////////////////////// | 434 //////////////////////////////////////////////////////////////////////////////// |
| 445 // CustomFrameViewAsh, public: | 435 // CustomFrameViewAsh, public: |
| 446 | 436 |
| 447 // static | 437 // static |
| 448 const char CustomFrameViewAsh::kViewClassName[] = "CustomFrameViewAsh"; | 438 const char CustomFrameViewAsh::kViewClassName[] = "CustomFrameViewAsh"; |
| 449 | 439 |
| 450 CustomFrameViewAsh::CustomFrameViewAsh(views::Widget* frame) | 440 CustomFrameViewAsh::CustomFrameViewAsh(views::Widget* frame) |
| 451 : frame_(frame), | 441 : frame_(frame), header_view_(new HeaderView(frame)) { |
| 452 header_view_(new HeaderView(frame)), | 442 WmWindow* frame_window = WmLookup::Get()->GetWindowForWidget(frame); |
| 453 frame_border_hit_test_controller_( | 443 frame_window->InstallResizeHandleWindowTargeter(nullptr); |
| 454 new FrameBorderHitTestController(frame_)) { | |
| 455 // |header_view_| is set as the non client view's overlay view so that it can | 444 // |header_view_| is set as the non client view's overlay view so that it can |
| 456 // overlay the web contents in immersive fullscreen. | 445 // overlay the web contents in immersive fullscreen. |
| 457 frame->non_client_view()->SetOverlayView(new OverlayView(header_view_)); | 446 frame->non_client_view()->SetOverlayView(new OverlayView(header_view_)); |
| 458 | 447 |
| 459 // A delegate for a more complex way of fullscreening the window may already | 448 // A delegate for a more complex way of fullscreening the window may already |
| 460 // be set. This is the case for packaged apps. | 449 // be set. This is the case for packaged apps. |
| 461 wm::WindowState* window_state = wm::GetWindowState(frame->GetNativeWindow()); | 450 wm::WindowState* window_state = frame_window->GetWindowState(); |
| 462 if (!window_state->HasDelegate()) { | 451 if (!window_state->HasDelegate()) { |
| 463 window_state->SetDelegate(std::unique_ptr<wm::WindowStateDelegate>( | 452 window_state->SetDelegate(std::unique_ptr<wm::WindowStateDelegate>( |
| 464 new CustomFrameViewAshWindowStateDelegate(window_state, this))); | 453 new CustomFrameViewAshWindowStateDelegate(window_state, this))); |
| 465 } | 454 } |
| 466 } | 455 } |
| 467 | 456 |
| 468 CustomFrameViewAsh::~CustomFrameViewAsh() {} | 457 CustomFrameViewAsh::~CustomFrameViewAsh() {} |
| 469 | 458 |
| 470 void CustomFrameViewAsh::InitImmersiveFullscreenControllerForView( | 459 void CustomFrameViewAsh::InitImmersiveFullscreenControllerForView( |
| 471 ImmersiveFullscreenController* immersive_fullscreen_controller) { | 460 WmImmersiveFullscreenController* immersive_fullscreen_controller) { |
| 472 immersive_fullscreen_controller->Init(header_view_, frame_, header_view_); | 461 immersive_fullscreen_controller->Init(header_view_, frame_, header_view_); |
| 473 } | 462 } |
| 474 | 463 |
| 475 void CustomFrameViewAsh::SetFrameColors(SkColor active_frame_color, | 464 void CustomFrameViewAsh::SetFrameColors(SkColor active_frame_color, |
| 476 SkColor inactive_frame_color) { | 465 SkColor inactive_frame_color) { |
| 477 header_view_->SetFrameColors(active_frame_color, inactive_frame_color); | 466 header_view_->SetFrameColors(active_frame_color, inactive_frame_color); |
| 478 } | 467 } |
| 479 | 468 |
| 480 //////////////////////////////////////////////////////////////////////////////// | 469 //////////////////////////////////////////////////////////////////////////////// |
| 481 // CustomFrameViewAsh, views::NonClientFrameView overrides: | 470 // CustomFrameViewAsh, views::NonClientFrameView overrides: |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 gfx::Size CustomFrameViewAsh::GetPreferredSize() const { | 512 gfx::Size CustomFrameViewAsh::GetPreferredSize() const { |
| 524 gfx::Size pref = frame_->client_view()->GetPreferredSize(); | 513 gfx::Size pref = frame_->client_view()->GetPreferredSize(); |
| 525 gfx::Rect bounds(0, 0, pref.width(), pref.height()); | 514 gfx::Rect bounds(0, 0, pref.width(), pref.height()); |
| 526 return frame_->non_client_view() | 515 return frame_->non_client_view() |
| 527 ->GetWindowBoundsForClientBounds(bounds) | 516 ->GetWindowBoundsForClientBounds(bounds) |
| 528 .size(); | 517 .size(); |
| 529 } | 518 } |
| 530 | 519 |
| 531 void CustomFrameViewAsh::Layout() { | 520 void CustomFrameViewAsh::Layout() { |
| 532 views::NonClientFrameView::Layout(); | 521 views::NonClientFrameView::Layout(); |
| 533 frame_->GetNativeWindow()->SetProperty(aura::client::kTopViewInset, | 522 WmWindow* frame_window = WmLookup::Get()->GetWindowForWidget(frame_); |
| 534 NonClientTopBorderHeight()); | 523 frame_window->SetIntProperty(WmWindowProperty::TOP_VIEW_INSET, |
| 524 NonClientTopBorderHeight()); |
| 535 } | 525 } |
| 536 | 526 |
| 537 const char* CustomFrameViewAsh::GetClassName() const { | 527 const char* CustomFrameViewAsh::GetClassName() const { |
| 538 return kViewClassName; | 528 return kViewClassName; |
| 539 } | 529 } |
| 540 | 530 |
| 541 gfx::Size CustomFrameViewAsh::GetMinimumSize() const { | 531 gfx::Size CustomFrameViewAsh::GetMinimumSize() const { |
| 542 gfx::Size min_client_view_size(frame_->client_view()->GetMinimumSize()); | 532 gfx::Size min_client_view_size(frame_->client_view()->GetMinimumSize()); |
| 543 return gfx::Size( | 533 return gfx::Size( |
| 544 std::max(header_view_->GetMinimumWidth(), min_client_view_size.width()), | 534 std::max(header_view_->GetMinimumWidth(), min_client_view_size.width()), |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 FrameCaptionButtonContainerView* | 593 FrameCaptionButtonContainerView* |
| 604 CustomFrameViewAsh::GetFrameCaptionButtonContainerViewForTest() { | 594 CustomFrameViewAsh::GetFrameCaptionButtonContainerViewForTest() { |
| 605 return header_view_->caption_button_container(); | 595 return header_view_->caption_button_container(); |
| 606 } | 596 } |
| 607 | 597 |
| 608 int CustomFrameViewAsh::NonClientTopBorderHeight() const { | 598 int CustomFrameViewAsh::NonClientTopBorderHeight() const { |
| 609 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); | 599 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); |
| 610 } | 600 } |
| 611 | 601 |
| 612 } // namespace ash | 602 } // namespace ash |
| OLD | NEW |