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

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

Issue 9700002: [Mac] Use NSThemeFrame instead of NSGrayFrame on 10.8. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/browser_frame_view.h" 5 #import "chrome/browser/ui/cocoa/browser_frame_view.h"
6 6
7 #import <objc/runtime.h> 7 #import <objc/runtime.h>
8 #import <Carbon/Carbon.h> 8 #import <Carbon/Carbon.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/mac/mac_util.h"
11 #include "base/mac/scoped_nsautorelease_pool.h" 12 #include "base/mac/scoped_nsautorelease_pool.h"
12 #import "chrome/browser/themes/theme_service.h" 13 #import "chrome/browser/themes/theme_service.h"
13 #import "chrome/browser/ui/cocoa/framed_browser_window.h" 14 #import "chrome/browser/ui/cocoa/framed_browser_window.h"
14 #import "chrome/browser/ui/cocoa/themed_window.h" 15 #import "chrome/browser/ui/cocoa/themed_window.h"
15 #include "grit/theme_resources.h" 16 #include "grit/theme_resources.h"
16 #include "grit/theme_resources_standard.h" 17 #include "grit/theme_resources_standard.h"
17 18
18 static const CGFloat kBrowserFrameViewPaintHeight = 60.0; 19 static const CGFloat kBrowserFrameViewPaintHeight = 60.0;
19 static const NSPoint kBrowserFrameViewPatternPhaseOffset = { -5, 3 }; 20 static const NSPoint kBrowserFrameViewPatternPhaseOffset = { -5, 3 };
20 21
(...skipping 18 matching lines...) Expand all
39 40
40 @implementation BrowserFrameView 41 @implementation BrowserFrameView
41 42
42 + (void)load { 43 + (void)load {
43 // This is where we swizzle drawRect, and add in two methods that we 44 // This is where we swizzle drawRect, and add in two methods that we
44 // need. If any of these fail it shouldn't affect the functionality of the 45 // need. If any of these fail it shouldn't affect the functionality of the
45 // others. If they all fail, we will lose window frame theming and 46 // others. If they all fail, we will lose window frame theming and
46 // roll overs for our close widgets, but things should still function 47 // roll overs for our close widgets, but things should still function
47 // correctly. 48 // correctly.
48 base::mac::ScopedNSAutoreleasePool pool; 49 base::mac::ScopedNSAutoreleasePool pool;
49 Class grayFrameClass = NSClassFromString(@"NSGrayFrame"); 50
51 // On 10.8+ textured windows are no longer drawn by NSGrayFrame, and
Avi (use Gerrit) 2012/03/14 02:17:50 I didn't know that we were using textured windows.
Robert Sesek 2012/03/14 15:00:29 Done. Textured windows are the easiest way to not
52 // NSThemeFrame is used instead <http://crbug.com/114745>.
53 Class grayFrameClass = NSClassFromString(
Avi (use Gerrit) 2012/03/14 02:17:50 variable rename?
Robert Sesek 2012/03/14 15:00:29 Done.
54 base::mac::IsOSMountainLionOrLater() ? @"NSThemeFrame" : @"NSGrayFrame");
50 DCHECK(grayFrameClass); 55 DCHECK(grayFrameClass);
51 if (!grayFrameClass) return; 56 if (!grayFrameClass) return;
52 57
53 // Exchange draw rect. 58 // Exchange draw rect.
54 Method m0 = class_getInstanceMethod([self class], @selector(drawRect:)); 59 Method m0 = class_getInstanceMethod([self class], @selector(drawRect:));
55 DCHECK(m0); 60 DCHECK(m0);
56 if (m0) { 61 if (m0) {
57 BOOL didAdd = class_addMethod(grayFrameClass, 62 BOOL didAdd = class_addMethod(grayFrameClass,
58 @selector(drawRectOriginal:), 63 @selector(drawRectOriginal:),
59 method_getImplementation(m0), 64 method_getImplementation(m0),
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 351
347 // If this isn't the window class we expect, then pass it on to the 352 // If this isn't the window class we expect, then pass it on to the
348 // original implementation. 353 // original implementation.
349 if (![[self window] isKindOfClass:[FramedBrowserWindow class]]) 354 if (![[self window] isKindOfClass:[FramedBrowserWindow class]])
350 return [self _shadowFlagsOriginal]; 355 return [self _shadowFlagsOriginal];
351 356
352 return [self _shadowFlagsOriginal] | 128; 357 return [self _shadowFlagsOriginal] | 128;
353 } 358 }
354 359
355 @end 360 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698