| Index: chrome/browser/ui/cocoa/framed_browser_window.mm
|
| diff --git a/chrome/browser/ui/cocoa/framed_browser_window.mm b/chrome/browser/ui/cocoa/framed_browser_window.mm
|
| index 5d098be8d3c00a47cd7a24ab4c2703c7ba498748..e1b0de04aa98978f6426de971e511790c61b11e0 100644
|
| --- a/chrome/browser/ui/cocoa/framed_browser_window.mm
|
| +++ b/chrome/browser/ui/cocoa/framed_browser_window.mm
|
| @@ -6,6 +6,7 @@
|
|
|
| #include "base/logging.h"
|
| #include "base/mac/sdk_forward_declarations.h"
|
| +#include "base/metrics/histogram.h"
|
| #include "chrome/browser/global_keyboard_shortcuts_mac.h"
|
| #include "chrome/browser/profiles/profile_avatar_icon_util.h"
|
| #include "chrome/browser/themes/theme_properties.h"
|
| @@ -31,8 +32,19 @@ namespace {
|
| // like what the heuristic does when there are just a few tabs.
|
| const CGFloat kWindowGradientHeight = 24.0;
|
|
|
| +enum FrameBrowserWindowLock {
|
| + SET_FRAME_LOCKED = 0,
|
| + SET_STYLEMASK_LOCKED = 1,
|
| + FRAMEBROWSERWINDOWLOCKCOUNT = 2
|
| +};
|
| +
|
| +void LogUMASample(FrameBrowserWindowLock sample) {
|
| + UMA_HISTOGRAM_ENUMERATION("FramedBrowserWindowLock", sample,
|
| + FRAMEBROWSERWINDOWLOCKCOUNT);
|
| }
|
|
|
| +} // namespace
|
| +
|
| @interface FramedBrowserWindow (Private)
|
|
|
| - (void)adjustCloseButton:(NSNotification*)notification;
|
| @@ -40,11 +52,30 @@ const CGFloat kWindowGradientHeight = 24.0;
|
| - (void)adjustZoomButton:(NSNotification*)notification;
|
| - (void)adjustButton:(NSButton*)button
|
| ofKind:(NSWindowButton)kind;
|
| +- (void)logUMASample:(FrameBrowserWindowLock)sample;
|
|
|
| @end
|
|
|
| @implementation FramedBrowserWindow
|
|
|
| +- (void)setStyleMask:(NSUInteger)styleMask {
|
| + if (frameAndStyleMaskLock_) {
|
| + LogUMASample(FrameBrowserWindowLock::SET_FRAME_LOCKED);
|
| + return;
|
| + }
|
| + [super setStyleMask:styleMask];
|
| +}
|
| +
|
| +- (void)setFrame:(NSRect)frameRect
|
| + display:(BOOL)flag
|
| + animate:(BOOL)animateFlag {
|
| + if (frameAndStyleMaskLock_) {
|
| + LogUMASample(FrameBrowserWindowLock::SET_STYLEMASK_LOCKED);
|
| + return;
|
| + }
|
| + [super setFrame:frameRect display:flag animate:animateFlag];
|
| +}
|
| +
|
| - (id)initWithContentRect:(NSRect)contentRect
|
| hasTabStrip:(BOOL)hasTabStrip{
|
| NSUInteger styleMask = NSTitledWindowMask |
|
| @@ -97,6 +128,8 @@ const CGFloat kWindowGradientHeight = 24.0;
|
| selector:@selector(adjustZoomButton:)
|
| name:NSViewFrameDidChangeNotification
|
| object:zoomButton_];
|
| +
|
| + frameAndStyleMaskLock_ = NO;
|
| }
|
|
|
| return self;
|
| @@ -177,6 +210,12 @@ const CGFloat kWindowGradientHeight = 24.0;
|
| shouldHideTitle_ = flag;
|
| }
|
|
|
| +// This method sets a lock which prevents the the frame and style
|
| +// of the window to be changed
|
| +- (void)setFrameAndStyleMaskLock:(BOOL)lock {
|
| + frameAndStyleMaskLock_ = lock;
|
| +}
|
| +
|
| - (BOOL)_isTitleHidden {
|
| return shouldHideTitle_;
|
| }
|
|
|