OLD | NEW |
(Empty) | |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import <UIKit/UIKit.h> |
| 6 |
| 7 #include "base/at_exit.h" |
| 8 #include "base/debug/crash_logging.h" |
| 9 #include "components/crash/core/common/crash_keys.h" |
| 10 #include "ios/chrome/app/startup/ios_chrome_main.h" |
| 11 #include "ios/chrome/browser/crash_report/breakpad_helper.h" |
| 12 #include "ios/chrome/browser/crash_report/crash_keys.h" |
| 13 #include "ios/chrome/common/channel_info.h" |
| 14 |
| 15 namespace { |
| 16 |
| 17 NSString* const kUIApplicationDelegateInfoKey = @"UIApplicationDelegate"; |
| 18 |
| 19 void StartCrashController() { |
| 20 std::string channel_string = GetChannelString(); |
| 21 |
| 22 RegisterChromeIOSCrashKeys(); |
| 23 base::debug::SetCrashKeyValue(crash_keys::kChannel, channel_string); |
| 24 breakpad_helper::Start(channel_string); |
| 25 } |
| 26 |
| 27 } // namespace |
| 28 |
| 29 int main(int argc, char* argv[]) { |
| 30 IOSChromeMain::InitStartTime(); |
| 31 NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; |
| 32 |
| 33 NSUserDefaults* standardDefaults = [NSUserDefaults standardUserDefaults]; |
| 34 |
| 35 // Set NSUserDefaults keys to force pseudo-RTL if needed. |
| 36 if ([standardDefaults boolForKey:@"EnablePseudoRTL"]) { |
| 37 NSDictionary* pseudoDict = [NSDictionary |
| 38 dictionaryWithObjectsAndKeys:@"YES", @"AppleTextDirection", @"YES", |
| 39 @"NSForceRightToLeftWritingDirection", |
| 40 nil]; |
| 41 [standardDefaults registerDefaults:pseudoDict]; |
| 42 } |
| 43 |
| 44 // Create this here since it's needed to start the crash handler. |
| 45 base::AtExitManager at_exit; |
| 46 |
| 47 // The Crash Controller is started here even if the user opted out since we |
| 48 // don't have yet preferences. Later on it is stopped if the user opted out. |
| 49 // In any case reports are not sent if the user opted out. |
| 50 StartCrashController(); |
| 51 |
| 52 // Always ignore SIGPIPE. We check the return value of write(). |
| 53 CHECK_NE(SIG_ERR, signal(SIGPIPE, SIG_IGN)); |
| 54 |
| 55 // Purging the pool to prevent autorelease objects created by the previous |
| 56 // calls to live forever. |
| 57 [pool release]; |
| 58 pool = [[NSAutoreleasePool alloc] init]; |
| 59 |
| 60 // Part of code that requires us to specify which UIApplication delegate class |
| 61 // to use by adding "UIApplicationDelegate" key to Info.plist file. |
| 62 NSString* delegateClassName = [[NSBundle mainBundle] |
| 63 objectForInfoDictionaryKey:kUIApplicationDelegateInfoKey]; |
| 64 CHECK(delegateClassName); |
| 65 |
| 66 int retVal = UIApplicationMain(argc, argv, nil, delegateClassName); |
| 67 [pool release]; |
| 68 return retVal; |
| 69 } |
OLD | NEW |