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

Side by Side Diff: chrome/browser/ui/cocoa/framed_browser_window.mm

Issue 915313002: [Mac] Remove -[NSWindow drawRect] swizzling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@nawc
Patch Set: Address comments Created 5 years, 9 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/framed_browser_window.h" 5 #import "chrome/browser/ui/cocoa/framed_browser_window.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/mac/sdk_forward_declarations.h" 8 #include "base/mac/sdk_forward_declarations.h"
9 #include "chrome/browser/global_keyboard_shortcuts_mac.h" 9 #include "chrome/browser/global_keyboard_shortcuts_mac.h"
10 #include "chrome/browser/profiles/profile_avatar_icon_util.h" 10 #include "chrome/browser/profiles/profile_avatar_icon_util.h"
11 #include "chrome/browser/themes/theme_properties.h" 11 #include "chrome/browser/themes/theme_properties.h"
12 #include "chrome/browser/themes/theme_service.h" 12 #include "chrome/browser/themes/theme_service.h"
13 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 13 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
14 #import "chrome/browser/ui/cocoa/browser_window_utils.h" 14 #import "chrome/browser/ui/cocoa/browser_window_utils.h"
15 #import "chrome/browser/ui/cocoa/custom_frame_view.h"
16 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" 15 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h"
17 #import "chrome/browser/ui/cocoa/themed_window.h" 16 #import "chrome/browser/ui/cocoa/themed_window.h"
18 #include "grit/theme_resources.h" 17 #include "grit/theme_resources.h"
19 #include "ui/base/cocoa/nsgraphics_context_additions.h" 18 #include "ui/base/cocoa/nsgraphics_context_additions.h"
20 #import "ui/base/cocoa/nsview_additions.h" 19 #import "ui/base/cocoa/nsview_additions.h"
21 20
22 // Implementer's note: Moving the window controls is tricky. When altering the 21 // Implementer's note: Moving the window controls is tricky. When altering the
23 // code, ensure that: 22 // code, ensure that:
24 // - accessibility hit testing works 23 // - accessibility hit testing works
25 // - the accessibility hierarchy is correct 24 // - the accessibility hierarchy is correct
(...skipping 11 matching lines...) Expand all
37 @interface FramedBrowserWindow (Private) 36 @interface FramedBrowserWindow (Private)
38 37
39 - (void)adjustCloseButton:(NSNotification*)notification; 38 - (void)adjustCloseButton:(NSNotification*)notification;
40 - (void)adjustMiniaturizeButton:(NSNotification*)notification; 39 - (void)adjustMiniaturizeButton:(NSNotification*)notification;
41 - (void)adjustZoomButton:(NSNotification*)notification; 40 - (void)adjustZoomButton:(NSNotification*)notification;
42 - (void)adjustButton:(NSButton*)button 41 - (void)adjustButton:(NSButton*)button
43 ofKind:(NSWindowButton)kind; 42 ofKind:(NSWindowButton)kind;
44 43
45 @end 44 @end
46 45
47 // Undocumented APIs. They are really on NSGrayFrame rather than NSView. Take
48 // care to only call them on the NSView passed into
49 // -[NSWindow drawCustomRect:forView:].
50 @interface NSView (UndocumentedAPI)
51
52 - (float)roundedCornerRadius;
53 - (CGRect)_titlebarTitleRect;
54 - (void)_drawTitleStringIn:(struct CGRect)arg1 withColor:(id)color;
55
56 @end
57
58
59 @implementation FramedBrowserWindow 46 @implementation FramedBrowserWindow
60 47
61 - (id)initWithContentRect:(NSRect)contentRect 48 - (id)initWithContentRect:(NSRect)contentRect
62 hasTabStrip:(BOOL)hasTabStrip{ 49 hasTabStrip:(BOOL)hasTabStrip{
63 NSUInteger styleMask = NSTitledWindowMask | 50 NSUInteger styleMask = NSTitledWindowMask |
64 NSClosableWindowMask | 51 NSClosableWindowMask |
65 NSMiniaturizableWindowMask | 52 NSMiniaturizableWindowMask |
66 NSResizableWindowMask | 53 NSResizableWindowMask |
67 NSTexturedBackgroundWindowMask; 54 NSTexturedBackgroundWindowMask;
68 if ((self = [super initWithContentRect:contentRect 55 if ((self = [super initWithContentRect:contentRect
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 ThemedWindowStyle windowStyle = [self themedWindowStyle]; 338 ThemedWindowStyle windowStyle = [self themedWindowStyle];
352 BOOL incognito = windowStyle & THEMED_INCOGNITO; 339 BOOL incognito = windowStyle & THEMED_INCOGNITO;
353 340
354 if (incognito) 341 if (incognito)
355 return [NSColor whiteColor]; 342 return [NSColor whiteColor];
356 else 343 else
357 return [NSColor windowFrameTextColor]; 344 return [NSColor windowFrameTextColor];
358 } 345 }
359 346
360 @end 347 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698