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/window/custom_frame_view.h" | 5 #include "ui/views/window/custom_frame_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "grit/ui_resources.h" | 10 #include "grit/ui_resources.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 gfx::Rect CustomFrameView::GetWindowBoundsForClientBounds( | 143 gfx::Rect CustomFrameView::GetWindowBoundsForClientBounds( |
144 const gfx::Rect& client_bounds) const { | 144 const gfx::Rect& client_bounds) const { |
145 int top_height = NonClientTopBorderHeight(); | 145 int top_height = NonClientTopBorderHeight(); |
146 int border_thickness = NonClientBorderThickness(); | 146 int border_thickness = NonClientBorderThickness(); |
147 return gfx::Rect(std::max(0, client_bounds.x() - border_thickness), | 147 return gfx::Rect(std::max(0, client_bounds.x() - border_thickness), |
148 std::max(0, client_bounds.y() - top_height), | 148 std::max(0, client_bounds.y() - top_height), |
149 client_bounds.width() + (2 * border_thickness), | 149 client_bounds.width() + (2 * border_thickness), |
150 client_bounds.height() + top_height + border_thickness); | 150 client_bounds.height() + top_height + border_thickness); |
151 } | 151 } |
152 | 152 |
153 int CustomFrameView::NonClientHitTest(const gfx::Point& point) { | 153 int CustomFrameView::NonClientHitTest(const gfx::Point& point) const { |
154 // Sanity check. | 154 // Sanity check. |
155 if (!bounds().Contains(point)) | 155 if (!bounds().Contains(point)) |
156 return HTNOWHERE; | 156 return HTNOWHERE; |
157 | 157 |
158 int frame_component = frame_->client_view()->NonClientHitTest(point); | 158 int frame_component = frame_->client_view()->NonClientHitTest(point); |
159 | 159 |
160 // See if we're in the sysmenu region. (We check the ClientView first to be | 160 // See if we're in the sysmenu region. (We check the ClientView first to be |
161 // consistent with OpaqueBrowserFrameView; it's not really necessary here.) | 161 // consistent with OpaqueBrowserFrameView; it's not really necessary here.) |
162 gfx::Rect sysmenu_rect(IconBounds()); | 162 gfx::Rect sysmenu_rect(IconBounds()); |
163 // In maximized mode we extend the rect to the screen corner to take advantage | 163 // In maximized mode we extend the rect to the screen corner to take advantage |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 rb.GetImageNamed(normal_image_id).ToImageSkia()); | 564 rb.GetImageNamed(normal_image_id).ToImageSkia()); |
565 button->SetImage(CustomButton::STATE_HOVERED, | 565 button->SetImage(CustomButton::STATE_HOVERED, |
566 rb.GetImageNamed(hot_image_id).ToImageSkia()); | 566 rb.GetImageNamed(hot_image_id).ToImageSkia()); |
567 button->SetImage(CustomButton::STATE_PRESSED, | 567 button->SetImage(CustomButton::STATE_PRESSED, |
568 rb.GetImageNamed(pushed_image_id).ToImageSkia()); | 568 rb.GetImageNamed(pushed_image_id).ToImageSkia()); |
569 AddChildView(button); | 569 AddChildView(button); |
570 return button; | 570 return button; |
571 } | 571 } |
572 | 572 |
573 } // namespace views | 573 } // namespace views |
OLD | NEW |