Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 925 window->SetName("ExoShellSurface"); | 925 window->SetName("ExoShellSurface"); |
| 926 window->AddChild(surface_->window()); | 926 window->AddChild(surface_->window()); |
| 927 window->SetEventTargeter(base::WrapUnique(new CustomWindowTargeter)); | 927 window->SetEventTargeter(base::WrapUnique(new CustomWindowTargeter)); |
| 928 SetApplicationId(window, &application_id_); | 928 SetApplicationId(window, &application_id_); |
| 929 SetMainSurface(window, surface_); | 929 SetMainSurface(window, surface_); |
| 930 | 930 |
| 931 // Start tracking changes to window bounds and window state. | 931 // Start tracking changes to window bounds and window state. |
| 932 window->AddObserver(this); | 932 window->AddObserver(this); |
| 933 ash::wm::WindowState* window_state = ash::wm::GetWindowState(window); | 933 ash::wm::WindowState* window_state = ash::wm::GetWindowState(window); |
| 934 window_state->AddObserver(this); | 934 window_state->AddObserver(this); |
| 935 | |
| 936 // Allow remote shell clients to update the bounds in maixmized/fullscreen | |
|
reveman
2016/08/12 16:17:32
nit: maximized
oshima
2016/08/12 23:03:33
Done.
| |
| 937 // mode. | |
| 938 if (!application_id_.empty()) | |
|
reveman
2016/08/12 16:17:32
This is not a proper test for arc apps. applicatio
oshima
2016/08/12 23:03:33
Done.
| |
| 939 window_state->set_allow_set_bounds_in_maximized(true); | |
| 940 | |
| 935 // Notify client of initial state if different than normal. | 941 // Notify client of initial state if different than normal. |
| 936 if (window_state->GetStateType() != ash::wm::WINDOW_STATE_TYPE_NORMAL && | 942 if (window_state->GetStateType() != ash::wm::WINDOW_STATE_TYPE_NORMAL && |
| 937 !state_changed_callback_.is_null()) { | 943 !state_changed_callback_.is_null()) { |
| 938 state_changed_callback_.Run(ash::wm::WINDOW_STATE_TYPE_NORMAL, | 944 state_changed_callback_.Run(ash::wm::WINDOW_STATE_TYPE_NORMAL, |
| 939 window_state->GetStateType()); | 945 window_state->GetStateType()); |
| 940 } | 946 } |
| 941 | 947 |
| 942 // Disable movement if initial bounds were specified. | 948 // Disable movement if initial bounds were specified. |
| 943 widget_->set_movement_disabled(!initial_bounds_.IsEmpty()); | 949 widget_->set_movement_disabled(!initial_bounds_.IsEmpty()); |
| 944 window_state->set_ignore_keyboard_bounds_change(!initial_bounds_.IsEmpty()); | 950 window_state->set_ignore_keyboard_bounds_change(!initial_bounds_.IsEmpty()); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1145 visible_bounds.OffsetFromOrigin(); | 1151 visible_bounds.OffsetFromOrigin(); |
| 1146 default: | 1152 default: |
| 1147 NOTREACHED(); | 1153 NOTREACHED(); |
| 1148 return gfx::Point(); | 1154 return gfx::Point(); |
| 1149 } | 1155 } |
| 1150 } | 1156 } |
| 1151 | 1157 |
| 1152 void ShellSurface::UpdateWidgetBounds() { | 1158 void ShellSurface::UpdateWidgetBounds() { |
| 1153 DCHECK(widget_); | 1159 DCHECK(widget_); |
| 1154 | 1160 |
| 1155 // Return early if the shell is currently managing the bounds of the widget. | |
| 1156 if (widget_->IsMaximized() || widget_->IsFullscreen() || IsResizing()) | |
|
reveman
2016/08/12 16:17:32
I'm pretty sure we need the IsResizing part for in
oshima
2016/08/12 23:03:33
I thought you wanted me to remove it. (and I looks
reveman
2016/08/12 23:44:40
Sorry for the confusion. In my initial comment I w
oshima
2016/08/13 00:45:07
Note that it will only happens when this flag is s
| |
| 1157 return; | |
| 1158 | |
| 1159 // Return early if there is pending configure requests. | 1161 // Return early if there is pending configure requests. |
| 1160 if (!pending_configs_.empty() || scoped_configure_) | 1162 if (!pending_configs_.empty() || scoped_configure_) |
| 1161 return; | 1163 return; |
| 1162 | 1164 |
| 1163 gfx::Rect visible_bounds = GetVisibleBounds(); | 1165 gfx::Rect visible_bounds = GetVisibleBounds(); |
| 1164 gfx::Rect new_widget_bounds = visible_bounds; | 1166 gfx::Rect new_widget_bounds = visible_bounds; |
| 1165 | 1167 |
| 1166 // Avoid changing widget origin unless initial bounds were specified and | 1168 // Avoid changing widget origin unless initial bounds were specified and |
| 1167 // widget origin is always relative to it. | 1169 // widget origin is always relative to it. |
| 1168 if (initial_bounds_.IsEmpty()) | 1170 if (initial_bounds_.IsEmpty()) |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1242 shadow_overlay_->layer()->Add(shadow->layer()); | 1244 shadow_overlay_->layer()->Add(shadow->layer()); |
| 1243 window->AddChild(shadow_overlay_); | 1245 window->AddChild(shadow_overlay_); |
| 1244 shadow_overlay_->Show(); | 1246 shadow_overlay_->Show(); |
| 1245 } | 1247 } |
| 1246 shadow_overlay_->SetBounds(shadow_bounds); | 1248 shadow_overlay_->SetBounds(shadow_bounds); |
| 1247 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size())); | 1249 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size())); |
| 1248 } | 1250 } |
| 1249 } | 1251 } |
| 1250 | 1252 |
| 1251 } // namespace exo | 1253 } // namespace exo |
| OLD | NEW |