Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(309)

Side by Side Diff: ash/wm/frame_painter.cc

Issue 10703069: ash: Touch-optimize the window-resize region for touch-events only. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "grit/ui_resources.h" 11 #include "grit/ui_resources.h"
12 #include "grit/ui_resources_standard.h" 12 #include "grit/ui_resources_standard.h"
13 #include "third_party/skia/include/core/SkCanvas.h" 13 #include "third_party/skia/include/core/SkCanvas.h"
14 #include "third_party/skia/include/core/SkColor.h" 14 #include "third_party/skia/include/core/SkColor.h"
15 #include "third_party/skia/include/core/SkPaint.h" 15 #include "third_party/skia/include/core/SkPaint.h"
16 #include "third_party/skia/include/core/SkPath.h" 16 #include "third_party/skia/include/core/SkPath.h"
17 #include "ui/aura/client/aura_constants.h" 17 #include "ui/aura/client/aura_constants.h"
18 #include "ui/aura/env.h"
18 #include "ui/aura/window.h" 19 #include "ui/aura/window.h"
19 #include "ui/base/animation/slide_animation.h" 20 #include "ui/base/animation/slide_animation.h"
20 #include "ui/base/hit_test.h" 21 #include "ui/base/hit_test.h"
21 #include "ui/base/layout.h" 22 #include "ui/base/layout.h"
22 #include "ui/base/resource/resource_bundle.h" 23 #include "ui/base/resource/resource_bundle.h"
23 #include "ui/base/theme_provider.h" 24 #include "ui/base/theme_provider.h"
24 #include "ui/gfx/canvas.h" 25 #include "ui/gfx/canvas.h"
25 #include "ui/gfx/font.h" 26 #include "ui/gfx/font.h"
26 #include "ui/gfx/image/image.h" 27 #include "ui/gfx/image/image.h"
27 #include "ui/views/controls/button/image_button.h" 28 #include "ui/views/controls/button/image_button.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 const gfx::Rect& client_bounds) const { 223 const gfx::Rect& client_bounds) const {
223 return gfx::Rect(std::max(0, client_bounds.x() - kBorderThickness), 224 return gfx::Rect(std::max(0, client_bounds.x() - kBorderThickness),
224 std::max(0, client_bounds.y() - top_height), 225 std::max(0, client_bounds.y() - top_height),
225 client_bounds.width() + (2 * kBorderThickness), 226 client_bounds.width() + (2 * kBorderThickness),
226 client_bounds.height() + top_height + kBorderThickness); 227 client_bounds.height() + top_height + kBorderThickness);
227 } 228 }
228 229
229 int FramePainter::NonClientHitTest(views::NonClientFrameView* view, 230 int FramePainter::NonClientHitTest(views::NonClientFrameView* view,
230 const gfx::Point& point) { 231 const gfx::Point& point) {
231 gfx::Rect expanded_bounds = view->bounds(); 232 gfx::Rect expanded_bounds = view->bounds();
232 int outside_bounds = ui::GetDisplayLayout() == ui::LAYOUT_TOUCH ? 233 int outside_bounds = kResizeOutsideBoundsSize;
233 kResizeOutsideBoundsSizeTouch : 234
234 kResizeOutsideBoundsSize; 235 if (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH &&
236 aura::Env::GetInstance()->is_touch_down()) {
237 outside_bounds = kResizeOutsideBoundsSizeTouch;
238 }
235 expanded_bounds.Inset(-outside_bounds, -outside_bounds); 239 expanded_bounds.Inset(-outside_bounds, -outside_bounds);
240
236 if (!expanded_bounds.Contains(point)) 241 if (!expanded_bounds.Contains(point))
237 return HTNOWHERE; 242 return HTNOWHERE;
238 243
239 // No avatar button. 244 // No avatar button.
240 245
241 // Check the frame first, as we allow a small area overlapping the contents 246 // Check the frame first, as we allow a small area overlapping the contents
242 // to be used for resize handles. 247 // to be used for resize handles.
243 bool can_ever_resize = frame_->widget_delegate() ? 248 bool can_ever_resize = frame_->widget_delegate() ?
244 frame_->widget_delegate()->CanResize() : 249 frame_->widget_delegate()->CanResize() :
245 false; 250 false;
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 for (std::set<FramePainter*>::const_iterator it = instances_->begin(); 614 for (std::set<FramePainter*>::const_iterator it = instances_->begin();
610 it != instances_->end(); 615 it != instances_->end();
611 ++it) { 616 ++it) {
612 FramePainter* painter = *it; 617 FramePainter* painter = *it;
613 if (IsVisibleNormalWindow(painter->window_)) 618 if (IsVisibleNormalWindow(painter->window_))
614 painter->frame_->non_client_view()->SchedulePaint(); 619 painter->frame_->non_client_view()->SchedulePaint();
615 } 620 }
616 } 621 }
617 622
618 } // namespace ash 623 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698