| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/exo/shell_surface.h" | 5 #include "components/exo/shell_surface.h" |
| 6 | 6 |
| 7 #include "ash/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
| 8 #include "ash/common/shell_window_ids.h" | 8 #include "ash/common/shell_window_ids.h" |
| 9 #include "ash/common/wm/window_resizer.h" | 9 #include "ash/common/wm/window_resizer.h" |
| 10 #include "ash/common/wm/window_state.h" | 10 #include "ash/common/wm/window_state.h" |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 window->SetProperty(aura::client::kAnimationsDisabledKey, | 246 window->SetProperty(aura::client::kAnimationsDisabledKey, |
| 247 saved_animations_disabled_); | 247 saved_animations_disabled_); |
| 248 } | 248 } |
| 249 } | 249 } |
| 250 | 250 |
| 251 //////////////////////////////////////////////////////////////////////////////// | 251 //////////////////////////////////////////////////////////////////////////////// |
| 252 // ShellSurface, public: | 252 // ShellSurface, public: |
| 253 | 253 |
| 254 DEFINE_LOCAL_WINDOW_PROPERTY_KEY(std::string*, kApplicationIdKey, nullptr) | 254 DEFINE_LOCAL_WINDOW_PROPERTY_KEY(std::string*, kApplicationIdKey, nullptr) |
| 255 DEFINE_LOCAL_WINDOW_PROPERTY_KEY(Surface*, kMainSurfaceKey, nullptr) | 255 DEFINE_LOCAL_WINDOW_PROPERTY_KEY(Surface*, kMainSurfaceKey, nullptr) |
| 256 DEFINE_LOCAL_WINDOW_PROPERTY_KEY(bool, kShelfWindowReady, false) |
| 256 | 257 |
| 257 ShellSurface::ShellSurface(Surface* surface, | 258 ShellSurface::ShellSurface(Surface* surface, |
| 258 ShellSurface* parent, | 259 ShellSurface* parent, |
| 259 const gfx::Rect& initial_bounds, | 260 const gfx::Rect& initial_bounds, |
| 260 bool activatable, | 261 bool activatable, |
| 261 int container) | 262 int container) |
| 262 : widget_(nullptr), | 263 : widget_(nullptr), |
| 263 surface_(surface), | 264 surface_(surface), |
| 264 parent_(parent ? parent->GetWidget()->GetNativeWindow() : nullptr), | 265 parent_(parent ? parent->GetWidget()->GetNativeWindow() : nullptr), |
| 265 initial_bounds_(initial_bounds), | 266 initial_bounds_(initial_bounds), |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 std::string* application_id) { | 457 std::string* application_id) { |
| 457 window->SetProperty(kApplicationIdKey, application_id); | 458 window->SetProperty(kApplicationIdKey, application_id); |
| 458 } | 459 } |
| 459 | 460 |
| 460 // static | 461 // static |
| 461 const std::string ShellSurface::GetApplicationId(aura::Window* window) { | 462 const std::string ShellSurface::GetApplicationId(aura::Window* window) { |
| 462 std::string* string_ptr = window->GetProperty(kApplicationIdKey); | 463 std::string* string_ptr = window->GetProperty(kApplicationIdKey); |
| 463 return string_ptr ? *string_ptr : std::string(); | 464 return string_ptr ? *string_ptr : std::string(); |
| 464 } | 465 } |
| 465 | 466 |
| 467 // static |
| 468 bool ShellSurface::IsApplicationWindowReadyPropertyKey(const void* key) { |
| 469 return kShelfWindowReady == key; |
| 470 } |
| 471 |
| 472 // static |
| 473 bool ShellSurface::IsApplicationWindowReadyToShow(aura::Window* window) { |
| 474 return window->GetProperty(kShelfWindowReady); |
| 475 } |
| 476 |
| 466 void ShellSurface::SetApplicationId(const std::string& application_id) { | 477 void ShellSurface::SetApplicationId(const std::string& application_id) { |
| 467 TRACE_EVENT1("exo", "ShellSurface::SetApplicationId", "application_id", | 478 TRACE_EVENT1("exo", "ShellSurface::SetApplicationId", "application_id", |
| 468 application_id); | 479 application_id); |
| 469 | 480 |
| 470 application_id_ = application_id; | 481 application_id_ = application_id; |
| 471 } | 482 } |
| 472 | 483 |
| 473 void ShellSurface::Move() { | 484 void ShellSurface::Move() { |
| 474 TRACE_EVENT0("exo", "ShellSurface::Move"); | 485 TRACE_EVENT0("exo", "ShellSurface::Move"); |
| 475 | 486 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 DCHECK_NE(pending_scale_, 0.0); | 626 DCHECK_NE(pending_scale_, 0.0); |
| 616 transform.Scale(1.0 / pending_scale_, 1.0 / pending_scale_); | 627 transform.Scale(1.0 / pending_scale_, 1.0 / pending_scale_); |
| 617 surface_->window()->SetTransform(transform); | 628 surface_->window()->SetTransform(transform); |
| 618 scale_ = pending_scale_; | 629 scale_ = pending_scale_; |
| 619 } | 630 } |
| 620 | 631 |
| 621 // Show widget if needed. | 632 // Show widget if needed. |
| 622 if (pending_show_widget_) { | 633 if (pending_show_widget_) { |
| 623 DCHECK(!widget_->IsClosed()); | 634 DCHECK(!widget_->IsClosed()); |
| 624 DCHECK(!widget_->IsVisible()); | 635 DCHECK(!widget_->IsVisible()); |
| 636 DCHECK(!widget_->GetNativeWindow()); |
| 625 pending_show_widget_ = false; | 637 pending_show_widget_ = false; |
| 626 widget_->Show(); | 638 widget_->GetNativeWindow()->SetProperty(kShelfWindowReady, true); |
| 627 } | 639 } |
| 628 } | 640 } |
| 629 } | 641 } |
| 630 | 642 |
| 631 bool ShellSurface::IsSurfaceSynchronized() const { | 643 bool ShellSurface::IsSurfaceSynchronized() const { |
| 632 // A shell surface is always desynchronized. | 644 // A shell surface is always desynchronized. |
| 633 return false; | 645 return false; |
| 634 } | 646 } |
| 635 | 647 |
| 636 //////////////////////////////////////////////////////////////////////////////// | 648 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1294 shadow_overlay_->layer()->Add(shadow->layer()); | 1306 shadow_overlay_->layer()->Add(shadow->layer()); |
| 1295 window->AddChild(shadow_overlay_); | 1307 window->AddChild(shadow_overlay_); |
| 1296 shadow_overlay_->Show(); | 1308 shadow_overlay_->Show(); |
| 1297 } | 1309 } |
| 1298 shadow_overlay_->SetBounds(shadow_bounds); | 1310 shadow_overlay_->SetBounds(shadow_bounds); |
| 1299 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size())); | 1311 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size())); |
| 1300 } | 1312 } |
| 1301 } | 1313 } |
| 1302 | 1314 |
| 1303 } // namespace exo | 1315 } // namespace exo |
| OLD | NEW |