Chromium Code Reviews| Index: chrome/browser/ui/cocoa/custom_frame_view.mm |
| diff --git a/chrome/browser/ui/cocoa/custom_frame_view.mm b/chrome/browser/ui/cocoa/custom_frame_view.mm |
| index 47b46ed2746f8a4b39c0ac2e310171adf3e94e63..2e807690a048a04018e7553a30ab912fde49c9b8 100644 |
| --- a/chrome/browser/ui/cocoa/custom_frame_view.mm |
| +++ b/chrome/browser/ui/cocoa/custom_frame_view.mm |
| @@ -4,8 +4,10 @@ |
| #import "chrome/browser/ui/cocoa/custom_frame_view.h" |
| -#import <objc/runtime.h> |
| #import <Carbon/Carbon.h> |
| +#include <crt_externs.h> |
| +#import <objc/runtime.h> |
| +#include <string.h> |
| #include "base/logging.h" |
| #include "base/mac/mac_util.h" |
| @@ -43,6 +45,20 @@ BOOL gCanGetCornerRadius = NO; |
| // roll overs for our close widgets, but things should still function |
| // correctly. |
| + (void)load { |
| + // Swizzling should only happen in the browser process. Interacting with |
| + // AppKit will run +[borderViewClass initialize] in the renderer, which |
| + // may establish Mach IPC with com.apple.windowserver. |
| + // Note that CommandLine has not been initialized yet, since this is running |
| + // as a module initializer. |
| + const char* const* const argv = *_NSGetArgv(); |
| + const int argc = *_NSGetArgc(); |
| + const char kType[] = "--type"; |
|
Mark Mentovai
2014/02/07 19:58:00
Missing = relative to what you had before. Put it
Robert Sesek
2014/02/07 20:08:26
Done.
|
| + for (int i = 1; i < argc; ++i) { |
| + const char* arg = argv[i]; |
| + if (strncmp(arg, kType, sizeof(kType) - 1) == 0) |
|
Mark Mentovai
2014/02/07 19:58:00
Tip: strlen(kType) is fine too. The compiler is sm
Robert Sesek
2014/02/07 20:08:26
Nice tip. Compiler so smart.
|
| + return; |
| + } |
| + |
| base::mac::ScopedNSAutoreleasePool pool; |
| // On 10.8+ the background for textured windows are no longer drawn by |