summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-08 17:51:35 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-08 17:51:35 +0000
commitcb3221b804cdad65aaade7faff1f612644dee4a3 (patch)
tree97fb19f3b3704eb6e9d50440151ff99b90545da2
parent53f2de984429021bd22e4d33d7aeb2ce52137211 (diff)
downloadchromium_src-cb3221b804cdad65aaade7faff1f612644dee4a3.zip
chromium_src-cb3221b804cdad65aaade7faff1f612644dee4a3.tar.gz
chromium_src-cb3221b804cdad65aaade7faff1f612644dee4a3.tar.bz2
ash: Export some constants for some code cleanup.
BUG=none Review URL: https://chromiumcodereview.appspot.com/10825249 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150586 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ash/ash_constants.cc5
-rw-r--r--ash/ash_constants.h12
-rw-r--r--ash/wm/frame_painter.cc10
-rw-r--r--chrome/browser/ui/views/extensions/shell_window_views.cc27
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