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

Side by Side Diff: chrome/browser/ui/views/apps/native_app_window_frame_view_mac.mm

Issue 1146873002: [MacViews] Enable dragging a window by its caption/draggable areas. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove CocoaNonClientDragMaskView, change BridgedContentView instead. Remove CGEventTap implementat… Created 5 years, 7 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/apps/native_app_window_frame_view_mac.h" 5 #include "chrome/browser/ui/views/apps/native_app_window_frame_view_mac.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "extensions/browser/app_window/native_app_window.h"
10 #include "ui/base/hit_test.h"
9 #import "ui/gfx/mac/coordinate_conversion.h" 11 #import "ui/gfx/mac/coordinate_conversion.h"
10 #include "ui/views/widget/widget.h" 12 #include "ui/views/widget/widget.h"
11 13
12 NativeAppWindowFrameViewMac::NativeAppWindowFrameViewMac(views::Widget* frame) 14 NativeAppWindowFrameViewMac::NativeAppWindowFrameViewMac(
13 : views::NativeFrameView(frame) { 15 views::Widget* frame,
16 extensions::NativeAppWindow* window)
17 : views::NativeFrameView(frame), native_app_window_(window) {
14 } 18 }
15 19
16 NativeAppWindowFrameViewMac::~NativeAppWindowFrameViewMac() { 20 NativeAppWindowFrameViewMac::~NativeAppWindowFrameViewMac() {
17 } 21 }
18 22
19 gfx::Rect NativeAppWindowFrameViewMac::GetWindowBoundsForClientBounds( 23 gfx::Rect NativeAppWindowFrameViewMac::GetWindowBoundsForClientBounds(
20 const gfx::Rect& client_bounds) const { 24 const gfx::Rect& client_bounds) const {
21 NSWindow* ns_window = GetWidget()->GetNativeWindow(); 25 NSWindow* ns_window = GetWidget()->GetNativeWindow();
22 gfx::Rect window_bounds = gfx::ScreenRectFromNSRect([ns_window 26 gfx::Rect window_bounds = gfx::ScreenRectFromNSRect([ns_window
23 frameRectForContentRect:gfx::ScreenRectToNSRect(client_bounds)]); 27 frameRectForContentRect:gfx::ScreenRectToNSRect(client_bounds)]);
24 // Enforce minimum size (1, 1) in case that |client_bounds| is passed with 28 // Enforce minimum size (1, 1) in case that |client_bounds| is passed with
25 // empty size. 29 // empty size.
26 if (window_bounds.IsEmpty()) 30 if (window_bounds.IsEmpty())
27 window_bounds.set_size(gfx::Size(1, 1)); 31 window_bounds.set_size(gfx::Size(1, 1));
28 return window_bounds; 32 return window_bounds;
29 } 33 }
34
35 int NativeAppWindowFrameViewMac::NonClientHitTest(const gfx::Point& point) {
36 if (GetWidget()->IsFullscreen())
37 return HTCLIENT;
38
39 // Check for possible draggable region in the client area for the frameless
40 // window.
41 SkRegion* draggable_region = native_app_window_->GetDraggableRegion();
42 if (draggable_region && draggable_region->contains(point.x(), point.y()))
43 return HTCAPTION;
44
45 return HTCLIENT;
tapted 2015/05/20 07:18:15 AppWindowFrameView::NonClientHitTest defaults to H
jackhou1 2015/05/22 02:49:16 I think (at least on Mac) that app windows can onl
46 }
tapted 2015/05/20 07:18:15 no you need to return HTNOWHERE ever? (otherwise D
jackhou1 2015/05/22 02:49:16 Done.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698