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

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

Issue 12328161: [Mac] Use private, undocumented Carbon events to make the presentation mode animation better. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | « chrome/browser/ui/cocoa/presentation_mode_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/presentation_mode_controller.mm
diff --git a/chrome/browser/ui/cocoa/presentation_mode_controller.mm b/chrome/browser/ui/cocoa/presentation_mode_controller.mm
index 8b118397a84f02767090d7c46840e1fd002b70f0..fa2876d34f91d650606c8cdec4af987376411e1e 100644
--- a/chrome/browser/ui/cocoa/presentation_mode_controller.mm
+++ b/chrome/browser/ui/cocoa/presentation_mode_controller.mm
@@ -18,6 +18,7 @@ NSString* const kWillLeaveFullscreenNotification =
@"WillLeaveFullscreenNotification";
namespace {
+
// The activation zone for the main menu is 4 pixels high; if we make it any
// smaller, then the menu can be made to appear without the bar sliding down.
const CGFloat kDropdownActivationZoneHeight = 4;
@@ -32,7 +33,20 @@ const NSTimeInterval kDropdownHideDelay = 0.2;
// returns 0 when the menu bar is hidden.)
const CGFloat kFloatingBarVerticalOffset = 22;
-} // end namespace
+OSStatus MenuBarRevealHandler(EventHandlerCallRef handler,
+ EventRef event,
+ void* context) {
+ PresentationModeController* self =
+ static_cast<PresentationModeController*>(context);
+ CGFloat reveal = 0;
+ GetEventParameter(event, FOUR_CHAR_CODE('rvlf'), typeCGFloat, NULL,
+ sizeof(CGFloat), NULL, &reveal);
+ if ([self inPresentationMode])
+ [self changeFloatingBarShownFraction:reveal];
+ return CallNextEventHandler(handler, event);
+}
+
+} // namespace
// Helper class to manage animations for the dropdown bar. Calls
@@ -169,6 +183,11 @@ const CGFloat kFloatingBarVerticalOffset = 22;
if ((self = [super init])) {
browserController_ = controller;
systemFullscreenMode_ = base::mac::kFullScreenModeNormal;
+
+ EventTypeSpec eventSpec = { kEventClassMenu, 2004 };
+ InstallApplicationEventHandler(NewEventHandlerUPP(&MenuBarRevealHandler),
+ 1, &eventSpec,
+ self, &menuBarTrackingHandler_);
}
// Let the world know what we're up to.
@@ -180,6 +199,9 @@ const CGFloat kFloatingBarVerticalOffset = 22;
}
- (void)dealloc {
+ RemoveEventHandler(menuBarTrackingHandler_);
+ menuBarTrackingHandler_ = NULL;
+
DCHECK(!inPresentationMode_);
DCHECK(!trackingArea_);
[super dealloc];
@@ -455,6 +477,7 @@ const CGFloat kFloatingBarVerticalOffset = 22;
if ([browserController_ floatingBarShownFraction] == fraction)
return;
+/*
// Create the animation and set it up.
currentAnimation_.reset(
[[DropdownAnimation alloc] initWithFraction:fraction
@@ -470,6 +493,7 @@ const CGFloat kFloatingBarVerticalOffset = 22;
[self removeTrackingAreaIfNecessary];
[currentAnimation_ startAnimation];
+ */
}
- (void)scheduleShowForMouse {
« no previous file with comments | « chrome/browser/ui/cocoa/presentation_mode_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698