OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser/ui/views/constrained_window_win.h" | 5 #include "chrome/browser/ui/views/constrained_window_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 | 306 |
307 int ConstrainedWindowFrameView::NonClientHitTest(const gfx::Point& point) { | 307 int ConstrainedWindowFrameView::NonClientHitTest(const gfx::Point& point) { |
308 if (!bounds().Contains(point)) | 308 if (!bounds().Contains(point)) |
309 return HTNOWHERE; | 309 return HTNOWHERE; |
310 | 310 |
311 int frame_component = container_->GetClientView()->NonClientHitTest(point); | 311 int frame_component = container_->GetClientView()->NonClientHitTest(point); |
312 | 312 |
313 // See if we're in the sysmenu region. (We check the ClientView first to be | 313 // See if we're in the sysmenu region. (We check the ClientView first to be |
314 // consistent with OpaqueBrowserFrameView; it's not really necessary here.) | 314 // consistent with OpaqueBrowserFrameView; it's not really necessary here.) |
315 gfx::Rect sysmenu_rect(IconBounds()); | 315 gfx::Rect sysmenu_rect(IconBounds()); |
316 sysmenu_rect.set_x(MirroredLeftPointForRect(sysmenu_rect)); | 316 sysmenu_rect.set_x(GetMirroredXForRect(sysmenu_rect)); |
317 if (sysmenu_rect.Contains(point)) | 317 if (sysmenu_rect.Contains(point)) |
318 return (frame_component == HTCLIENT) ? HTCLIENT : HTSYSMENU; | 318 return (frame_component == HTCLIENT) ? HTCLIENT : HTSYSMENU; |
319 | 319 |
320 if (frame_component != HTNOWHERE) | 320 if (frame_component != HTNOWHERE) |
321 return frame_component; | 321 return frame_component; |
322 | 322 |
323 // Then see if the point is within any of the window controls. | 323 // Then see if the point is within any of the window controls. |
324 if (close_button_->GetBounds(APPLY_MIRRORING_TRANSFORMATION).Contains(point)) | 324 if (close_button_->GetMirroredBounds().Contains(point)) |
325 return HTCLOSE; | 325 return HTCLOSE; |
326 | 326 |
327 int window_component = GetHTComponentForFrame(point, kFrameBorderThickness, | 327 int window_component = GetHTComponentForFrame(point, kFrameBorderThickness, |
328 NonClientBorderThickness(), kResizeAreaCornerSize, kResizeAreaCornerSize, | 328 NonClientBorderThickness(), kResizeAreaCornerSize, kResizeAreaCornerSize, |
329 container_->GetDelegate()->CanResize()); | 329 container_->GetDelegate()->CanResize()); |
330 // Fall back to the caption if no other component matches. | 330 // Fall back to the caption if no other component matches. |
331 return (window_component == HTNOWHERE) ? HTCAPTION : window_component; | 331 return (window_component == HTNOWHERE) ? HTCAPTION : window_component; |
332 } | 332 } |
333 | 333 |
334 void ConstrainedWindowFrameView::GetWindowMask(const gfx::Size& size, | 334 void ConstrainedWindowFrameView::GetWindowMask(const gfx::Size& size, |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 height() - bottom_left_corner->height()); | 474 height() - bottom_left_corner->height()); |
475 | 475 |
476 // Left. | 476 // Left. |
477 canvas->TileImageInt(*left_edge, 0, top_left_corner->height(), | 477 canvas->TileImageInt(*left_edge, 0, top_left_corner->height(), |
478 left_edge->width(), | 478 left_edge->width(), |
479 height() - top_left_corner->height() - bottom_left_corner->height()); | 479 height() - top_left_corner->height() - bottom_left_corner->height()); |
480 } | 480 } |
481 | 481 |
482 void ConstrainedWindowFrameView::PaintTitleBar(gfx::Canvas* canvas) { | 482 void ConstrainedWindowFrameView::PaintTitleBar(gfx::Canvas* canvas) { |
483 canvas->DrawStringInt(container_->GetWindowTitle(), *title_font_, | 483 canvas->DrawStringInt(container_->GetWindowTitle(), *title_font_, |
484 GetTitleColor(), MirroredLeftPointForRect(title_bounds_), | 484 GetTitleColor(), GetMirroredXForRect(title_bounds_), |
485 title_bounds_.y(), title_bounds_.width(), title_bounds_.height()); | 485 title_bounds_.y(), title_bounds_.width(), title_bounds_.height()); |
486 } | 486 } |
487 | 487 |
488 void ConstrainedWindowFrameView::PaintClientEdge(gfx::Canvas* canvas) { | 488 void ConstrainedWindowFrameView::PaintClientEdge(gfx::Canvas* canvas) { |
489 gfx::Rect client_edge_bounds(CalculateClientAreaBounds(width(), height())); | 489 gfx::Rect client_edge_bounds(CalculateClientAreaBounds(width(), height())); |
490 client_edge_bounds.Inset(-kClientEdgeThickness, -kClientEdgeThickness); | 490 client_edge_bounds.Inset(-kClientEdgeThickness, -kClientEdgeThickness); |
491 gfx::Rect frame_shadow_bounds(client_edge_bounds); | 491 gfx::Rect frame_shadow_bounds(client_edge_bounds); |
492 frame_shadow_bounds.Inset(-kFrameShadowThickness, -kFrameShadowThickness); | 492 frame_shadow_bounds.Inset(-kFrameShadowThickness, -kFrameShadowThickness); |
493 | 493 |
494 canvas->FillRectInt(kContentsBorderShadow, frame_shadow_bounds.x(), | 494 canvas->FillRectInt(kContentsBorderShadow, frame_shadow_bounds.x(), |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 | 672 |
673 | 673 |
674 // static | 674 // static |
675 ConstrainedWindow* ConstrainedWindow::CreateConstrainedDialog( | 675 ConstrainedWindow* ConstrainedWindow::CreateConstrainedDialog( |
676 TabContents* parent, | 676 TabContents* parent, |
677 views::WindowDelegate* window_delegate) { | 677 views::WindowDelegate* window_delegate) { |
678 ConstrainedWindowWin* window = new ConstrainedWindowWin(parent, | 678 ConstrainedWindowWin* window = new ConstrainedWindowWin(parent, |
679 window_delegate); | 679 window_delegate); |
680 return window; | 680 return window; |
681 } | 681 } |
OLD | NEW |