| OLD | NEW |
| 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 #include "chrome/browser/chrome_browser_main_mac.h" | 5 #include "chrome/browser/chrome_browser_main_mac.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/debugger.h" | 10 #include "base/debug/debugger.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 LOG(FATAL) << "Inappropriate process type for Keychain reauthorization"; | 82 LOG(FATAL) << "Inappropriate process type for Keychain reauthorization"; |
| 83 } | 83 } |
| 84 | 84 |
| 85 // Do Keychain reauthorization at the time of update installation. This | 85 // Do Keychain reauthorization at the time of update installation. This |
| 86 // gets three chances to run. If the first or second try doesn't complete | 86 // gets three chances to run. If the first or second try doesn't complete |
| 87 // successfully (crashes or is interrupted for any reason), there will be | 87 // successfully (crashes or is interrupted for any reason), there will be |
| 88 // another chance. Once this step completes successfully, it should never | 88 // another chance. Once this step completes successfully, it should never |
| 89 // have to run again. | 89 // have to run again. |
| 90 // | 90 // |
| 91 // This is kicked off by a special stub executable during an automatic | 91 // This is kicked off by a special stub executable during an automatic |
| 92 // update. See chrome/installer/mac/keychain_reauthorize_main.cc. This is | 92 // update. See chrome/installer/mac/keychain_reauthorize_main.cc. |
| 93 // done during update installation in additon to browser app launch to | |
| 94 // help reauthorize Keychain items for users who never restart Chrome. | |
| 95 chrome::browser::mac::KeychainReauthorizeIfNeeded( | 93 chrome::browser::mac::KeychainReauthorizeIfNeeded( |
| 96 kKeychainReauthorizeAtUpdatePref, kKeychainReauthorizeAtUpdateMaxTries); | 94 kKeychainReauthorizeAtUpdatePref, kKeychainReauthorizeAtUpdateMaxTries); |
| 97 | 95 |
| 98 exit(0); | 96 exit(0); |
| 99 } | 97 } |
| 100 | 98 |
| 101 ChromeBrowserMainPartsPosix::PreEarlyInitialization(); | 99 ChromeBrowserMainPartsPosix::PreEarlyInitialization(); |
| 102 | 100 |
| 103 if (base::mac::WasLaunchedAsHiddenLoginItem()) { | 101 if (base::mac::WasLaunchedAsHiddenLoginItem()) { |
| 104 CommandLine* singleton_command_line = CommandLine::ForCurrentProcess(); | 102 CommandLine* singleton_command_line = CommandLine::ForCurrentProcess(); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 // TODO(viettrungluu): crbug.com/20504 - This currently leaks, so if you | 170 // TODO(viettrungluu): crbug.com/20504 - This currently leaks, so if you |
| 173 // change this, you'll probably need to change the Valgrind suppression. | 171 // change this, you'll probably need to change the Valgrind suppression. |
| 174 [nib instantiateNibWithOwner:NSApp topLevelObjects:nil]; | 172 [nib instantiateNibWithOwner:NSApp topLevelObjects:nil]; |
| 175 // Make sure the app controller has been created. | 173 // Make sure the app controller has been created. |
| 176 DCHECK([NSApp delegate]); | 174 DCHECK([NSApp delegate]); |
| 177 | 175 |
| 178 // Prevent Cocoa from turning command-line arguments into | 176 // Prevent Cocoa from turning command-line arguments into |
| 179 // |-application:openFiles:|, since we already handle them directly. | 177 // |-application:openFiles:|, since we already handle them directly. |
| 180 [[NSUserDefaults standardUserDefaults] | 178 [[NSUserDefaults standardUserDefaults] |
| 181 setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"]; | 179 setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"]; |
| 182 | |
| 183 // Do Keychain reauthorization at browser app launch. This gets two chances | |
| 184 // to run. If the first try doesn't complete successfully (crashes or is | |
| 185 // interrupted for any reason), there will be a second chance. Once this | |
| 186 // step completes successfully, it should never have to run again. | |
| 187 chrome::browser::mac::KeychainReauthorizeIfNeeded( | |
| 188 kKeychainReauthorizeAtLaunchPref, kKeychainReauthorizeAtLaunchMaxTries); | |
| 189 } | 180 } |
| 190 | 181 |
| 191 void ChromeBrowserMainPartsMac::DidEndMainMessageLoop() { | 182 void ChromeBrowserMainPartsMac::DidEndMainMessageLoop() { |
| 192 AppController* appController = [NSApp delegate]; | 183 AppController* appController = [NSApp delegate]; |
| 193 [appController didEndMainMessageLoop]; | 184 [appController didEndMainMessageLoop]; |
| 194 } | 185 } |
| OLD | NEW |