| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/views/custom_frame_window.h" | 5 #include "chrome/views/custom_frame_window.h" |
| 6 | 6 |
| 7 #include "base/gfx/point.h" | 7 #include "base/gfx/point.h" |
| 8 #include "base/gfx/size.h" | 8 #include "base/gfx/size.h" |
| 9 #include "base/win_util.h" | 9 #include "base/win_util.h" |
| 10 #include "chrome/app/theme/theme_resources.h" | 10 #include "chrome/app/theme/theme_resources.h" |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 int height) const { | 389 int height) const { |
| 390 int top_margin = CalculateContentsTop(); | 390 int top_margin = CalculateContentsTop(); |
| 391 return gfx::Rect(kWindowHorizontalBorderSize, top_margin, | 391 return gfx::Rect(kWindowHorizontalBorderSize, top_margin, |
| 392 std::max(0, width - (2 * kWindowHorizontalBorderSize)), | 392 std::max(0, width - (2 * kWindowHorizontalBorderSize)), |
| 393 std::max(0, height - top_margin - kWindowVerticalBorderSize)); | 393 std::max(0, height - top_margin - kWindowVerticalBorderSize)); |
| 394 } | 394 } |
| 395 | 395 |
| 396 gfx::Size DefaultNonClientView::CalculateWindowSizeForClientSize( | 396 gfx::Size DefaultNonClientView::CalculateWindowSizeForClientSize( |
| 397 int width, | 397 int width, |
| 398 int height) const { | 398 int height) const { |
| 399 int contents_top = CalculateContentsTop(); | |
| 400 return gfx::Size(width + (2 * kWindowHorizontalBorderSize), | 399 return gfx::Size(width + (2 * kWindowHorizontalBorderSize), |
| 401 height + CalculateContentsTop() + kWindowVerticalBorderSize); | 400 height + CalculateContentsTop() + kWindowVerticalBorderSize); |
| 402 } | 401 } |
| 403 | 402 |
| 404 CPoint DefaultNonClientView::GetSystemMenuPoint() const { | 403 CPoint DefaultNonClientView::GetSystemMenuPoint() const { |
| 405 CPoint system_menu_point( | 404 CPoint system_menu_point( |
| 406 system_menu_button_->x(), | 405 system_menu_button_->x(), |
| 407 system_menu_button_->y() + system_menu_button_->height()); | 406 system_menu_button_->y() + system_menu_button_->height()); |
| 408 MapWindowPoints(container_->GetHWND(), HWND_DESKTOP, &system_menu_point, 1); | 407 MapWindowPoints(container_->GetHWND(), HWND_DESKTOP, &system_menu_point, 1); |
| 409 return system_menu_point; | 408 return system_menu_point; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 440 if (button_bounds.Contains(point)) | 439 if (button_bounds.Contains(point)) |
| 441 return HTMAXBUTTON; | 440 return HTMAXBUTTON; |
| 442 button_bounds = minimize_button_->GetBounds(APPLY_MIRRORING_TRANSFORMATION); | 441 button_bounds = minimize_button_->GetBounds(APPLY_MIRRORING_TRANSFORMATION); |
| 443 if (button_bounds.Contains(point)) | 442 if (button_bounds.Contains(point)) |
| 444 return HTMINBUTTON; | 443 return HTMINBUTTON; |
| 445 button_bounds = | 444 button_bounds = |
| 446 system_menu_button_->GetBounds(APPLY_MIRRORING_TRANSFORMATION); | 445 system_menu_button_->GetBounds(APPLY_MIRRORING_TRANSFORMATION); |
| 447 if (button_bounds.Contains(point)) | 446 if (button_bounds.Contains(point)) |
| 448 return HTSYSMENU; | 447 return HTSYSMENU; |
| 449 | 448 |
| 450 component = GetHTComponentForFrame( | 449 component = GetHTComponentForFrame(point, kResizeAreaNorthSize, |
| 451 point, | 450 kResizeAreaSize, kResizeAreaSize, kResizeAreaCornerSize, |
| 452 kResizeAreaSize, | |
| 453 kResizeAreaCornerSize, | |
| 454 kResizeAreaNorthSize, | |
| 455 container_->window_delegate()->CanResize()); | 451 container_->window_delegate()->CanResize()); |
| 456 if (component == HTNOWHERE) { | 452 if (component == HTNOWHERE) { |
| 457 // Finally fall back to the caption. | 453 // Finally fall back to the caption. |
| 458 if (bounds().Contains(point)) | 454 if (bounds().Contains(point)) |
| 459 component = HTCAPTION; | 455 component = HTCAPTION; |
| 460 // Otherwise, the point is outside the window's bounds. | 456 // Otherwise, the point is outside the window's bounds. |
| 461 } | 457 } |
| 462 return component; | 458 return component; |
| 463 } | 459 } |
| 464 | 460 |
| (...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1312 if ((GetKeyState(VK_CONTROL) & 0x80) == 0x80) | 1308 if ((GetKeyState(VK_CONTROL) & 0x80) == 0x80) |
| 1313 message_flags |= MK_CONTROL; | 1309 message_flags |= MK_CONTROL; |
| 1314 if ((GetKeyState(VK_SHIFT) & 0x80) == 0x80) | 1310 if ((GetKeyState(VK_SHIFT) & 0x80) == 0x80) |
| 1315 message_flags |= MK_SHIFT; | 1311 message_flags |= MK_SHIFT; |
| 1316 message_flags |= flags; | 1312 message_flags |= flags; |
| 1317 ProcessMousePressed(temp, message_flags, false); | 1313 ProcessMousePressed(temp, message_flags, false); |
| 1318 } | 1314 } |
| 1319 | 1315 |
| 1320 } // namespace views | 1316 } // namespace views |
| 1321 | 1317 |
| OLD | NEW |