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

Side by Side Diff: chrome/browser/chrome_browser_main_mac.mm

Issue 2738053007: Activate keychain reauthorization. (Closed)
Patch Set: Split identifier for dev and canary Created 3 years, 9 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
« no previous file with comments | « no previous file | chrome/installer/mac/sign_app.sh.in » ('j') | 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 #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/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/mac/bundle_locations.h" 12 #include "base/mac/bundle_locations.h"
13 #import "base/mac/foundation_util.h" 13 #import "base/mac/foundation_util.h"
14 #include "base/mac/mac_util.h" 14 #include "base/mac/mac_util.h"
15 #include "base/mac/scoped_nsobject.h" 15 #include "base/mac/scoped_nsobject.h"
16 #include "base/mac/sdk_forward_declarations.h" 16 #include "base/mac/sdk_forward_declarations.h"
17 #include "base/path_service.h" 17 #include "base/path_service.h"
18 #include "base/threading/thread_task_runner_handle.h" 18 #include "base/threading/thread_task_runner_handle.h"
19 #import "chrome/browser/app_controller_mac.h" 19 #import "chrome/browser/app_controller_mac.h"
20 #include "chrome/browser/apps/app_shim/app_shim_host_manager_mac.h" 20 #include "chrome/browser/apps/app_shim/app_shim_host_manager_mac.h"
21 #include "chrome/browser/browser_process.h" 21 #include "chrome/browser/browser_process.h"
22 #import "chrome/browser/chrome_browser_application_mac.h" 22 #import "chrome/browser/chrome_browser_application_mac.h"
23 #include "chrome/browser/mac/install_from_dmg.h" 23 #include "chrome/browser/mac/install_from_dmg.h"
24 #include "chrome/browser/mac/keychain_reauthorize.h"
24 #import "chrome/browser/mac/keystone_glue.h" 25 #import "chrome/browser/mac/keystone_glue.h"
25 #include "chrome/browser/mac/mac_startup_profiler.h" 26 #include "chrome/browser/mac/mac_startup_profiler.h"
26 #include "chrome/browser/ui/app_list/app_list_service.h" 27 #include "chrome/browser/ui/app_list/app_list_service.h"
27 #include "chrome/common/chrome_paths.h" 28 #include "chrome/common/chrome_paths.h"
28 #include "chrome/common/chrome_switches.h" 29 #include "chrome/common/chrome_switches.h"
29 #include "components/crash/content/app/crashpad.h" 30 #include "components/crash/content/app/crashpad.h"
30 #include "components/metrics/metrics_service.h" 31 #include "components/metrics/metrics_service.h"
31 #include "content/public/common/main_function_params.h" 32 #include "content/public/common/main_function_params.h"
32 #include "content/public/common/result_codes.h" 33 #include "content/public/common/result_codes.h"
33 #include "ui/base/l10n/l10n_util_mac.h" 34 #include "ui/base/l10n/l10n_util_mac.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 [[NSNib alloc] initWithNibNamed:@"MainMenu" 150 [[NSNib alloc] initWithNibNamed:@"MainMenu"
150 bundle:base::mac::FrameworkBundle()]); 151 bundle:base::mac::FrameworkBundle()]);
151 // TODO(viettrungluu): crbug.com/20504 - This currently leaks, so if you 152 // TODO(viettrungluu): crbug.com/20504 - This currently leaks, so if you
152 // change this, you'll probably need to change the Valgrind suppression. 153 // change this, you'll probably need to change the Valgrind suppression.
153 NSArray* top_level_objects = nil; 154 NSArray* top_level_objects = nil;
154 [nib instantiateWithOwner:NSApp topLevelObjects:&top_level_objects]; 155 [nib instantiateWithOwner:NSApp topLevelObjects:&top_level_objects];
155 for (NSObject* object : top_level_objects) 156 for (NSObject* object : top_level_objects)
156 [object retain]; 157 [object retain];
157 // Make sure the app controller has been created. 158 // Make sure the app controller has been created.
158 DCHECK([NSApp delegate]); 159 DCHECK([NSApp delegate]);
160
161 // Do Keychain reauthorization. This gets two chances to run. If the first
162 // try doesn't complete successfully (crashes or is interrupted for any
163 // reason), there will be a second chance. Once this step completes
164 // successfully, it should never have to run again.
165 NSString* const keychain_reauthorize_pref =
166 @"KeychainReauthorizeInAppSpring2017";
167 const int kKeychainReauthorizeMaxTries = 2;
168
169 chrome::KeychainReauthorizeIfNeeded(keychain_reauthorize_pref,
170 kKeychainReauthorizeMaxTries);
159 } 171 }
160 172
161 void ChromeBrowserMainPartsMac::PostMainMessageLoopStart() { 173 void ChromeBrowserMainPartsMac::PostMainMessageLoopStart() {
162 MacStartupProfiler::GetInstance()->Profile( 174 MacStartupProfiler::GetInstance()->Profile(
163 MacStartupProfiler::POST_MAIN_MESSAGE_LOOP_START); 175 MacStartupProfiler::POST_MAIN_MESSAGE_LOOP_START);
164 ChromeBrowserMainPartsPosix::PostMainMessageLoopStart(); 176 ChromeBrowserMainPartsPosix::PostMainMessageLoopStart();
165 } 177 }
166 178
167 void ChromeBrowserMainPartsMac::PreProfileInit() { 179 void ChromeBrowserMainPartsMac::PreProfileInit() {
168 MacStartupProfiler::GetInstance()->Profile( 180 MacStartupProfiler::GetInstance()->Profile(
(...skipping 29 matching lines...) Expand all
198 [glue updateProfileCountsWithNumProfiles:0 210 [glue updateProfileCountsWithNumProfiles:0
199 numSignedInProfiles:0]; 211 numSignedInProfiles:0];
200 } 212 }
201 } 213 }
202 214
203 void ChromeBrowserMainPartsMac::DidEndMainMessageLoop() { 215 void ChromeBrowserMainPartsMac::DidEndMainMessageLoop() {
204 AppController* appController = 216 AppController* appController =
205 base::mac::ObjCCastStrict<AppController>([NSApp delegate]); 217 base::mac::ObjCCastStrict<AppController>([NSApp delegate]);
206 [appController didEndMainMessageLoop]; 218 [appController didEndMainMessageLoop];
207 } 219 }
OLDNEW
« no previous file with comments | « no previous file | chrome/installer/mac/sign_app.sh.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698