| 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/bubble/bubble_frame_view.h" | 5 #include "ui/views/bubble/bubble_frame_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "grit/ui_resources.h" | 9 #include "grit/ui_resources.h" |
| 10 #include "ui/base/hit_test.h" | 10 #include "ui/base/hit_test.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 const gfx::Rect& client_bounds) const { | 87 const gfx::Rect& client_bounds) const { |
| 88 return const_cast<BubbleFrameView*>(this)->GetUpdatedWindowBounds( | 88 return const_cast<BubbleFrameView*>(this)->GetUpdatedWindowBounds( |
| 89 gfx::Rect(), client_bounds.size(), false); | 89 gfx::Rect(), client_bounds.size(), false); |
| 90 } | 90 } |
| 91 | 91 |
| 92 int BubbleFrameView::NonClientHitTest(const gfx::Point& point) { | 92 int BubbleFrameView::NonClientHitTest(const gfx::Point& point) { |
| 93 if (!bounds().Contains(point)) | 93 if (!bounds().Contains(point)) |
| 94 return HTNOWHERE; | 94 return HTNOWHERE; |
| 95 if (close_->visible() && close_->GetMirroredBounds().Contains(point)) | 95 if (close_->visible() && close_->GetMirroredBounds().Contains(point)) |
| 96 return HTCLOSE; | 96 return HTCLOSE; |
| 97 if (!GetWidget()->widget_delegate()->CanResize()) | |
| 98 return GetWidget()->client_view()->NonClientHitTest(point); | |
| 99 | 97 |
| 100 const int size = bubble_border_->GetBorderThickness() + 4; | 98 // Allow dialogs to show the system menu and be dragged. |
| 101 const int hit = GetHTComponentForFrame(point, size, size, size, size, true); | 99 if (GetWidget()->widget_delegate()->AsDialogDelegate()) { |
| 102 if (hit == HTNOWHERE && point.y() < title_->bounds().bottom()) | 100 gfx::Rect sys_rect(0, 0, title_->x(), title_->y()); |
| 103 return HTCAPTION; | 101 sys_rect.set_origin(gfx::Point(GetMirroredXForRect(sys_rect), 0)); |
| 104 return hit; | 102 if (sys_rect.Contains(point)) |
| 103 return HTSYSMENU; |
| 104 if (point.y() < title_->bounds().bottom()) |
| 105 return HTCAPTION; |
| 106 } |
| 107 |
| 108 return GetWidget()->client_view()->NonClientHitTest(point); |
| 105 } | 109 } |
| 106 | 110 |
| 107 void BubbleFrameView::GetWindowMask(const gfx::Size& size, | 111 void BubbleFrameView::GetWindowMask(const gfx::Size& size, |
| 108 gfx::Path* window_mask) { | 112 gfx::Path* window_mask) { |
| 109 if (bubble_border_->shadow() != BubbleBorder::NO_SHADOW_OPAQUE_BORDER) | 113 if (bubble_border_->shadow() != BubbleBorder::NO_SHADOW_OPAQUE_BORDER) |
| 110 return; | 114 return; |
| 111 | 115 |
| 112 // Use a window mask roughly matching the border in the image assets. | 116 // Use a window mask roughly matching the border in the image assets. |
| 113 static const int kBorderStrokeSize = 1; | 117 static const int kBorderStrokeSize = 1; |
| 114 static const SkScalar kCornerRadius = SkIntToScalar(6); | 118 static const SkScalar kCornerRadius = SkIntToScalar(6); |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 // |offscreen_adjust|, e.g. positive |offscreen_adjust| means bubble | 308 // |offscreen_adjust|, e.g. positive |offscreen_adjust| means bubble |
| 305 // window needs to be moved to the right and that means we need to move arrow | 309 // window needs to be moved to the right and that means we need to move arrow |
| 306 // to the left, and that means negative offset. | 310 // to the left, and that means negative offset. |
| 307 bubble_border_->set_arrow_offset( | 311 bubble_border_->set_arrow_offset( |
| 308 bubble_border_->GetArrowOffset(window_bounds.size()) - offscreen_adjust); | 312 bubble_border_->GetArrowOffset(window_bounds.size()) - offscreen_adjust); |
| 309 if (offscreen_adjust) | 313 if (offscreen_adjust) |
| 310 SchedulePaint(); | 314 SchedulePaint(); |
| 311 } | 315 } |
| 312 | 316 |
| 313 } // namespace views | 317 } // namespace views |
| OLD | NEW |