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

Unified Diff: ash/frame/frame_border_hit_test_controller.cc

Issue 189463013: [Refactor] Move code for painting the window header for browser windows out of ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/frame/frame_border_hit_test_controller.h ('k') | ash/frame/header_painter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/frame/frame_border_hit_test_controller.cc
diff --git a/ash/frame/frame_border_hit_test_controller.cc b/ash/frame/frame_border_hit_test_controller.cc
index 228db6b99f8e242025e1f56aaf9070a5841e0370..1ce114dd1027dd3741fa0c01b1f8a2286113d356 100644
--- a/ash/frame/frame_border_hit_test_controller.cc
+++ b/ash/frame/frame_border_hit_test_controller.cc
@@ -5,7 +5,7 @@
#include "ash/frame/frame_border_hit_test_controller.h"
#include "ash/ash_constants.h"
-#include "ash/frame/header_painter.h"
+#include "ash/frame/caption_buttons/frame_caption_button_container_view.h"
#include "ash/wm/resize_handle_window_targeter.h"
#include "ash/wm/window_state_observer.h"
#include "ui/aura/env.h"
@@ -31,8 +31,8 @@ FrameBorderHitTestController::~FrameBorderHitTestController() {
// static
int FrameBorderHitTestController::NonClientHitTest(
views::NonClientFrameView* view,
- HeaderPainter* header_painter,
- const gfx::Point& point) {
+ FrameCaptionButtonContainerView* caption_button_container,
+ const gfx::Point& point_in_widget) {
gfx::Rect expanded_bounds = view->bounds();
int outside_bounds = kResizeOutsideBoundsSize;
@@ -40,7 +40,7 @@ int FrameBorderHitTestController::NonClientHitTest(
outside_bounds *= kResizeOutsideBoundsScaleForTouch;
expanded_bounds.Inset(-outside_bounds, -outside_bounds);
- if (!expanded_bounds.Contains(point))
+ if (!expanded_bounds.Contains(point_in_widget))
return HTNOWHERE;
// Check the frame first, as we allow a small area overlapping the contents
@@ -52,7 +52,7 @@ int FrameBorderHitTestController::NonClientHitTest(
int resize_border =
frame->IsMaximized() || frame->IsFullscreen() ? 0 :
kResizeInsideBoundsSize;
- int frame_component = view->GetHTComponentForFrame(point,
+ int frame_component = view->GetHTComponentForFrame(point_in_widget,
resize_border,
resize_border,
kResizeAreaCornerSize,
@@ -61,11 +61,23 @@ int FrameBorderHitTestController::NonClientHitTest(
if (frame_component != HTNOWHERE)
return frame_component;
- int client_component = frame->client_view()->NonClientHitTest(point);
+ int client_component = frame->client_view()->NonClientHitTest(
+ point_in_widget);
if (client_component != HTNOWHERE)
return client_component;
- return header_painter->NonClientHitTest(point);
+ if (caption_button_container->visible()) {
+ gfx::Point point_in_caption_button_container(point_in_widget);
+ views::View::ConvertPointFromWidget(caption_button_container,
+ &point_in_caption_button_container);
+ int caption_button_component = caption_button_container->NonClientHitTest(
+ point_in_caption_button_container);
+ if (caption_button_component != HTNOWHERE)
+ return caption_button_component;
+ }
+
+ // Caption is a safe default.
+ return HTCAPTION;
}
} // namespace ash
« no previous file with comments | « ash/frame/frame_border_hit_test_controller.h ('k') | ash/frame/header_painter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698