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

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

Issue 2596743002: Replace WM shadow types (on/off) and styles (small/inactive/active) (Closed)
Patch Set: one more mechanical change Created 3 years, 11 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 <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/aura/wm_window_aura.h" 9 #include "ash/aura/wm_window_aura.h"
10 #include "ash/common/frame/custom_frame_view_ash.h" 10 #include "ash/common/frame/custom_frame_view_ash.h"
(...skipping 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after
1402 surface_->window()->SetBounds( 1402 surface_->window()->SetBounds(
1403 gfx::Rect(GetSurfaceOrigin() + client_view_bounds.OffsetFromOrigin(), 1403 gfx::Rect(GetSurfaceOrigin() + client_view_bounds.OffsetFromOrigin(),
1404 surface_->window()->layer()->size())); 1404 surface_->window()->layer()->size()));
1405 } 1405 }
1406 1406
1407 void ShellSurface::UpdateShadow() { 1407 void ShellSurface::UpdateShadow() {
1408 if (!widget_) 1408 if (!widget_)
1409 return; 1409 return;
1410 aura::Window* window = widget_->GetNativeWindow(); 1410 aura::Window* window = widget_->GetNativeWindow();
1411 if (!shadow_enabled_) { 1411 if (!shadow_enabled_) {
1412 wm::SetShadowType(window, wm::SHADOW_TYPE_NONE); 1412 wm::SetShadowElevation(window, wm::ShadowElevation::NONE);
1413 if (shadow_underlay_) 1413 if (shadow_underlay_)
1414 shadow_underlay_->Hide(); 1414 shadow_underlay_->Hide();
1415 } else { 1415 } else {
1416 wm::SetShadowType(window, wm::SHADOW_TYPE_RECTANGULAR); 1416 wm::SetShadowElevation(window, wm::ShadowElevation::MEDIUM);
1417 1417
1418 gfx::Rect shadow_content_bounds = shadow_content_bounds_; 1418 gfx::Rect shadow_content_bounds = shadow_content_bounds_;
1419 if (shadow_content_bounds.IsEmpty()) 1419 if (shadow_content_bounds.IsEmpty())
1420 shadow_content_bounds = window->bounds(); 1420 shadow_content_bounds = window->bounds();
1421 1421
1422 // TODO(oshima): Adjust the coordinates from client screen to 1422 // TODO(oshima): Adjust the coordinates from client screen to
1423 // chromeos screen when multi displays are supported. 1423 // chromeos screen when multi displays are supported.
1424 gfx::Point origin = window->bounds().origin(); 1424 gfx::Point origin = window->bounds().origin();
1425 gfx::Point shadow_origin = shadow_content_bounds.origin(); 1425 gfx::Point shadow_origin = shadow_content_bounds.origin();
1426 shadow_origin -= origin.OffsetFromOrigin(); 1426 shadow_origin -= origin.OffsetFromOrigin();
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1498 shadow_overlay_->Init(ui::LAYER_NOT_DRAWN); 1498 shadow_overlay_->Init(ui::LAYER_NOT_DRAWN);
1499 shadow_overlay_->layer()->Add(shadow->layer()); 1499 shadow_overlay_->layer()->Add(shadow->layer());
1500 window->AddChild(shadow_overlay_); 1500 window->AddChild(shadow_overlay_);
1501 shadow_overlay_->Show(); 1501 shadow_overlay_->Show();
1502 } 1502 }
1503 shadow_overlay_->SetBounds(shadow_bounds); 1503 shadow_overlay_->SetBounds(shadow_bounds);
1504 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size())); 1504 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size()));
1505 // Surfaces that can't be activated are usually menus and tooltips. Use a 1505 // Surfaces that can't be activated are usually menus and tooltips. Use a
1506 // small style shadow for them. 1506 // small style shadow for them.
1507 if (!activatable_) 1507 if (!activatable_)
1508 shadow->SetStyle(wm::Shadow::STYLE_SMALL); 1508 shadow->SetElevation(wm::ShadowElevation::SMALL);
1509 } 1509 }
1510 } 1510 }
1511 1511
1512 } // namespace exo 1512 } // namespace exo
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/accessibility/chromevox_panel.cc ('k') | components/exo/shell_surface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698