Built UserAgent according to OS And Product.
[platform/framework/web/crosswalk-tizen.git] / atom / browser / atom_browser_main_parts_mac.mm
1 // Copyright (c) 2013 GitHub, Inc.
2 // Use of this source code is governed by the MIT license that can be
3 // found in the LICENSE file.
4
5 #include "atom/browser/atom_browser_main_parts.h"
6
7 #include "atom/browser/mac/atom_application.h"
8 #include "atom/browser/mac/atom_application_delegate.h"
9 #include "base/mac/bundle_locations.h"
10 #include "base/mac/foundation_util.h"
11 #include "ui/base/l10n/l10n_util_mac.h"
12
13 namespace atom {
14
15 void AtomBrowserMainParts::PreMainMessageLoopStart() {
16   // Force the NSApplication subclass to be used.
17   [AtomApplication sharedApplication];
18
19   // Set our own application delegate.
20   AtomApplicationDelegate* delegate = [[AtomApplicationDelegate alloc] init];
21   [NSApp setDelegate:delegate];
22
23   brightray::BrowserMainParts::PreMainMessageLoopStart();
24
25   // Prevent Cocoa from turning command-line arguments into
26   // |-application:openFiles:|, since we already handle them directly.
27   [[NSUserDefaults standardUserDefaults]
28       setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"];
29 }
30
31 void AtomBrowserMainParts::FreeAppDelegate() {
32   [[NSApp delegate] release];
33   [NSApp setDelegate:nil];
34 }
35
36 }  // namespace atom