OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 5 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "ui/aura/client/aura_constants.h" | 9 #include "ui/aura/client/aura_constants.h" |
10 #include "ui/aura/client/cursor_client.h" | 10 #include "ui/aura/client/cursor_client.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 // the corresponding widget. | 138 // the corresponding widget. |
139 top_level_widget_->Close(); | 139 top_level_widget_->Close(); |
140 top_level_widget_ = NULL; | 140 top_level_widget_ = NULL; |
141 } | 141 } |
142 delete this; | 142 delete this; |
143 } | 143 } |
144 | 144 |
145 void OnWindowBoundsChanged(aura::Window* window, | 145 void OnWindowBoundsChanged(aura::Window* window, |
146 const gfx::Rect& old_bounds, | 146 const gfx::Rect& old_bounds, |
147 const gfx::Rect& new_bounds) override { | 147 const gfx::Rect& new_bounds) override { |
| 148 // The position of the window may have changed. Hence we use SetBounds in |
| 149 // place of SetSize. We need to pass the bounds in screen coordinates to |
| 150 // the Widget::SetBounds function. |
148 if (top_level_widget_ && window == child_window_) | 151 if (top_level_widget_ && window == child_window_) |
149 top_level_widget_->SetSize(new_bounds.size()); | 152 top_level_widget_->SetBounds(window->GetBoundsInScreen()); |
150 } | 153 } |
151 | 154 |
152 private: | 155 private: |
153 DesktopNativeWidgetTopLevelHandler() | 156 DesktopNativeWidgetTopLevelHandler() |
154 : top_level_widget_(NULL), | 157 : top_level_widget_(NULL), |
155 child_window_(NULL) {} | 158 child_window_(NULL) {} |
156 | 159 |
157 ~DesktopNativeWidgetTopLevelHandler() override {} | 160 ~DesktopNativeWidgetTopLevelHandler() override {} |
158 | 161 |
159 Widget* top_level_widget_; | 162 Widget* top_level_widget_; |
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1229 if (cursor_reference_count_ == 0) { | 1232 if (cursor_reference_count_ == 0) { |
1230 // We are the last DesktopNativeWidgetAura instance, and we are responsible | 1233 // We are the last DesktopNativeWidgetAura instance, and we are responsible |
1231 // for cleaning up |cursor_manager_|. | 1234 // for cleaning up |cursor_manager_|. |
1232 delete cursor_manager_; | 1235 delete cursor_manager_; |
1233 native_cursor_manager_ = NULL; | 1236 native_cursor_manager_ = NULL; |
1234 cursor_manager_ = NULL; | 1237 cursor_manager_ = NULL; |
1235 } | 1238 } |
1236 } | 1239 } |
1237 | 1240 |
1238 } // namespace views | 1241 } // namespace views |
OLD | NEW |