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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 client_bounds.Inset(bubble_border_->GetInsets()); | 82 client_bounds.Inset(bubble_border_->GetInsets()); |
83 return client_bounds; | 83 return client_bounds; |
84 } | 84 } |
85 | 85 |
86 gfx::Rect BubbleFrameView::GetWindowBoundsForClientBounds( | 86 gfx::Rect BubbleFrameView::GetWindowBoundsForClientBounds( |
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) const { |
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 | 97 |
98 // Allow dialogs to show the system menu and be dragged. | 98 // Allow dialogs to show the system menu and be dragged. |
99 if (GetWidget()->widget_delegate()->AsDialogDelegate()) { | 99 if (GetWidget()->widget_delegate()->AsDialogDelegate()) { |
100 gfx::Rect sys_rect(0, 0, title_->x(), title_->y()); | 100 gfx::Rect sys_rect(0, 0, title_->x(), title_->y()); |
101 sys_rect.set_origin(gfx::Point(GetMirroredXForRect(sys_rect), 0)); | 101 sys_rect.set_origin(gfx::Point(GetMirroredXForRect(sys_rect), 0)); |
102 if (sys_rect.Contains(point)) | 102 if (sys_rect.Contains(point)) |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 // |offscreen_adjust|, e.g. positive |offscreen_adjust| means bubble | 310 // |offscreen_adjust|, e.g. positive |offscreen_adjust| means bubble |
311 // window needs to be moved to the right and that means we need to move arrow | 311 // window needs to be moved to the right and that means we need to move arrow |
312 // to the left, and that means negative offset. | 312 // to the left, and that means negative offset. |
313 bubble_border_->set_arrow_offset( | 313 bubble_border_->set_arrow_offset( |
314 bubble_border_->GetArrowOffset(window_bounds.size()) - offscreen_adjust); | 314 bubble_border_->GetArrowOffset(window_bounds.size()) - offscreen_adjust); |
315 if (offscreen_adjust) | 315 if (offscreen_adjust) |
316 SchedulePaint(); | 316 SchedulePaint(); |
317 } | 317 } |
318 | 318 |
319 } // namespace views | 319 } // namespace views |
OLD | NEW |