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 "ash/wm/frame_painter.h" | 5 #include "ash/wm/frame_painter.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
9 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
10 #include "base/logging.h" // DCHECK | 10 #include "base/logging.h" // DCHECK |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_TOP).ToImageSkia(); | 196 rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_TOP).ToImageSkia(); |
197 top_right_corner_ = | 197 top_right_corner_ = |
198 rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_TOP_RIGHT).ToImageSkia(); | 198 rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_TOP_RIGHT).ToImageSkia(); |
199 header_left_edge_ = | 199 header_left_edge_ = |
200 rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_LEFT).ToImageSkia(); | 200 rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_LEFT).ToImageSkia(); |
201 header_right_edge_ = | 201 header_right_edge_ = |
202 rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_RIGHT).ToImageSkia(); | 202 rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_RIGHT).ToImageSkia(); |
203 | 203 |
204 window_ = frame->GetNativeWindow(); | 204 window_ = frame->GetNativeWindow(); |
205 // Ensure we get resize cursors for a few pixels outside our bounds. | 205 // Ensure we get resize cursors for a few pixels outside our bounds. |
206 int outside_bounds = ui::DisplayLayout() == ui::LAYOUT_TOUCH ? | 206 int outside_bounds = ui::GetDisplayLayout() == ui::LAYOUT_TOUCH ? |
207 kResizeOutsideBoundsSizeTouch : | 207 kResizeOutsideBoundsSizeTouch : |
208 kResizeOutsideBoundsSize; | 208 kResizeOutsideBoundsSize; |
209 window_->set_hit_test_bounds_override_outer( | 209 window_->set_hit_test_bounds_override_outer( |
210 gfx::Insets(-outside_bounds, -outside_bounds, | 210 gfx::Insets(-outside_bounds, -outside_bounds, |
211 -outside_bounds, -outside_bounds)); | 211 -outside_bounds, -outside_bounds)); |
212 // Ensure we get resize cursors just inside our bounds as well. | 212 // Ensure we get resize cursors just inside our bounds as well. |
213 window_->set_hit_test_bounds_override_inner( | 213 window_->set_hit_test_bounds_override_inner( |
214 gfx::Insets(kResizeInsideBoundsSize, kResizeInsideBoundsSize, | 214 gfx::Insets(kResizeInsideBoundsSize, kResizeInsideBoundsSize, |
215 kResizeInsideBoundsSize, kResizeInsideBoundsSize)); | 215 kResizeInsideBoundsSize, kResizeInsideBoundsSize)); |
216 | 216 |
(...skipping 18 matching lines...) Expand all Loading... |
235 const gfx::Rect& client_bounds) const { | 235 const gfx::Rect& client_bounds) const { |
236 return gfx::Rect(std::max(0, client_bounds.x() - kBorderThickness), | 236 return gfx::Rect(std::max(0, client_bounds.x() - kBorderThickness), |
237 std::max(0, client_bounds.y() - top_height), | 237 std::max(0, client_bounds.y() - top_height), |
238 client_bounds.width() + (2 * kBorderThickness), | 238 client_bounds.width() + (2 * kBorderThickness), |
239 client_bounds.height() + top_height + kBorderThickness); | 239 client_bounds.height() + top_height + kBorderThickness); |
240 } | 240 } |
241 | 241 |
242 int FramePainter::NonClientHitTest(views::NonClientFrameView* view, | 242 int FramePainter::NonClientHitTest(views::NonClientFrameView* view, |
243 const gfx::Point& point) { | 243 const gfx::Point& point) { |
244 gfx::Rect expanded_bounds = view->bounds(); | 244 gfx::Rect expanded_bounds = view->bounds(); |
245 int outside_bounds = ui::DisplayLayout() == ui::LAYOUT_TOUCH ? | 245 int outside_bounds = ui::GetDisplayLayout() == ui::LAYOUT_TOUCH ? |
246 kResizeOutsideBoundsSizeTouch : | 246 kResizeOutsideBoundsSizeTouch : |
247 kResizeOutsideBoundsSize; | 247 kResizeOutsideBoundsSize; |
248 expanded_bounds.Inset(-outside_bounds, -outside_bounds); | 248 expanded_bounds.Inset(-outside_bounds, -outside_bounds); |
249 if (!expanded_bounds.Contains(point)) | 249 if (!expanded_bounds.Contains(point)) |
250 return HTNOWHERE; | 250 return HTNOWHERE; |
251 | 251 |
252 // No avatar button. | 252 // No avatar button. |
253 | 253 |
254 // Check the frame first, as we allow a small area overlapping the contents | 254 // Check the frame first, as we allow a small area overlapping the contents |
255 // to be used for resize handles. | 255 // to be used for resize handles. |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 for (std::set<FramePainter*>::const_iterator it = instances_->begin(); | 622 for (std::set<FramePainter*>::const_iterator it = instances_->begin(); |
623 it != instances_->end(); | 623 it != instances_->end(); |
624 ++it) { | 624 ++it) { |
625 FramePainter* painter = *it; | 625 FramePainter* painter = *it; |
626 if (IsVisibleNormalWindow(painter->window_)) | 626 if (IsVisibleNormalWindow(painter->window_)) |
627 painter->frame_->non_client_view()->SchedulePaint(); | 627 painter->frame_->non_client_view()->SchedulePaint(); |
628 } | 628 } |
629 } | 629 } |
630 | 630 |
631 } // namespace ash | 631 } // namespace ash |
OLD | NEW |