| 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/ash_constants.h" | 7 #include "ash/ash_constants.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
| 10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_TOP).ToImageSkia(); | 174 rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_TOP).ToImageSkia(); |
| 175 top_right_corner_ = | 175 top_right_corner_ = |
| 176 rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_TOP_RIGHT).ToImageSkia(); | 176 rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_TOP_RIGHT).ToImageSkia(); |
| 177 header_left_edge_ = | 177 header_left_edge_ = |
| 178 rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_LEFT).ToImageSkia(); | 178 rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_LEFT).ToImageSkia(); |
| 179 header_right_edge_ = | 179 header_right_edge_ = |
| 180 rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_RIGHT).ToImageSkia(); | 180 rb.GetImageNamed(IDR_AURA_WINDOW_HEADER_SHADE_RIGHT).ToImageSkia(); |
| 181 | 181 |
| 182 window_ = frame->GetNativeWindow(); | 182 window_ = frame->GetNativeWindow(); |
| 183 // Ensure we get resize cursors for a few pixels outside our bounds. | 183 // Ensure we get resize cursors for a few pixels outside our bounds. |
| 184 int outside_bounds = ui::GetDisplayLayout() == ui::LAYOUT_TOUCH ? | 184 window_->SetHitTestBoundsOverrideOuter( |
| 185 kResizeOutsideBoundsSizeTouch : | 185 gfx::Insets(-kResizeOutsideBoundsSize, -kResizeOutsideBoundsSize, |
| 186 kResizeOutsideBoundsSize; | 186 -kResizeOutsideBoundsSize, -kResizeOutsideBoundsSize), |
| 187 window_->set_hit_test_bounds_override_outer( | 187 kResizeOutsideBoundsScaleForTouch); |
| 188 gfx::Insets(-outside_bounds, -outside_bounds, | |
| 189 -outside_bounds, -outside_bounds)); | |
| 190 // Ensure we get resize cursors just inside our bounds as well. | 188 // Ensure we get resize cursors just inside our bounds as well. |
| 191 window_->set_hit_test_bounds_override_inner( | 189 window_->set_hit_test_bounds_override_inner( |
| 192 gfx::Insets(kResizeInsideBoundsSize, kResizeInsideBoundsSize, | 190 gfx::Insets(kResizeInsideBoundsSize, kResizeInsideBoundsSize, |
| 193 kResizeInsideBoundsSize, kResizeInsideBoundsSize)); | 191 kResizeInsideBoundsSize, kResizeInsideBoundsSize)); |
| 194 | 192 |
| 195 // Watch for maximize/restore/fullscreen state changes. Observer removes | 193 // Watch for maximize/restore/fullscreen state changes. Observer removes |
| 196 // itself in OnWindowDestroying() below, or in the destructor if we go away | 194 // itself in OnWindowDestroying() below, or in the destructor if we go away |
| 197 // before the window. | 195 // before the window. |
| 198 window_->AddObserver(this); | 196 window_->AddObserver(this); |
| 199 } | 197 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 217 client_bounds.height() + top_height + kBorderThickness); | 215 client_bounds.height() + top_height + kBorderThickness); |
| 218 } | 216 } |
| 219 | 217 |
| 220 int FramePainter::NonClientHitTest(views::NonClientFrameView* view, | 218 int FramePainter::NonClientHitTest(views::NonClientFrameView* view, |
| 221 const gfx::Point& point) { | 219 const gfx::Point& point) { |
| 222 gfx::Rect expanded_bounds = view->bounds(); | 220 gfx::Rect expanded_bounds = view->bounds(); |
| 223 int outside_bounds = kResizeOutsideBoundsSize; | 221 int outside_bounds = kResizeOutsideBoundsSize; |
| 224 | 222 |
| 225 if (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH && | 223 if (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH && |
| 226 aura::Env::GetInstance()->is_touch_down()) { | 224 aura::Env::GetInstance()->is_touch_down()) { |
| 227 outside_bounds = kResizeOutsideBoundsSizeTouch; | 225 outside_bounds *= kResizeOutsideBoundsScaleForTouch; |
| 228 } | 226 } |
| 229 expanded_bounds.Inset(-outside_bounds, -outside_bounds); | 227 expanded_bounds.Inset(-outside_bounds, -outside_bounds); |
| 230 | 228 |
| 231 if (!expanded_bounds.Contains(point)) | 229 if (!expanded_bounds.Contains(point)) |
| 232 return HTNOWHERE; | 230 return HTNOWHERE; |
| 233 | 231 |
| 234 // No avatar button. | 232 // No avatar button. |
| 235 | 233 |
| 236 // Check the frame first, as we allow a small area overlapping the contents | 234 // Check the frame first, as we allow a small area overlapping the contents |
| 237 // to be used for resize handles. | 235 // to be used for resize handles. |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 for (std::set<FramePainter*>::const_iterator it = instances_->begin(); | 613 for (std::set<FramePainter*>::const_iterator it = instances_->begin(); |
| 616 it != instances_->end(); | 614 it != instances_->end(); |
| 617 ++it) { | 615 ++it) { |
| 618 FramePainter* painter = *it; | 616 FramePainter* painter = *it; |
| 619 if (IsVisibleNormalWindow(painter->window_)) | 617 if (IsVisibleNormalWindow(painter->window_)) |
| 620 painter->frame_->non_client_view()->SchedulePaint(); | 618 painter->frame_->non_client_view()->SchedulePaint(); |
| 621 } | 619 } |
| 622 } | 620 } |
| 623 | 621 |
| 624 } // namespace ash | 622 } // namespace ash |
| OLD | NEW |