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

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

Issue 2743053002: arc: Fix race condition in applying modal state. (Closed)
Patch Set: 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') | no next file » | 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 system_modal_ = system_modal;
reveman 2017/03/10 21:38:22 should we return early if it didn't change?
khmel 2017/03/10 22:11:32 Done.
501 if (!widget_) {
502 LOG(WARNING) << "Skip setting system modal state to " << system_modal_
reveman 2017/03/10 21:38:22 We shouldn't LOG things that can be triggered by a
khmel 2017/03/10 22:11:32 Done.
503 << " because window is not ready yet.";
504 return;
505 }
506
499 widget_->GetNativeWindow()->SetProperty( 507 widget_->GetNativeWindow()->SetProperty(
500 aura::client::kModalKey, 508 aura::client::kModalKey,
501 system_modal ? ui::MODAL_TYPE_SYSTEM : ui::MODAL_TYPE_NONE); 509 system_modal_ ? ui::MODAL_TYPE_SYSTEM : ui::MODAL_TYPE_NONE);
502 } 510 }
reveman 2017/03/10 21:38:22 Please add a private UpdateSystemModal() function
khmel 2017/03/10 22:11:32 Done.
503 511
504 // static 512 // static
505 void ShellSurface::SetApplicationId(aura::Window* window, 513 void ShellSurface::SetApplicationId(aura::Window* window,
506 const std::string& id) { 514 const std::string& id) {
507 TRACE_EVENT1("exo", "ShellSurface::SetApplicationId", "application_id", id); 515 TRACE_EVENT1("exo", "ShellSurface::SetApplicationId", "application_id", id);
508 window->SetProperty(aura::client::kAppIdKey, new std::string(id)); 516 window->SetProperty(aura::client::kAppIdKey, new std::string(id));
509 } 517 }
510 518
511 // static 519 // static
512 const std::string ShellSurface::GetApplicationId(aura::Window* window) { 520 const std::string ShellSurface::GetApplicationId(aura::Window* window) {
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 surface_->window()->SetTransform(transform); 767 surface_->window()->SetTransform(transform);
760 scale_ = pending_scale_; 768 scale_ = pending_scale_;
761 } 769 }
762 770
763 // Show widget if needed. 771 // Show widget if needed.
764 if (pending_show_widget_) { 772 if (pending_show_widget_) {
765 DCHECK(!widget_->IsClosed()); 773 DCHECK(!widget_->IsClosed());
766 DCHECK(!widget_->IsVisible()); 774 DCHECK(!widget_->IsVisible());
767 pending_show_widget_ = false; 775 pending_show_widget_ = false;
768 widget_->Show(); 776 widget_->Show();
777 if (system_modal_)
reveman 2017/03/10 21:38:22 Please replace these two lines with a call to Upda
khmel 2017/03/10 22:11:32 Done.
778 SetSystemModal(true);
769 } 779 }
770 } 780 }
771 } 781 }
772 782
773 bool ShellSurface::IsSurfaceSynchronized() const { 783 bool ShellSurface::IsSurfaceSynchronized() const {
774 // A shell surface is always desynchronized. 784 // A shell surface is always desynchronized.
775 return false; 785 return false;
776 } 786 }
777 787
778 //////////////////////////////////////////////////////////////////////////////// 788 ////////////////////////////////////////////////////////////////////////////////
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
1570 // small style shadow for them. 1580 // small style shadow for them.
1571 if (!activatable_) 1581 if (!activatable_)
1572 shadow->SetElevation(wm::ShadowElevation::SMALL); 1582 shadow->SetElevation(wm::ShadowElevation::SMALL);
1573 // We don't have rounded corners unless frame is enabled. 1583 // We don't have rounded corners unless frame is enabled.
1574 if (!frame_enabled_) 1584 if (!frame_enabled_)
1575 shadow->SetRoundedCornerRadius(0); 1585 shadow->SetRoundedCornerRadius(0);
1576 } 1586 }
1577 } 1587 }
1578 1588
1579 } // namespace exo 1589 } // namespace exo
OLDNEW
« no previous file with comments | « components/exo/shell_surface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698