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

Unified Diff: chrome/browser/ui/cocoa/framed_browser_window.mm

Issue 1276383004: Implemented fullscreen exit animation with AppKit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactored the code to log UMA metrics Created 5 years, 4 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
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_;
}

Powered by Google App Engine
This is Rietveld 408576698