summaryrefslogtreecommitdiffstats
path: root/ui/gfx/mac
diff options
context:
space:
mode:
authorjackhou <jackhou@chromium.org>2015-04-01 17:37:52 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-02 00:38:23 +0000
commitcc9931870450252a8c84d08f7c671a0a695a266c (patch)
tree4769449359db1a4390a4f5513468df24032ea3c3 /ui/gfx/mac
parent45da3f6b29852e8b14727be62cda757ccfb85c75 (diff)
downloadchromium_src-cc9931870450252a8c84d08f7c671a0a695a266c.zip
chromium_src-cc9931870450252a8c84d08f7c671a0a695a266c.tar.gz
chromium_src-cc9931870450252a8c84d08f7c671a0a695a266c.tar.bz2
Revert of [MacViews] Implement size constraints for app windows. (patchset #9 id:160001 of https://codereview.chromium.org/1023083002/)
Reason for revert: Broke GN build: http://build.chromium.org/p/chromium.mac/builders/Mac%20GN/builds/6200 Original issue's description: > [MacViews] Implement size constraints for app windows. > > This works the same way as NativeAppWindowCocoa by setting > properties on the NSWindow in OnSizeConstraintsChanged. > > This also moves some code in common with NativeAppWindowCocoa > out to c/b/ui/cocoa/apps/nswindow_util.h. More code will be moved > there as they're implemented on MacViews, e.g. > CalculateDraggableRegions. > > BUG=459877 TBR=tapted@chromium.org,thakis@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=459877 Review URL: https://codereview.chromium.org/1051953003 Cr-Commit-Position: refs/heads/master@{#323378}
Diffstat (limited to 'ui/gfx/mac')
-rw-r--r--ui/gfx/mac/nswindow_frame_controls.h31
-rw-r--r--ui/gfx/mac/nswindow_frame_controls.mm63
2 files changed, 0 insertions, 94 deletions
diff --git a/ui/gfx/mac/nswindow_frame_controls.h b/ui/gfx/mac/nswindow_frame_controls.h
deleted file mode 100644
index 7ec7ab7..0000000
--- a/ui/gfx/mac/nswindow_frame_controls.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef UI_GFX_MAC_NSWINDOW_FRAME_CONTROLS_H_
-#define UI_GFX_MAC_NSWINDOW_FRAME_CONTROLS_H_
-
-#include "ui/gfx/gfx_export.h"
-
-@class NSWindow;
-
-namespace gfx {
-
-class Size;
-
-// Set whether the window can be fullscreened.
-GFX_EXPORT void SetNSWindowCanFullscreen(NSWindow* window,
- bool allow_fullscreen);
-
-// Sets the min/max size of the window as well as showing/hiding resize,
-// maximize, and fullscreen controls.
-// Sizes refer to the content size (inner bounds).
-GFX_EXPORT void ApplyNSWindowSizeConstraints(NSWindow* window,
- const gfx::Size& min_size,
- const gfx::Size& max_size,
- bool can_resize,
- bool can_fullscreen);
-
-} // namespace gfx
-
-#endif // UI_GFX_MAC_NSWINDOW_FRAME_CONTROLS_H_
diff --git a/ui/gfx/mac/nswindow_frame_controls.mm b/ui/gfx/mac/nswindow_frame_controls.mm
deleted file mode 100644
index 34f7d26..0000000
--- a/ui/gfx/mac/nswindow_frame_controls.mm
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#import "ui/gfx/mac/nswindow_frame_controls.h"
-
-#import "base/mac/mac_util.h"
-#import "base/mac/sdk_forward_declarations.h"
-#include "ui/gfx/geometry/size.h"
-
-namespace {
-
-// The value used to represent an unbounded width or height.
-const int kUnboundedSize = 0;
-
-void SetResizableStyleMask(NSWindow* window, bool resizable) {
- NSUInteger style_mask = [window styleMask];
- if (resizable)
- style_mask |= NSResizableWindowMask;
- else
- style_mask &= ~NSResizableWindowMask;
- [window setStyleMask:style_mask];
-}
-
-} // namespace
-
-namespace gfx {
-
-void SetNSWindowCanFullscreen(NSWindow* window, bool allow_fullscreen) {
- NSWindowCollectionBehavior behavior = [window collectionBehavior];
- if (allow_fullscreen)
- behavior |= NSWindowCollectionBehaviorFullScreenPrimary;
- else
- behavior &= ~NSWindowCollectionBehaviorFullScreenPrimary;
- [window setCollectionBehavior:behavior];
-}
-
-void ApplyNSWindowSizeConstraints(NSWindow* window,
- const gfx::Size& min_size,
- const gfx::Size& max_size,
- bool can_resize,
- bool can_fullscreen) {
- [window setContentMinSize:NSMakeSize(min_size.width(), min_size.height())];
-
- CGFloat max_width =
- max_size.width() == kUnboundedSize ? CGFLOAT_MAX : max_size.width();
- CGFloat max_height =
- max_size.height() == kUnboundedSize ? CGFLOAT_MAX : max_size.height();
- [window setContentMaxSize:NSMakeSize(max_width, max_height)];
-
- SetResizableStyleMask(window, can_resize);
- [window setShowsResizeIndicator:can_resize];
-
- // Set the window to participate in Lion Fullscreen mode. Setting this flag
- // has no effect on Snow Leopard or earlier. UI controls for fullscreen are
- // only shown for windows that have unbounded size.
- if (base::mac::IsOSLionOrLater())
- SetNSWindowCanFullscreen(window, can_fullscreen);
-
- [[window standardWindowButton:NSWindowZoomButton] setEnabled:can_fullscreen];
-}
-
-} // namespace gfx