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

Side by Side Diff: chrome/browser/ui/views/extensions/shell_window_views.cc

Issue 10854060: ash: Use different hit-test outer-region for mouse and touch events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: scale Created 8 years, 4 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 | « ash/wm/shelf_layout_manager.cc ('k') | ui/aura/window.h » ('j') | 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 "chrome/browser/ui/views/extensions/shell_window_views.h" 5 #include "chrome/browser/ui/views/extensions/shell_window_views.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/extensions/extension_host.h" 8 #include "chrome/browser/extensions/extension_host.h"
9 #include "chrome/common/extensions/draggable_region.h" 9 #include "chrome/common/extensions/draggable_region.h"
10 #include "chrome/common/extensions/extension.h" 10 #include "chrome/common/extensions/extension.h"
(...skipping 19 matching lines...) Expand all
30 30
31 #if defined(OS_WIN) && !defined(USE_AURA) 31 #if defined(OS_WIN) && !defined(USE_AURA)
32 #include "chrome/browser/shell_integration.h" 32 #include "chrome/browser/shell_integration.h"
33 #include "chrome/browser/web_applications/web_app.h" 33 #include "chrome/browser/web_applications/web_app.h"
34 #include "ui/base/win/shell.h" 34 #include "ui/base/win/shell.h"
35 #endif 35 #endif
36 36
37 #if defined(USE_ASH) 37 #if defined(USE_ASH)
38 #include "ash/ash_constants.h" 38 #include "ash/ash_constants.h"
39 #include "ash/wm/custom_frame_view_ash.h" 39 #include "ash/wm/custom_frame_view_ash.h"
40 #include "ui/aura/env.h"
40 #include "ui/aura/window.h" 41 #include "ui/aura/window.h"
41 #endif 42 #endif
42 43
43 namespace { 44 namespace {
44 #if !defined(USE_ASH) 45 #if !defined(USE_ASH)
45 const int kResizeInsideBoundsSize = 5; 46 const int kResizeInsideBoundsSize = 5;
46 const int kResizeAreaCornerSize = 16; 47 const int kResizeAreaCornerSize = 16;
47 #endif 48 #endif
48 49
49 // Height of the chrome-style caption, in pixels. 50 // Height of the chrome-style caption, in pixels.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 close_button_->SetImage(views::CustomButton::BS_PUSHED, 115 close_button_->SetImage(views::CustomButton::BS_PUSHED,
115 rb.GetNativeImageNamed(IDR_CLOSE_BAR_P).ToImageSkia()); 116 rb.GetNativeImageNamed(IDR_CLOSE_BAR_P).ToImageSkia());
116 close_button_->SetAccessibleName( 117 close_button_->SetAccessibleName(
117 l10n_util::GetStringUTF16(IDS_APP_ACCNAME_CLOSE)); 118 l10n_util::GetStringUTF16(IDS_APP_ACCNAME_CLOSE));
118 AddChildView(close_button_); 119 AddChildView(close_button_);
119 } 120 }
120 121
121 #if defined(USE_ASH) 122 #if defined(USE_ASH)
122 aura::Window* window = frame->GetNativeWindow(); 123 aura::Window* window = frame->GetNativeWindow();
123 // Ensure we get resize cursors for a few pixels outside our bounds. 124 // Ensure we get resize cursors for a few pixels outside our bounds.
124 int outside_bounds = ui::GetDisplayLayout() == ui::LAYOUT_TOUCH ? 125 window->SetHitTestBoundsOverrideOuter(
125 ash::kResizeOutsideBoundsSizeTouch : 126 gfx::Insets(-ash::kResizeOutsideBoundsSize,
126 ash::kResizeOutsideBoundsSize; 127 -ash::kResizeOutsideBoundsSize,
127 window->set_hit_test_bounds_override_outer( 128 -ash::kResizeOutsideBoundsSize,
128 gfx::Insets(-outside_bounds, -outside_bounds, 129 -ash::kResizeOutsideBoundsSize),
129 -outside_bounds, -outside_bounds)); 130 ash::kResizeOutsideBoundsScaleForTouch);
130 // Ensure we get resize cursors just inside our bounds as well. 131 // Ensure we get resize cursors just inside our bounds as well.
131 // TODO(jeremya): do we need to update these when in fullscreen/maximized? 132 // TODO(jeremya): do we need to update these when in fullscreen/maximized?
132 window->set_hit_test_bounds_override_inner( 133 window->set_hit_test_bounds_override_inner(
133 gfx::Insets(ash::kResizeInsideBoundsSize, ash::kResizeInsideBoundsSize, 134 gfx::Insets(ash::kResizeInsideBoundsSize, ash::kResizeInsideBoundsSize,
134 ash::kResizeInsideBoundsSize, ash::kResizeInsideBoundsSize)); 135 ash::kResizeInsideBoundsSize, ash::kResizeInsideBoundsSize));
135 #endif 136 #endif
136 } 137 }
137 138
138 gfx::Rect ShellWindowFrameView::GetBoundsForClientView() const { 139 gfx::Rect ShellWindowFrameView::GetBoundsForClientView() const {
139 if (window_->frameless() || frame_->IsFullscreen()) 140 if (window_->frameless() || frame_->IsFullscreen())
(...skipping 15 matching lines...) Expand all
155 std::max(header_width, client_bounds.width()), 156 std::max(header_width, client_bounds.width()),
156 client_bounds.height() + kCaptionHeight); 157 client_bounds.height() + kCaptionHeight);
157 } 158 }
158 159
159 int ShellWindowFrameView::NonClientHitTest(const gfx::Point& point) { 160 int ShellWindowFrameView::NonClientHitTest(const gfx::Point& point) {
160 if (frame_->IsFullscreen()) 161 if (frame_->IsFullscreen())
161 return HTCLIENT; 162 return HTCLIENT;
162 163
163 #if defined(USE_ASH) 164 #if defined(USE_ASH)
164 gfx::Rect expanded_bounds = bounds(); 165 gfx::Rect expanded_bounds = bounds();
165 int outside_bounds = ui::GetDisplayLayout() == ui::LAYOUT_TOUCH ? 166 int outside_bounds = ash::kResizeOutsideBoundsSize;
166 ash::kResizeOutsideBoundsSizeTouch : 167 if (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH &&
167 ash::kResizeOutsideBoundsSize; 168 aura::Env::GetInstance()->is_touch_down()) {
169 outside_bounds *= ash::kResizeOutsideBoundsScaleForTouch;
170 }
168 expanded_bounds.Inset(-outside_bounds, -outside_bounds); 171 expanded_bounds.Inset(-outside_bounds, -outside_bounds);
169 if (!expanded_bounds.Contains(point)) 172 if (!expanded_bounds.Contains(point))
170 return HTNOWHERE; 173 return HTNOWHERE;
171 174
172 int kResizeInsideBoundsSize = ash::kResizeInsideBoundsSize; 175 int kResizeInsideBoundsSize = ash::kResizeInsideBoundsSize;
173 int kResizeAreaCornerSize = ash::kResizeAreaCornerSize; 176 int kResizeAreaCornerSize = ash::kResizeAreaCornerSize;
174 #endif 177 #endif
175 178
176 // Check the frame first, as we allow a small area overlapping the contents 179 // Check the frame first, as we allow a small area overlapping the contents
177 // to be used for resize handles. 180 // to be used for resize handles.
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 OnViewWasResized(); 579 OnViewWasResized();
577 } 580 }
578 581
579 // static 582 // static
580 ShellWindow* ShellWindow::CreateImpl(Profile* profile, 583 ShellWindow* ShellWindow::CreateImpl(Profile* profile,
581 const extensions::Extension* extension, 584 const extensions::Extension* extension,
582 const GURL& url, 585 const GURL& url,
583 const ShellWindow::CreateParams& params) { 586 const ShellWindow::CreateParams& params) {
584 return new ShellWindowViews(profile, extension, url, params); 587 return new ShellWindowViews(profile, extension, url, params);
585 } 588 }
OLDNEW
« no previous file with comments | « ash/wm/shelf_layout_manager.cc ('k') | ui/aura/window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698