| 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_window_tree_host_win.h" | 5 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "third_party/skia/include/core/SkPath.h" | 8 #include "third_party/skia/include/core/SkPath.h" |
| 9 #include "third_party/skia/include/core/SkRegion.h" | 9 #include "third_party/skia/include/core/SkRegion.h" |
| 10 #include "ui/aura/client/aura_constants.h" | 10 #include "ui/aura/client/aura_constants.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 #include "ui/wm/core/compound_event_filter.h" | 38 #include "ui/wm/core/compound_event_filter.h" |
| 39 #include "ui/wm/core/window_animations.h" | 39 #include "ui/wm/core/window_animations.h" |
| 40 #include "ui/wm/public/scoped_tooltip_disabler.h" | 40 #include "ui/wm/public/scoped_tooltip_disabler.h" |
| 41 | 41 |
| 42 DECLARE_UI_CLASS_PROPERTY_TYPE(views::DesktopWindowTreeHostWin*); | 42 DECLARE_UI_CLASS_PROPERTY_TYPE(views::DesktopWindowTreeHostWin*); |
| 43 | 43 |
| 44 namespace views { | 44 namespace views { |
| 45 | 45 |
| 46 namespace { | 46 namespace { |
| 47 | 47 |
| 48 gfx::Size GetExpandedWindowSize(DWORD window_style, gfx::Size size) { | 48 gfx::Size GetExpandedWindowSize(bool is_translucent, gfx::Size size) { |
| 49 if (!(window_style & WS_EX_COMPOSITED) || !ui::win::IsAeroGlassEnabled()) | 49 if (!is_translucent || !ui::win::IsAeroGlassEnabled()) |
| 50 return size; | 50 return size; |
| 51 | 51 |
| 52 // Some AMD drivers can't display windows that are less than 64x64 pixels, | 52 // Some AMD drivers can't display windows that are less than 64x64 pixels, |
| 53 // so expand them to be at least that size. http://crbug.com/286609 | 53 // so expand them to be at least that size. http://crbug.com/286609 |
| 54 gfx::Size expanded(std::max(size.width(), 64), std::max(size.height(), 64)); | 54 gfx::Size expanded(std::max(size.width(), 64), std::max(size.height(), 64)); |
| 55 return expanded; | 55 return expanded; |
| 56 } | 56 } |
| 57 | 57 |
| 58 void InsetBottomRight(gfx::Rect* rect, const gfx::Vector2d& vector) { | 58 void InsetBottomRight(gfx::Rect* rect, const gfx::Vector2d& vector) { |
| 59 rect->Inset(0, 0, vector.x(), vector.y()); | 59 rect->Inset(0, 0, vector.x(), vector.y()); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 message_handler_->ShowMaximizedWithBounds(pixel_bounds); | 217 message_handler_->ShowMaximizedWithBounds(pixel_bounds); |
| 218 } | 218 } |
| 219 | 219 |
| 220 bool DesktopWindowTreeHostWin::IsVisible() const { | 220 bool DesktopWindowTreeHostWin::IsVisible() const { |
| 221 return message_handler_->IsVisible(); | 221 return message_handler_->IsVisible(); |
| 222 } | 222 } |
| 223 | 223 |
| 224 void DesktopWindowTreeHostWin::SetSize(const gfx::Size& size) { | 224 void DesktopWindowTreeHostWin::SetSize(const gfx::Size& size) { |
| 225 gfx::Size size_in_pixels = display::win::ScreenWin::DIPToScreenSize(GetHWND(), | 225 gfx::Size size_in_pixels = display::win::ScreenWin::DIPToScreenSize(GetHWND(), |
| 226 size); | 226 size); |
| 227 gfx::Size expanded = GetExpandedWindowSize( | 227 gfx::Size expanded = |
| 228 message_handler_->window_ex_style(), size_in_pixels); | 228 GetExpandedWindowSize(message_handler_->is_translucent(), size_in_pixels); |
| 229 window_enlargement_ = | 229 window_enlargement_ = |
| 230 gfx::Vector2d(expanded.width() - size_in_pixels.width(), | 230 gfx::Vector2d(expanded.width() - size_in_pixels.width(), |
| 231 expanded.height() - size_in_pixels.height()); | 231 expanded.height() - size_in_pixels.height()); |
| 232 message_handler_->SetSize(expanded); | 232 message_handler_->SetSize(expanded); |
| 233 } | 233 } |
| 234 | 234 |
| 235 void DesktopWindowTreeHostWin::StackAbove(aura::Window* window) { | 235 void DesktopWindowTreeHostWin::StackAbove(aura::Window* window) { |
| 236 HWND hwnd = HWNDForNativeView(window); | 236 HWND hwnd = HWNDForNativeView(window); |
| 237 if (hwnd) | 237 if (hwnd) |
| 238 message_handler_->StackAbove(hwnd); | 238 message_handler_->StackAbove(hwnd); |
| 239 } | 239 } |
| 240 | 240 |
| 241 void DesktopWindowTreeHostWin::StackAtTop() { | 241 void DesktopWindowTreeHostWin::StackAtTop() { |
| 242 message_handler_->StackAtTop(); | 242 message_handler_->StackAtTop(); |
| 243 } | 243 } |
| 244 | 244 |
| 245 void DesktopWindowTreeHostWin::CenterWindow(const gfx::Size& size) { | 245 void DesktopWindowTreeHostWin::CenterWindow(const gfx::Size& size) { |
| 246 gfx::Size size_in_pixels = display::win::ScreenWin::DIPToScreenSize(GetHWND(), | 246 gfx::Size size_in_pixels = display::win::ScreenWin::DIPToScreenSize(GetHWND(), |
| 247 size); | 247 size); |
| 248 gfx::Size expanded_size; | 248 gfx::Size expanded_size; |
| 249 expanded_size = GetExpandedWindowSize(message_handler_->window_ex_style(), | 249 expanded_size = |
| 250 size_in_pixels); | 250 GetExpandedWindowSize(message_handler_->is_translucent(), size_in_pixels); |
| 251 window_enlargement_ = | 251 window_enlargement_ = |
| 252 gfx::Vector2d(expanded_size.width() - size_in_pixels.width(), | 252 gfx::Vector2d(expanded_size.width() - size_in_pixels.width(), |
| 253 expanded_size.height() - size_in_pixels.height()); | 253 expanded_size.height() - size_in_pixels.height()); |
| 254 message_handler_->CenterWindow(expanded_size); | 254 message_handler_->CenterWindow(expanded_size); |
| 255 } | 255 } |
| 256 | 256 |
| 257 void DesktopWindowTreeHostWin::GetWindowPlacement( | 257 void DesktopWindowTreeHostWin::GetWindowPlacement( |
| 258 gfx::Rect* bounds, | 258 gfx::Rect* bounds, |
| 259 ui::WindowShowState* show_state) const { | 259 ui::WindowShowState* show_state) const { |
| 260 message_handler_->GetWindowPlacement(bounds, show_state); | 260 message_handler_->GetWindowPlacement(bounds, show_state); |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 gfx::Size old_content_size = GetBoundsInPixels().size(); | 532 gfx::Size old_content_size = GetBoundsInPixels().size(); |
| 533 | 533 |
| 534 gfx::Rect expanded( | 534 gfx::Rect expanded( |
| 535 bounds.x() - window_expansion_top_left_delta_.x(), | 535 bounds.x() - window_expansion_top_left_delta_.x(), |
| 536 bounds.y() - window_expansion_top_left_delta_.y(), | 536 bounds.y() - window_expansion_top_left_delta_.y(), |
| 537 bounds.width() + window_expansion_bottom_right_delta_.x(), | 537 bounds.width() + window_expansion_bottom_right_delta_.x(), |
| 538 bounds.height() + window_expansion_bottom_right_delta_.y()); | 538 bounds.height() + window_expansion_bottom_right_delta_.y()); |
| 539 | 539 |
| 540 gfx::Rect new_expanded( | 540 gfx::Rect new_expanded( |
| 541 expanded.origin(), | 541 expanded.origin(), |
| 542 GetExpandedWindowSize(message_handler_->window_ex_style(), | 542 GetExpandedWindowSize(message_handler_->is_translucent(), |
| 543 expanded.size())); | 543 expanded.size())); |
| 544 window_enlargement_ = | 544 window_enlargement_ = |
| 545 gfx::Vector2d(new_expanded.width() - expanded.width(), | 545 gfx::Vector2d(new_expanded.width() - expanded.width(), |
| 546 new_expanded.height() - expanded.height()); | 546 new_expanded.height() - expanded.height()); |
| 547 message_handler_->SetBounds(new_expanded, old_content_size != bounds.size()); | 547 message_handler_->SetBounds(new_expanded, old_content_size != bounds.size()); |
| 548 } | 548 } |
| 549 | 549 |
| 550 gfx::Point DesktopWindowTreeHostWin::GetLocationOnScreenInPixels() const { | 550 gfx::Point DesktopWindowTreeHostWin::GetLocationOnScreenInPixels() const { |
| 551 return GetBoundsInPixels().origin(); | 551 return GetBoundsInPixels().origin(); |
| 552 } | 552 } |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 | 996 |
| 997 // static | 997 // static |
| 998 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( | 998 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( |
| 999 internal::NativeWidgetDelegate* native_widget_delegate, | 999 internal::NativeWidgetDelegate* native_widget_delegate, |
| 1000 DesktopNativeWidgetAura* desktop_native_widget_aura) { | 1000 DesktopNativeWidgetAura* desktop_native_widget_aura) { |
| 1001 return new DesktopWindowTreeHostWin(native_widget_delegate, | 1001 return new DesktopWindowTreeHostWin(native_widget_delegate, |
| 1002 desktop_native_widget_aura); | 1002 desktop_native_widget_aura); |
| 1003 } | 1003 } |
| 1004 | 1004 |
| 1005 } // namespace views | 1005 } // namespace views |
| OLD | NEW |