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/macros.h" | 8 #include "base/macros.h" |
9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 gfx::Rect DesktopNativeWidgetAura::GetClientAreaBoundsInScreen() const { | 669 gfx::Rect DesktopNativeWidgetAura::GetClientAreaBoundsInScreen() const { |
670 return content_window_ ? | 670 return content_window_ ? |
671 desktop_window_tree_host_->GetClientAreaBoundsInScreen() : gfx::Rect(); | 671 desktop_window_tree_host_->GetClientAreaBoundsInScreen() : gfx::Rect(); |
672 } | 672 } |
673 | 673 |
674 gfx::Rect DesktopNativeWidgetAura::GetRestoredBounds() const { | 674 gfx::Rect DesktopNativeWidgetAura::GetRestoredBounds() const { |
675 return content_window_ ? | 675 return content_window_ ? |
676 desktop_window_tree_host_->GetRestoredBounds() : gfx::Rect(); | 676 desktop_window_tree_host_->GetRestoredBounds() : gfx::Rect(); |
677 } | 677 } |
678 | 678 |
| 679 std::string DesktopNativeWidgetAura::GetWorkspace() const { |
| 680 return content_window_ ? |
| 681 desktop_window_tree_host_->GetWorkspace() : ""; |
| 682 } |
| 683 |
679 void DesktopNativeWidgetAura::SetBounds(const gfx::Rect& bounds) { | 684 void DesktopNativeWidgetAura::SetBounds(const gfx::Rect& bounds) { |
680 if (!content_window_) | 685 if (!content_window_) |
681 return; | 686 return; |
682 aura::Window* root = host_->window(); | 687 aura::Window* root = host_->window(); |
683 gfx::Screen* screen = gfx::Screen::GetScreen(); | 688 gfx::Screen* screen = gfx::Screen::GetScreen(); |
684 gfx::Rect bounds_in_pixels = screen->DIPToScreenRectInWindow(root, bounds); | 689 gfx::Rect bounds_in_pixels = screen->DIPToScreenRectInWindow(root, bounds); |
685 desktop_window_tree_host_->AsWindowTreeHost()->SetBounds(bounds_in_pixels); | 690 desktop_window_tree_host_->AsWindowTreeHost()->SetBounds(bounds_in_pixels); |
686 } | 691 } |
687 | 692 |
688 void DesktopNativeWidgetAura::SetSize(const gfx::Size& size) { | 693 void DesktopNativeWidgetAura::SetSize(const gfx::Size& size) { |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 return; | 1155 return; |
1151 | 1156 |
1152 gfx::Rect new_bounds = gfx::Rect(host->window()->bounds().size()); | 1157 gfx::Rect new_bounds = gfx::Rect(host->window()->bounds().size()); |
1153 content_window_->SetBounds(new_bounds); | 1158 content_window_->SetBounds(new_bounds); |
1154 // Can be NULL at start. | 1159 // Can be NULL at start. |
1155 if (content_window_container_) | 1160 if (content_window_container_) |
1156 content_window_container_->SetBounds(new_bounds); | 1161 content_window_container_->SetBounds(new_bounds); |
1157 native_widget_delegate_->OnNativeWidgetSizeChanged(new_bounds.size()); | 1162 native_widget_delegate_->OnNativeWidgetSizeChanged(new_bounds.size()); |
1158 } | 1163 } |
1159 | 1164 |
| 1165 void DesktopNativeWidgetAura::OnHostWorkspaceChanged( |
| 1166 const aura::WindowTreeHost* host) { |
| 1167 native_widget_delegate_->OnNativeWidgetWorkspaceChanged(); |
| 1168 } |
| 1169 |
1160 void DesktopNativeWidgetAura::OnHostMoved(const aura::WindowTreeHost* host, | 1170 void DesktopNativeWidgetAura::OnHostMoved(const aura::WindowTreeHost* host, |
1161 const gfx::Point& new_origin) { | 1171 const gfx::Point& new_origin) { |
1162 TRACE_EVENT1("views", "DesktopNativeWidgetAura::OnHostMoved", | 1172 TRACE_EVENT1("views", "DesktopNativeWidgetAura::OnHostMoved", |
1163 "new_origin", new_origin.ToString()); | 1173 "new_origin", new_origin.ToString()); |
1164 | 1174 |
1165 native_widget_delegate_->OnNativeWidgetMove(); | 1175 native_widget_delegate_->OnNativeWidgetMove(); |
1166 } | 1176 } |
1167 | 1177 |
1168 //////////////////////////////////////////////////////////////////////////////// | 1178 //////////////////////////////////////////////////////////////////////////////// |
1169 // DesktopNativeWidgetAura, private: | 1179 // DesktopNativeWidgetAura, private: |
(...skipping 12 matching lines...) Expand all Loading... |
1182 if (cursor_reference_count_ == 0) { | 1192 if (cursor_reference_count_ == 0) { |
1183 // We are the last DesktopNativeWidgetAura instance, and we are responsible | 1193 // We are the last DesktopNativeWidgetAura instance, and we are responsible |
1184 // for cleaning up |cursor_manager_|. | 1194 // for cleaning up |cursor_manager_|. |
1185 delete cursor_manager_; | 1195 delete cursor_manager_; |
1186 native_cursor_manager_ = NULL; | 1196 native_cursor_manager_ = NULL; |
1187 cursor_manager_ = NULL; | 1197 cursor_manager_ = NULL; |
1188 } | 1198 } |
1189 } | 1199 } |
1190 | 1200 |
1191 } // namespace views | 1201 } // namespace views |
OLD | NEW |