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

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

Issue 2008153002: Add initial implementation of cc::Surfaces backend for exo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_window_ids.h" 8 #include "ash/shell_window_ids.h"
9 #include "ash/wm/aura/wm_window_aura.h" 9 #include "ash/wm/aura/wm_window_aura.h"
10 #include "ash/wm/common/window_resizer.h" 10 #include "ash/wm/common/window_resizer.h"
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 aura::Window::ConvertPointToTarget(widget_->GetNativeWindow(), 938 aura::Window::ConvertPointToTarget(widget_->GetNativeWindow(),
939 widget_->GetNativeWindow()->parent(), 939 widget_->GetNativeWindow()->parent(),
940 &new_widget_origin); 940 &new_widget_origin);
941 new_widget_bounds.set_origin(new_widget_origin); 941 new_widget_bounds.set_origin(new_widget_origin);
942 } 942 }
943 943
944 // Set |ignore_window_bounds_changes_| as this change to window bounds 944 // Set |ignore_window_bounds_changes_| as this change to window bounds
945 // should not result in a configure request. 945 // should not result in a configure request.
946 DCHECK(!ignore_window_bounds_changes_); 946 DCHECK(!ignore_window_bounds_changes_);
947 ignore_window_bounds_changes_ = true; 947 ignore_window_bounds_changes_ = true;
948 widget_->SetBounds(new_widget_bounds); 948 if (current_bounds_ != new_widget_bounds)
reveman 2016/05/27 23:30:45 nit: would be nice to land this as a separate patc
949 widget_->SetBounds(new_widget_bounds);
950 current_bounds_ = new_widget_bounds;
949 ignore_window_bounds_changes_ = false; 951 ignore_window_bounds_changes_ = false;
950 952
951 UpdateTransparentInsets(); 953 UpdateTransparentInsets();
952 954
953 // A change to the widget size requires surface bounds to be re-adjusted. 955 // A change to the widget size requires surface bounds to be re-adjusted.
954 surface_->SetBounds(gfx::Rect(GetSurfaceOrigin(), surface_->layer()->size())); 956 surface_->SetBounds(gfx::Rect(GetSurfaceOrigin(), surface_->layer()->size()));
955 } 957 }
956 958
957 void ShellSurface::UpdateTransparentInsets() { 959 void ShellSurface::UpdateTransparentInsets() {
958 DCHECK(widget_); 960 DCHECK(widget_);
959 961
960 gfx::Rect non_transparent_bounds = surface_->GetNonTransparentBounds() + 962 gfx::Rect non_transparent_bounds = surface_->GetNonTransparentBounds() +
961 GetSurfaceOrigin().OffsetFromOrigin(); 963 GetSurfaceOrigin().OffsetFromOrigin();
962 gfx::Size window_size = widget_->GetNativeWindow()->bounds().size(); 964 gfx::Size window_size = widget_->GetNativeWindow()->bounds().size();
963 gfx::Insets transparent_insets = 965 gfx::Insets transparent_insets =
964 gfx::Rect(window_size).InsetsFrom(non_transparent_bounds); 966 gfx::Rect(window_size).InsetsFrom(non_transparent_bounds);
965 ash::wm::WindowState* window_state = 967 ash::wm::WindowState* window_state =
966 ash::wm::GetWindowState(widget_->GetNativeWindow()); 968 ash::wm::GetWindowState(widget_->GetNativeWindow());
967 if (window_state->transparent_insets() != transparent_insets) { 969 if (window_state->transparent_insets() != transparent_insets) {
968 window_state->set_transparent_insets(transparent_insets); 970 window_state->set_transparent_insets(transparent_insets);
969 ash::Shell::GetInstance()->UpdateShelfVisibility(); 971 ash::Shell::GetInstance()->UpdateShelfVisibility();
970 } 972 }
971 } 973 }
972 974
973 } // namespace exo 975 } // 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