Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Side by Side Diff: components/exo/shell_surface.cc

Issue 2743053002: arc: Fix race condition in applying modal state. (Closed)
Patch Set: forgotten nit Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/exo/shell_surface.h ('k') | components/exo/shell_surface_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_)
506 UpdateSystemModal();
507 }
508
509 void ShellSurface::UpdateSystemModal() {
510 DCHECK(widget_);
511 DCHECK_EQ(container_, ash::kShellWindowId_SystemModalContainer);
499 widget_->GetNativeWindow()->SetProperty( 512 widget_->GetNativeWindow()->SetProperty(
500 aura::client::kModalKey, 513 aura::client::kModalKey,
501 system_modal ? ui::MODAL_TYPE_SYSTEM : ui::MODAL_TYPE_NONE); 514 system_modal_ ? ui::MODAL_TYPE_SYSTEM : ui::MODAL_TYPE_NONE);
502 } 515 }
503 516
504 // static 517 // static
505 void ShellSurface::SetApplicationId(aura::Window* window, 518 void ShellSurface::SetApplicationId(aura::Window* window,
506 const std::string& id) { 519 const std::string& id) {
507 TRACE_EVENT1("exo", "ShellSurface::SetApplicationId", "application_id", id); 520 TRACE_EVENT1("exo", "ShellSurface::SetApplicationId", "application_id", id);
508 window->SetProperty(aura::client::kAppIdKey, new std::string(id)); 521 window->SetProperty(aura::client::kAppIdKey, new std::string(id));
509 } 522 }
510 523
511 // static 524 // static
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 surface_->window()->SetTransform(transform); 772 surface_->window()->SetTransform(transform);
760 scale_ = pending_scale_; 773 scale_ = pending_scale_;
761 } 774 }
762 775
763 // Show widget if needed. 776 // Show widget if needed.
764 if (pending_show_widget_) { 777 if (pending_show_widget_) {
765 DCHECK(!widget_->IsClosed()); 778 DCHECK(!widget_->IsClosed());
766 DCHECK(!widget_->IsVisible()); 779 DCHECK(!widget_->IsVisible());
767 pending_show_widget_ = false; 780 pending_show_widget_ = false;
768 widget_->Show(); 781 widget_->Show();
782 if (container_ == ash::kShellWindowId_SystemModalContainer)
783 UpdateSystemModal();
769 } 784 }
770 } 785 }
771 } 786 }
772 787
773 bool ShellSurface::IsSurfaceSynchronized() const { 788 bool ShellSurface::IsSurfaceSynchronized() const {
774 // A shell surface is always desynchronized. 789 // A shell surface is always desynchronized.
775 return false; 790 return false;
776 } 791 }
777 792
778 //////////////////////////////////////////////////////////////////////////////// 793 ////////////////////////////////////////////////////////////////////////////////
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
1570 // small style shadow for them. 1585 // small style shadow for them.
1571 if (!activatable_) 1586 if (!activatable_)
1572 shadow->SetElevation(wm::ShadowElevation::SMALL); 1587 shadow->SetElevation(wm::ShadowElevation::SMALL);
1573 // We don't have rounded corners unless frame is enabled. 1588 // We don't have rounded corners unless frame is enabled.
1574 if (!frame_enabled_) 1589 if (!frame_enabled_)
1575 shadow->SetRoundedCornerRadius(0); 1590 shadow->SetRoundedCornerRadius(0);
1576 } 1591 }
1577 } 1592 }
1578 1593
1579 } // namespace exo 1594 } // namespace exo
OLDNEW
« no previous file with comments | « components/exo/shell_surface.h ('k') | components/exo/shell_surface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698