Chromium Code Reviews| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/common/frame/custom_frame_view_ash.h" | 9 #include "ash/common/frame/custom_frame_view_ash.h" |
| 10 #include "ash/common/shelf/wm_shelf.h" | 10 #include "ash/common/shelf/wm_shelf.h" |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 489 // managed system modal dialogs using a single ShellSurface instance. | 489 // managed system modal dialogs using a single ShellSurface instance. |
| 490 // Hit-test region will be non-empty when at least one dialog exists on | 490 // Hit-test region will be non-empty when at least one dialog exists on |
| 491 // the client side. Here we detect the transition between no client side | 491 // the client side. Here we detect the transition between no client side |
| 492 // dialog and at least one dialog so activatable state is properly | 492 // dialog and at least one dialog so activatable state is properly |
| 493 // updated. | 493 // updated. |
| 494 if (container_ != ash::kShellWindowId_SystemModalContainer) { | 494 if (container_ != ash::kShellWindowId_SystemModalContainer) { |
| 495 LOG(ERROR) | 495 LOG(ERROR) |
| 496 << "Only a window in SystemModalContainer can change the modality"; | 496 << "Only a window in SystemModalContainer can change the modality"; |
| 497 return; | 497 return; |
| 498 } | 498 } |
| 499 | |
| 500 if (system_modal == system_modal_) | |
| 501 return; | |
| 502 | |
| 503 system_modal_ = system_modal; | |
| 504 | |
| 505 if (!widget_) { | |
|
reveman
2017/03/11 00:45:08
nit: I don't think we should have this warning. Se
khmel
2017/03/11 01:33:32
Nice, done
| |
| 506 DLOG(WARNING) << "Skip setting system modal state to " << system_modal_ | |
| 507 << " because window is not ready yet."; | |
| 508 return; | |
| 509 } | |
| 510 | |
| 511 UpdateSystemModal(); | |
| 512 } | |
| 513 | |
| 514 void ShellSurface::UpdateSystemModal() { | |
| 515 DCHECK(widget_); | |
| 516 DCHECK(!system_modal_ || | |
| 517 container_ == ash::kShellWindowId_SystemModalContainer); | |
|
reveman
2017/03/11 00:45:09
nit: just DCHECK_EQ(container_, ash::kShellWindowI
khmel
2017/03/11 01:33:32
Done.
| |
| 499 widget_->GetNativeWindow()->SetProperty( | 518 widget_->GetNativeWindow()->SetProperty( |
| 500 aura::client::kModalKey, | 519 aura::client::kModalKey, |
| 501 system_modal ? ui::MODAL_TYPE_SYSTEM : ui::MODAL_TYPE_NONE); | 520 system_modal_ ? ui::MODAL_TYPE_SYSTEM : ui::MODAL_TYPE_NONE); |
| 502 } | 521 } |
| 503 | 522 |
| 504 // static | 523 // static |
| 505 void ShellSurface::SetApplicationId(aura::Window* window, | 524 void ShellSurface::SetApplicationId(aura::Window* window, |
| 506 const std::string& id) { | 525 const std::string& id) { |
| 507 TRACE_EVENT1("exo", "ShellSurface::SetApplicationId", "application_id", id); | 526 TRACE_EVENT1("exo", "ShellSurface::SetApplicationId", "application_id", id); |
| 508 window->SetProperty(aura::client::kAppIdKey, new std::string(id)); | 527 window->SetProperty(aura::client::kAppIdKey, new std::string(id)); |
| 509 } | 528 } |
| 510 | 529 |
| 511 // static | 530 // static |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 759 surface_->window()->SetTransform(transform); | 778 surface_->window()->SetTransform(transform); |
| 760 scale_ = pending_scale_; | 779 scale_ = pending_scale_; |
| 761 } | 780 } |
| 762 | 781 |
| 763 // Show widget if needed. | 782 // Show widget if needed. |
| 764 if (pending_show_widget_) { | 783 if (pending_show_widget_) { |
| 765 DCHECK(!widget_->IsClosed()); | 784 DCHECK(!widget_->IsClosed()); |
| 766 DCHECK(!widget_->IsVisible()); | 785 DCHECK(!widget_->IsVisible()); |
| 767 pending_show_widget_ = false; | 786 pending_show_widget_ = false; |
| 768 widget_->Show(); | 787 widget_->Show(); |
| 788 UpdateSystemModal(); | |
| 769 } | 789 } |
| 770 } | 790 } |
| 771 } | 791 } |
| 772 | 792 |
| 773 bool ShellSurface::IsSurfaceSynchronized() const { | 793 bool ShellSurface::IsSurfaceSynchronized() const { |
| 774 // A shell surface is always desynchronized. | 794 // A shell surface is always desynchronized. |
| 775 return false; | 795 return false; |
| 776 } | 796 } |
| 777 | 797 |
| 778 //////////////////////////////////////////////////////////////////////////////// | 798 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1570 // small style shadow for them. | 1590 // small style shadow for them. |
| 1571 if (!activatable_) | 1591 if (!activatable_) |
| 1572 shadow->SetElevation(wm::ShadowElevation::SMALL); | 1592 shadow->SetElevation(wm::ShadowElevation::SMALL); |
| 1573 // We don't have rounded corners unless frame is enabled. | 1593 // We don't have rounded corners unless frame is enabled. |
| 1574 if (!frame_enabled_) | 1594 if (!frame_enabled_) |
| 1575 shadow->SetRoundedCornerRadius(0); | 1595 shadow->SetRoundedCornerRadius(0); |
| 1576 } | 1596 } |
| 1577 } | 1597 } |
| 1578 | 1598 |
| 1579 } // namespace exo | 1599 } // namespace exo |
| OLD | NEW |