| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/wm/window_cycle_list.h" | 5 #include "ash/wm/window_cycle_list.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "ash/public/cpp/shell_window_ids.h" | 10 #include "ash/public/cpp/shell_window_ids.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 SkColorSetA(SK_ColorBLACK, 0xFF / 2))); | 94 SkColorSetA(SK_ColorBLACK, 0xFF / 2))); |
| 95 AddChildView(preview_background_); | 95 AddChildView(preview_background_); |
| 96 | 96 |
| 97 AddChildView(mirror_view_); | 97 AddChildView(mirror_view_); |
| 98 | 98 |
| 99 SetFocusBehavior(FocusBehavior::ALWAYS); | 99 SetFocusBehavior(FocusBehavior::ALWAYS); |
| 100 } | 100 } |
| 101 ~WindowPreviewView() override {} | 101 ~WindowPreviewView() override {} |
| 102 | 102 |
| 103 // views::View: | 103 // views::View: |
| 104 gfx::Size GetPreferredSize() const override { | 104 gfx::Size CalculatePreferredSize() const override { |
| 105 gfx::Size size = GetSizeForPreviewArea(); | 105 gfx::Size size = GetSizeForPreviewArea(); |
| 106 size.Enlarge(0, window_title_->GetPreferredSize().height()); | 106 size.Enlarge(0, window_title_->GetPreferredSize().height()); |
| 107 return size; | 107 return size; |
| 108 } | 108 } |
| 109 | 109 |
| 110 void Layout() override { | 110 void Layout() override { |
| 111 const gfx::Size preview_area_size = GetSizeForPreviewArea(); | 111 const gfx::Size preview_area_size = GetSizeForPreviewArea(); |
| 112 // The window title is positioned above the preview area. | 112 // The window title is positioned above the preview area. |
| 113 window_title_->SetBounds(0, 0, width(), | 113 window_title_->SetBounds(0, 0, width(), |
| 114 height() - preview_area_size.height()); | 114 height() - preview_area_size.height()); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 parent->Layout(); | 284 parent->Layout(); |
| 285 SetTargetWindow(new_target); | 285 SetTargetWindow(new_target); |
| 286 } | 286 } |
| 287 | 287 |
| 288 void DestroyContents() { | 288 void DestroyContents() { |
| 289 window_view_map_.clear(); | 289 window_view_map_.clear(); |
| 290 RemoveAllChildViews(true); | 290 RemoveAllChildViews(true); |
| 291 } | 291 } |
| 292 | 292 |
| 293 // views::WidgetDelegateView overrides: | 293 // views::WidgetDelegateView overrides: |
| 294 gfx::Size GetPreferredSize() const override { | 294 gfx::Size CalculatePreferredSize() const override { |
| 295 return mirror_container_->GetPreferredSize(); | 295 return mirror_container_->GetPreferredSize(); |
| 296 } | 296 } |
| 297 | 297 |
| 298 void Layout() override { | 298 void Layout() override { |
| 299 if (!target_window_ || bounds().IsEmpty()) | 299 if (!target_window_ || bounds().IsEmpty()) |
| 300 return; | 300 return; |
| 301 | 301 |
| 302 bool first_layout = mirror_container_->bounds().IsEmpty(); | 302 bool first_layout = mirror_container_->bounds().IsEmpty(); |
| 303 // If |mirror_container_| has not yet been laid out, we must lay it and its | 303 // If |mirror_container_| has not yet been laid out, we must lay it and its |
| 304 // descendants out so that the calculations based on |target_view| work | 304 // descendants out so that the calculations based on |target_view| work |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 widget_rect.set_height(widget_height); | 546 widget_rect.set_height(widget_height); |
| 547 params.bounds = widget_rect; | 547 params.bounds = widget_rect; |
| 548 widget->Init(params); | 548 widget->Init(params); |
| 549 | 549 |
| 550 screen_observer_.Add(display::Screen::GetScreen()); | 550 screen_observer_.Add(display::Screen::GetScreen()); |
| 551 widget->Show(); | 551 widget->Show(); |
| 552 cycle_ui_widget_ = widget; | 552 cycle_ui_widget_ = widget; |
| 553 } | 553 } |
| 554 | 554 |
| 555 } // namespace ash | 555 } // namespace ash |
| OLD | NEW |