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

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

Issue 10919185: Implement RemovableDeviceNotifications for Mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comments Created 8 years, 3 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 | Annotate | Revision Log
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/debug/debugger.h" 10 #include "base/debug/debugger.h"
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/mac/bundle_locations.h" 12 #include "base/mac/bundle_locations.h"
13 #include "base/mac/mac_util.h" 13 #include "base/mac/mac_util.h"
14 #include "base/memory/scoped_nsobject.h" 14 #include "base/memory/scoped_nsobject.h"
15 #include "base/path_service.h" 15 #include "base/path_service.h"
16 #include "chrome/app/breakpad_mac.h" 16 #include "chrome/app/breakpad_mac.h"
17 #import "chrome/browser/app_controller_mac.h" 17 #import "chrome/browser/app_controller_mac.h"
18 #import "chrome/browser/chrome_browser_application_mac.h" 18 #import "chrome/browser/chrome_browser_application_mac.h"
19 #include "chrome/browser/mac/install_from_dmg.h" 19 #include "chrome/browser/mac/install_from_dmg.h"
20 #include "chrome/browser/mac/keychain_reauthorize.h" 20 #include "chrome/browser/mac/keychain_reauthorize.h"
21 #import "chrome/browser/mac/keystone_glue.h" 21 #import "chrome/browser/mac/keystone_glue.h"
22 #include "chrome/browser/metrics/metrics_service.h" 22 #include "chrome/browser/metrics/metrics_service.h"
23 #include "chrome/browser/system_monitor/removable_device_notifications_mac.h"
23 #include "chrome/common/chrome_paths.h" 24 #include "chrome/common/chrome_paths.h"
24 #include "chrome/common/chrome_switches.h" 25 #include "chrome/common/chrome_switches.h"
25 #include "content/public/common/main_function_params.h" 26 #include "content/public/common/main_function_params.h"
26 #include "content/public/common/result_codes.h" 27 #include "content/public/common/result_codes.h"
27 #include "ui/base/l10n/l10n_util_mac.h" 28 #include "ui/base/l10n/l10n_util_mac.h"
28 #include "ui/base/resource/resource_bundle.h" 29 #include "ui/base/resource/resource_bundle.h"
29 #include "ui/base/resource/resource_handle.h" 30 #include "ui/base/resource/resource_handle.h"
30 31
31 namespace { 32 namespace {
32 33
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 return content::RESULT_CODE_NORMAL_EXIT; 66 return content::RESULT_CODE_NORMAL_EXIT;
66 } 67 }
67 68
68 // ChromeBrowserMainPartsMac --------------------------------------------------- 69 // ChromeBrowserMainPartsMac ---------------------------------------------------
69 70
70 ChromeBrowserMainPartsMac::ChromeBrowserMainPartsMac( 71 ChromeBrowserMainPartsMac::ChromeBrowserMainPartsMac(
71 const content::MainFunctionParams& parameters) 72 const content::MainFunctionParams& parameters)
72 : ChromeBrowserMainPartsPosix(parameters) { 73 : ChromeBrowserMainPartsPosix(parameters) {
73 } 74 }
74 75
76 ChromeBrowserMainPartsMac::~ChromeBrowserMainPartsMac() {
77 }
78
75 void ChromeBrowserMainPartsMac::PreEarlyInitialization() { 79 void ChromeBrowserMainPartsMac::PreEarlyInitialization() {
76 if (parsed_command_line().HasSwitch(switches::kKeychainReauthorize)) { 80 if (parsed_command_line().HasSwitch(switches::kKeychainReauthorize)) {
77 if (base::mac::AmIBundled()) { 81 if (base::mac::AmIBundled()) {
78 LOG(FATAL) << "Inappropriate process type for Keychain reauthorization"; 82 LOG(FATAL) << "Inappropriate process type for Keychain reauthorization";
79 } 83 }
80 84
81 // Do Keychain reauthorization at the time of update installation. This 85 // Do Keychain reauthorization at the time of update installation. This
82 // 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
83 // successfully (crashes or is interrupted for any reason), there will be 87 // successfully (crashes or is interrupted for any reason), there will be
84 // another chance. Once this step completes successfully, it should never 88 // another chance. Once this step completes successfully, it should never
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 [nib instantiateNibWithOwner:NSApp topLevelObjects:nil]; 172 [nib instantiateNibWithOwner:NSApp topLevelObjects:nil];
169 // Make sure the app controller has been created. 173 // Make sure the app controller has been created.
170 DCHECK([NSApp delegate]); 174 DCHECK([NSApp delegate]);
171 175
172 // Prevent Cocoa from turning command-line arguments into 176 // Prevent Cocoa from turning command-line arguments into
173 // |-application:openFiles:|, since we already handle them directly. 177 // |-application:openFiles:|, since we already handle them directly.
174 [[NSUserDefaults standardUserDefaults] 178 [[NSUserDefaults standardUserDefaults]
175 setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"]; 179 setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"];
176 } 180 }
177 181
182 void ChromeBrowserMainPartsMac::PreProfileInit() {
183 removable_device_notifications_mac_.reset(
184 new chrome::RemovableDeviceNotificationsMac());
185 ChromeBrowserMainPartsPosix::PreProfileInit();
186 }
187
178 void ChromeBrowserMainPartsMac::DidEndMainMessageLoop() { 188 void ChromeBrowserMainPartsMac::DidEndMainMessageLoop() {
179 AppController* appController = [NSApp delegate]; 189 AppController* appController = [NSApp delegate];
180 [appController didEndMainMessageLoop]; 190 [appController didEndMainMessageLoop];
181 } 191 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698