diff options
-rw-r--r-- | ash/ash_constants.cc | 5 | ||||
-rw-r--r-- | ash/ash_constants.h | 12 | ||||
-rw-r--r-- | ash/wm/frame_painter.cc | 10 | ||||
-rw-r--r-- | chrome/browser/ui/views/extensions/shell_window_views.cc | 27 |
4 files changed, 28 insertions, 26 deletions
diff --git a/ash/ash_constants.cc b/ash/ash_constants.cc index ba07082..616bee4 100644 --- a/ash/ash_constants.cc +++ b/ash/ash_constants.cc @@ -12,4 +12,9 @@ namespace ash { DEFINE_WINDOW_PROPERTY_KEY(bool, kConstrainedWindowKey, false); +const int kResizeAreaCornerSize = 16; +const int kResizeOutsideBoundsSizeTouch = 30; +const int kResizeOutsideBoundsSize = 6; +const int kResizeInsideBoundsSize = 1; + } // namespace ash diff --git a/ash/ash_constants.h b/ash/ash_constants.h index 62fde2c..17082d8 100644 --- a/ash/ash_constants.h +++ b/ash/ash_constants.h @@ -16,6 +16,18 @@ namespace ash { ASH_EXPORT extern const aura::WindowProperty<bool>* const kConstrainedWindowKey; +// In the window corners, the resize areas don't actually expand bigger, but the +// 16 px at the end of each edge triggers diagonal resizing. +ASH_EXPORT extern const int kResizeAreaCornerSize; + +// Ash windows do not have a traditional visible window frame. Window content +// extends to the edge of the window. We consider a small region outside the +// window bounds and an even smaller region overlapping the window to be the +// "non-client" area and use it for resizing. +ASH_EXPORT extern const int kResizeOutsideBoundsSizeTouch; +ASH_EXPORT extern const int kResizeOutsideBoundsSize; +ASH_EXPORT extern const int kResizeInsideBoundsSize; + } // namespace ash #endif // ASH_ASH_CONSTANTS_H_ diff --git a/ash/wm/frame_painter.cc b/ash/wm/frame_painter.cc index 80f8f4e..10fbbc6 100644 --- a/ash/wm/frame_painter.cc +++ b/ash/wm/frame_painter.cc @@ -33,16 +33,6 @@ namespace { // TODO(jamescook): Border is specified to be a single pixel overlapping // the web content and may need to be built into the shadow layers instead. const int kBorderThickness = 0; -// In the window corners, the resize areas don't actually expand bigger, but the -// 16 px at the end of each edge triggers diagonal resizing. -const int kResizeAreaCornerSize = 16; -// Ash windows do not have a traditional visible window frame. Window content -// extends to the edge of the window. We consider a small region outside the -// window bounds and an even smaller region overlapping the window to be the -// "non-client" area and use it for resizing. -const int kResizeOutsideBoundsSizeTouch = 30; -const int kResizeOutsideBoundsSize = 6; -const int kResizeInsideBoundsSize = 1; // Space between left edge of window and popup window icon. const int kIconOffsetX = 4; // Space between top of window and popup window icon. diff --git a/chrome/browser/ui/views/extensions/shell_window_views.cc b/chrome/browser/ui/views/extensions/shell_window_views.cc index e4af128..b77ead6 100644 --- a/chrome/browser/ui/views/extensions/shell_window_views.cc +++ b/chrome/browser/ui/views/extensions/shell_window_views.cc @@ -35,21 +35,13 @@ #endif #if defined(USE_ASH) +#include "ash/ash_constants.h" #include "ash/wm/custom_frame_view_ash.h" #include "ui/aura/window.h" #endif namespace { -// TODO(jeremya): these are copy/pasted from ash/wm/frame_painter.cc, and I'd -// like to find a way to avoid duplicating the constants. -#if defined(USE_ASH) -const int kResizeOutsideBoundsSizeTouch = 30; -const int kResizeOutsideBoundsSize = 6; -const int kResizeInsideBoundsSize = 1; -const int kResizeAreaCornerSize = 16; -#else -const int kResizeOutsideBoundsSizeTouch = 0; -const int kResizeOutsideBoundsSize = 0; +#if !defined(USE_ASH) const int kResizeInsideBoundsSize = 5; const int kResizeAreaCornerSize = 16; #endif @@ -130,16 +122,16 @@ void ShellWindowFrameView::Init(views::Widget* frame) { aura::Window* window = frame->GetNativeWindow(); // Ensure we get resize cursors for a few pixels outside our bounds. int outside_bounds = ui::GetDisplayLayout() == ui::LAYOUT_TOUCH ? - kResizeOutsideBoundsSizeTouch : - kResizeOutsideBoundsSize; + ash::kResizeOutsideBoundsSizeTouch : + ash::kResizeOutsideBoundsSize; window->set_hit_test_bounds_override_outer( gfx::Insets(-outside_bounds, -outside_bounds, -outside_bounds, -outside_bounds)); // Ensure we get resize cursors just inside our bounds as well. // TODO(jeremya): do we need to update these when in fullscreen/maximized? window->set_hit_test_bounds_override_inner( - gfx::Insets(kResizeInsideBoundsSize, kResizeInsideBoundsSize, - kResizeInsideBoundsSize, kResizeInsideBoundsSize)); + gfx::Insets(ash::kResizeInsideBoundsSize, ash::kResizeInsideBoundsSize, + ash::kResizeInsideBoundsSize, ash::kResizeInsideBoundsSize)); #endif } @@ -171,11 +163,14 @@ int ShellWindowFrameView::NonClientHitTest(const gfx::Point& point) { #if defined(USE_ASH) gfx::Rect expanded_bounds = bounds(); int outside_bounds = ui::GetDisplayLayout() == ui::LAYOUT_TOUCH ? - kResizeOutsideBoundsSizeTouch : - kResizeOutsideBoundsSize; + ash::kResizeOutsideBoundsSizeTouch : + ash::kResizeOutsideBoundsSize; expanded_bounds.Inset(-outside_bounds, -outside_bounds); if (!expanded_bounds.Contains(point)) return HTNOWHERE; + + int kResizeInsideBoundsSize = ash::kResizeInsideBoundsSize; + int kResizeAreaCornerSize = ash::kResizeAreaCornerSize; #endif // Check the frame first, as we allow a small area overlapping the contents |