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

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

Issue 2104473002: third_party: Update to version 8 of remote_shell_protocol (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
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 "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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 370
371 void ShellSurface::SetTitle(const base::string16& title) { 371 void ShellSurface::SetTitle(const base::string16& title) {
372 TRACE_EVENT1("exo", "ShellSurface::SetTitle", "title", 372 TRACE_EVENT1("exo", "ShellSurface::SetTitle", "title",
373 base::UTF16ToUTF8(title)); 373 base::UTF16ToUTF8(title));
374 374
375 title_ = title; 375 title_ = title;
376 if (widget_) 376 if (widget_)
377 widget_->UpdateWindowTitle(); 377 widget_->UpdateWindowTitle();
378 } 378 }
379 379
380 void ShellSurface::SetSystemModal(bool system_modal) {
381 // System modal container is used by clients to implement client side
382 // managed system modal dialogs using a single ShellSurface instance.
383 // Hit-test region will be non-empty when at least one dialog exists on
384 // the client side. Here we detect the transition between no client side
385 // dialog and at least one dialog so activatable state is properly
386 // updated.
387 if (container_ != ash::kShellWindowId_SystemModalContainer) {
388 LOG(ERROR)
389 << "Only a window in SystemModalContainer can change the modality";
390 return;
391 }
392 widget_->GetNativeWindow()->SetProperty(
393 aura::client::kModalKey,
394 system_modal ? ui::MODAL_TYPE_SYSTEM : ui::MODAL_TYPE_NONE);
395 }
396
380 // static 397 // static
381 void ShellSurface::SetApplicationId(aura::Window* window, 398 void ShellSurface::SetApplicationId(aura::Window* window,
382 std::string* application_id) { 399 std::string* application_id) {
383 window->SetProperty(kApplicationIdKey, application_id); 400 window->SetProperty(kApplicationIdKey, application_id);
384 } 401 }
385 402
386 // static 403 // static
387 const std::string ShellSurface::GetApplicationId(aura::Window* window) { 404 const std::string ShellSurface::GetApplicationId(aura::Window* window) {
388 std::string* string_ptr = window->GetProperty(kApplicationIdKey); 405 std::string* string_ptr = window->GetProperty(kApplicationIdKey);
389 return string_ptr ? *string_ptr : std::string(); 406 return string_ptr ? *string_ptr : std::string();
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 514
498 // Apply new top inset height. 515 // Apply new top inset height.
499 if (pending_top_inset_height_ != top_inset_height_) { 516 if (pending_top_inset_height_ != top_inset_height_) {
500 widget_->GetNativeWindow()->SetProperty(aura::client::kTopViewInset, 517 widget_->GetNativeWindow()->SetProperty(aura::client::kTopViewInset,
501 pending_top_inset_height_); 518 pending_top_inset_height_);
502 top_inset_height_ = pending_top_inset_height_; 519 top_inset_height_ = pending_top_inset_height_;
503 } 520 }
504 521
505 gfx::Point surface_origin = GetSurfaceOrigin(); 522 gfx::Point surface_origin = GetSurfaceOrigin();
506 523
507 // System modal container is used by clients to implement client side 524 // System modal container is used by clients to implement overlay
508 // managed system modal dialogs using a single ShellSurface instance. 525 // windows using a single ShellSurface instance. If hit-test
509 // Hit-test region will be non-empty when at least one dialog exists on 526 // region is empty, then it is non interactive window and won't be
510 // the client side. Here we detect the transition between no client side 527 // activated.
511 // dialog and at least one dialog so activatable state is properly
512 // updated.
513 if (container_ == ash::kShellWindowId_SystemModalContainer) { 528 if (container_ == ash::kShellWindowId_SystemModalContainer) {
oshima 2016/06/27 19:25:54 IIRC, you said you may need to undo this change (c
reveman 2016/06/27 20:45:00 If it's possible to move this logic to SetSystemMo
oshima 2016/06/29 15:01:22 There seems to be other windows that are opened in
514 gfx::Rect hit_test_bounds = 529 gfx::Rect hit_test_bounds =
515 surface_->GetHitTestBounds() + surface_origin.OffsetFromOrigin(); 530 surface_->GetHitTestBounds() + surface_origin.OffsetFromOrigin();
516 531
517 // Prevent window from being activated when hit test bounds are empty. 532 // Prevent window from being activated when hit test bounds are empty.
518 bool activatable = activatable_ && !hit_test_bounds.IsEmpty(); 533 bool activatable = activatable_ && !hit_test_bounds.IsEmpty();
519 if (activatable != CanActivate()) { 534 if (activatable != CanActivate()) {
520 set_can_activate(activatable); 535 set_can_activate(activatable);
521 widget_->GetNativeWindow()->SetProperty(
522 aura::client::kModalKey,
523 activatable ? ui::MODAL_TYPE_SYSTEM : ui::MODAL_TYPE_NONE);
524
525 // Activate or deactivate window if activation state changed. 536 // Activate or deactivate window if activation state changed.
526 if (activatable) 537 if (activatable)
527 wm::ActivateWindow(widget_->GetNativeWindow()); 538 wm::ActivateWindow(widget_->GetNativeWindow());
528 else if (widget_->IsActive()) 539 else if (widget_->IsActive())
529 wm::DeactivateWindow(widget_->GetNativeWindow()); 540 wm::DeactivateWindow(widget_->GetNativeWindow());
530 } 541 }
531 } 542 }
532 543
533 // Update surface bounds. 544 // Update surface bounds.
534 surface_->window()->SetBounds( 545 surface_->window()->SetBounds(
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
1155 &shadow_bounds); 1166 &shadow_bounds);
1156 shadow_overlay_->SetBounds(shadow_bounds); 1167 shadow_overlay_->SetBounds(shadow_bounds);
1157 shadow_underlay_->SetBounds(shadow_bounds); 1168 shadow_underlay_->SetBounds(shadow_bounds);
1158 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size())); 1169 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size()));
1159 wm::SetShadowType(window, wm::SHADOW_TYPE_RECTANGULAR); 1170 wm::SetShadowType(window, wm::SHADOW_TYPE_RECTANGULAR);
1160 } 1171 }
1161 } 1172 }
1162 } 1173 }
1163 1174
1164 } // namespace exo 1175 } // namespace exo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698