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

Side by Side Diff: chrome/browser/ui/cocoa/tabs/tab_view.mm

Issue 2404783002: [Mac] Avoid "adding unknown subview" warning. (Closed)
Patch Set: Merged with head Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" 5 #import "chrome/browser/ui/cocoa/tabs/tab_view.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/mac/sdk_forward_declarations.h" 9 #include "base/mac/sdk_forward_declarations.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 const NSTimeInterval kAlertHideDuration = 0.4; 44 const NSTimeInterval kAlertHideDuration = 0.4;
45 45
46 // The default time interval in seconds between glow updates (when 46 // The default time interval in seconds between glow updates (when
47 // increasing/decreasing). 47 // increasing/decreasing).
48 const NSTimeInterval kGlowUpdateInterval = 0.025; 48 const NSTimeInterval kGlowUpdateInterval = 0.025;
49 49
50 // This is used to judge whether the mouse has moved during rapid closure; if it 50 // This is used to judge whether the mouse has moved during rapid closure; if it
51 // has moved less than the threshold, we want to close the tab. 51 // has moved less than the threshold, we want to close the tab.
52 const CGFloat kRapidCloseDist = 2.5; 52 const CGFloat kRapidCloseDist = 2.5;
53 53
54 @interface NSView (PrivateAPI)
55 // Called by AppKit to check if dragging this view should move the window.
56 // NSButton overrides this method in the same way so dragging window buttons
57 // has no effect. NSView implementation returns NSZeroRect so the whole view
58 // area can be dragged.
59 - (NSRect)_opaqueRectForWindowMoveWhenInTitlebar;
60 @end
61
54 // This class contains the logic for drawing Material Design tab images. The 62 // This class contains the logic for drawing Material Design tab images. The
55 // |setTabEdgeStrokeColor| method is overridden by |TabHeavyImageMaker| to draw 63 // |setTabEdgeStrokeColor| method is overridden by |TabHeavyImageMaker| to draw
56 // high-contrast tabs. 64 // high-contrast tabs.
57 @interface TabImageMaker : NSObject 65 @interface TabImageMaker : NSObject
58 + (void)drawTabLeftMaskImage; 66 + (void)drawTabLeftMaskImage;
59 + (void)drawTabRightMaskImage; 67 + (void)drawTabRightMaskImage;
60 + (void)drawTabLeftEdgeImage; 68 + (void)drawTabLeftEdgeImage;
61 + (void)drawTabMiddleEdgeImage; 69 + (void)drawTabMiddleEdgeImage;
62 + (void)drawTabRightEdgeImage; 70 + (void)drawTabRightEdgeImage;
63 + (void)setTabEdgeStrokeColor; 71 + (void)setTabEdgeStrokeColor;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 // Cancel any delayed requests that may still be pending (drags or hover). 220 // Cancel any delayed requests that may still be pending (drags or hover).
213 [NSObject cancelPreviousPerformRequestsWithTarget:self]; 221 [NSObject cancelPreviousPerformRequestsWithTarget:self];
214 if (&NSWorkspaceAccessibilityDisplayOptionsDidChangeNotification) { 222 if (&NSWorkspaceAccessibilityDisplayOptionsDidChangeNotification) {
215 NSNotificationCenter* center = 223 NSNotificationCenter* center =
216 [[NSWorkspace sharedWorkspace] notificationCenter]; 224 [[NSWorkspace sharedWorkspace] notificationCenter];
217 [center removeObserver:self]; 225 [center removeObserver:self];
218 } 226 }
219 [super dealloc]; 227 [super dealloc];
220 } 228 }
221 229
230 // Called by AppKit to check if dragging this view should move the window.
231 // NSButton overrides this method in the same way so dragging window buttons
232 // has no effect.
233 - (NSRect)_opaqueRectForWindowMoveWhenInTitlebar {
234 return [self bounds];
235 }
236
222 // Called to obtain the context menu for when the user hits the right mouse 237 // Called to obtain the context menu for when the user hits the right mouse
223 // button (or control-clicks). (Note that -rightMouseDown: is *not* called for 238 // button (or control-clicks). (Note that -rightMouseDown: is *not* called for
224 // control-click.) 239 // control-click.)
225 - (NSMenu*)menu { 240 - (NSMenu*)menu {
226 if ([self isClosing]) 241 if ([self isClosing])
227 return nil; 242 return nil;
228 243
229 return [controller_ menu]; 244 return [controller_ menu];
230 } 245 }
231 246
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 1017
1003 // For "Increase Contrast" mode, use flat black instead of semitransparent black 1018 // For "Increase Contrast" mode, use flat black instead of semitransparent black
1004 // for the tab edge stroke. 1019 // for the tab edge stroke.
1005 + (void)setTabEdgeStrokeColor { 1020 + (void)setTabEdgeStrokeColor {
1006 static NSColor* heavyStrokeColor = 1021 static NSColor* heavyStrokeColor =
1007 [skia::SkColorToSRGBNSColor(SK_ColorBLACK) retain]; 1022 [skia::SkColorToSRGBNSColor(SK_ColorBLACK) retain];
1008 [heavyStrokeColor set]; 1023 [heavyStrokeColor set];
1009 } 1024 }
1010 1025
1011 @end 1026 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698