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

Unified Diff: chrome/browser/ui/cocoa/toolbar/toolbar_button.mm

Issue 657443004: MacViews: Get views based toolbar to compile on the Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@views-findbar
Patch Set: Rebase Created 6 years, 2 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/toolbar/toolbar_button.mm
diff --git a/chrome/browser/ui/cocoa/toolbar/toolbar_button.mm b/chrome/browser/ui/cocoa/toolbar/toolbar_button.mm
deleted file mode 100644
index afc3483f0bb4e8d171ce87007dce49cae9558d8b..0000000000000000000000000000000000000000
--- a/chrome/browser/ui/cocoa/toolbar/toolbar_button.mm
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) 2011 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 "chrome/browser/ui/cocoa/toolbar/toolbar_button.h"
-
-@implementation ToolbarButton
-
-@synthesize handleMiddleClick = handleMiddleClick_;
-
-- (void)otherMouseDown:(NSEvent*)theEvent {
- if (![self shouldHandleEvent:theEvent]) {
- [super otherMouseDown:theEvent];
- return;
- }
-
- NSEvent* nextEvent = theEvent;
- BOOL isInside;
-
- // Loop until middle button is released. Also, the mouse cursor is outside of
- // the button, the button should not be highlighted.
- do {
- NSPoint mouseLoc = [self convertPoint:[nextEvent locationInWindow]
- fromView:nil];
- isInside = [self mouse:mouseLoc inRect:[self bounds]];
- [self highlight:isInside];
- [self setState:isInside ? NSOnState : NSOffState];
-
- NSUInteger mask = NSOtherMouseDraggedMask | NSOtherMouseUpMask;
- nextEvent = [[self window] nextEventMatchingMask:mask];
- } while (!([nextEvent buttonNumber] == 2 &&
- [nextEvent type] == NSOtherMouseUp));
-
- // Discard the events before the middle button up event.
- // If we don't discard it, the events will be re-processed later.
- [[self window] discardEventsMatchingMask:NSAnyEventMask
- beforeEvent:nextEvent];
-
- [self highlight:NO];
- [self setState:NSOffState];
- if (isInside)
- [self sendAction:[self action] to:[self target]];
-}
-
-- (BOOL)shouldHandleEvent:(NSEvent*)theEvent {
- // |buttonNumber| is the mouse button whose action triggered theEvent.
- // 2 corresponds to the middle mouse button.
- return handleMiddleClick_ && [theEvent buttonNumber] == 2;
-}
-
-@end
« no previous file with comments | « chrome/browser/ui/cocoa/toolbar/toolbar_button.h ('k') | chrome/browser/ui/cocoa/toolbar/toolbar_button_cocoa.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698