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

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

Issue 157763002: [Mac] In +[CustomFrameView load], do not perform any work if the process has a --type flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 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) 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/custom_frame_view.h" 5 #import "chrome/browser/ui/cocoa/custom_frame_view.h"
6 6
7 #include <crt_externs.h>
8 #include <string.h>
9
7 #import <objc/runtime.h> 10 #import <objc/runtime.h>
Mark Mentovai 2014/02/07 18:49:39 Why are these in a separate section from the ones
Robert Sesek 2014/02/07 19:05:11 Done.
8 #import <Carbon/Carbon.h> 11 #import <Carbon/Carbon.h>
9 12
10 #include "base/logging.h" 13 #include "base/logging.h"
11 #include "base/mac/mac_util.h" 14 #include "base/mac/mac_util.h"
12 #include "base/mac/scoped_nsautorelease_pool.h" 15 #include "base/mac/scoped_nsautorelease_pool.h"
13 16
14 namespace { 17 namespace {
15 BOOL gCanDrawTitle = NO; 18 BOOL gCanDrawTitle = NO;
16 BOOL gCanGetCornerRadius = NO; 19 BOOL gCanGetCornerRadius = NO;
17 } // namespace 20 } // namespace
(...skipping 18 matching lines...) Expand all
36 @end 39 @end
37 40
38 @implementation CustomFrameView 41 @implementation CustomFrameView
39 42
40 // This is where we swizzle drawRect, and add in two methods that we 43 // This is where we swizzle drawRect, and add in two methods that we
41 // need. If any of these fail it shouldn't affect the functionality of the 44 // need. If any of these fail it shouldn't affect the functionality of the
42 // others. If they all fail, we will lose window frame theming and 45 // others. If they all fail, we will lose window frame theming and
43 // roll overs for our close widgets, but things should still function 46 // roll overs for our close widgets, but things should still function
44 // correctly. 47 // correctly.
45 + (void)load { 48 + (void)load {
49 // Swizzling should only happen in the browser process. Running AppKit
50 // +initialize methods in the renderer may establish Mach IPC with
Mark Mentovai 2014/02/07 18:49:39 This comment should say the thing about +[NSThemeF
Robert Sesek 2014/02/07 19:05:11 Done.
51 // com.apple.windowserver.
52 // Note that CommandLine has not been initialized yet, since this is running
53 // as a module initializer.
54 const char* const* const argv = *_NSGetArgv();
55 for (int i = 0; i < *_NSGetArgc(); ++i) {
Mark Mentovai 2014/02/07 18:49:39 Don’t keep calling this and dereferencing it. int
Mark Mentovai 2014/02/07 18:49:39 argv[0] is the executable name. Command-line argum
Robert Sesek 2014/02/07 19:05:11 Done.
Robert Sesek 2014/02/07 19:05:11 Done.
56 const char* arg = argv[i];
57 if (strstr(arg, "--type=") != NULL)
Mark Mentovai 2014/02/07 18:49:39 Don’t scan the whole |arg|, --type= is only signif
Robert Sesek 2014/02/07 19:05:11 Done.
58 return;
59 }
60
46 base::mac::ScopedNSAutoreleasePool pool; 61 base::mac::ScopedNSAutoreleasePool pool;
47 62
48 // On 10.8+ the background for textured windows are no longer drawn by 63 // On 10.8+ the background for textured windows are no longer drawn by
49 // NSGrayFrame, and NSThemeFrame is used instead <http://crbug.com/114745>. 64 // NSGrayFrame, and NSThemeFrame is used instead <http://crbug.com/114745>.
50 Class borderViewClass = NSClassFromString( 65 Class borderViewClass = NSClassFromString(
51 base::mac::IsOSMountainLionOrLater() ? @"NSThemeFrame" : @"NSGrayFrame"); 66 base::mac::IsOSMountainLionOrLater() ? @"NSThemeFrame" : @"NSGrayFrame");
52 DCHECK(borderViewClass); 67 DCHECK(borderViewClass);
53 if (!borderViewClass) return; 68 if (!borderViewClass) return;
54 69
55 // Exchange draw rect. 70 // Exchange draw rect.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 if ([window respondsToSelector:@selector(fullScreenButtonOriginAdjustment)]) 144 if ([window respondsToSelector:@selector(fullScreenButtonOriginAdjustment)])
130 offset = [window fullScreenButtonOriginAdjustment]; 145 offset = [window fullScreenButtonOriginAdjustment];
131 146
132 NSPoint origin = [self _fullScreenButtonOriginOriginal]; 147 NSPoint origin = [self _fullScreenButtonOriginOriginal];
133 origin.x += offset.x; 148 origin.x += offset.x;
134 origin.y += offset.y; 149 origin.y += offset.y;
135 return origin; 150 return origin;
136 } 151 }
137 152
138 @end 153 @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