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

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

Issue 12334096: Regularize ownerships and lifecycle for storage monitor platform classes. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix comment name Created 7 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
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 #include <sys/sysctl.h> 8 #include <sys/sysctl.h>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/debug/debugger.h" 11 #include "base/debug/debugger.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/mac/bundle_locations.h" 13 #include "base/mac/bundle_locations.h"
14 #include "base/mac/mac_util.h" 14 #include "base/mac/mac_util.h"
15 #include "base/memory/scoped_nsobject.h" 15 #include "base/memory/scoped_nsobject.h"
16 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
17 #include "base/path_service.h" 17 #include "base/path_service.h"
18 #include "chrome/app/breakpad_mac.h" 18 #include "chrome/app/breakpad_mac.h"
19 #import "chrome/browser/app_controller_mac.h" 19 #import "chrome/browser/app_controller_mac.h"
20 #import "chrome/browser/chrome_browser_application_mac.h" 20 #import "chrome/browser/chrome_browser_application_mac.h"
21 #include "chrome/browser/mac/install_from_dmg.h" 21 #include "chrome/browser/mac/install_from_dmg.h"
22 #include "chrome/browser/mac/keychain_reauthorize.h" 22 #include "chrome/browser/mac/keychain_reauthorize.h"
23 #import "chrome/browser/mac/keystone_glue.h" 23 #import "chrome/browser/mac/keystone_glue.h"
24 #include "chrome/browser/metrics/metrics_service.h" 24 #include "chrome/browser/metrics/metrics_service.h"
25 #include "chrome/browser/storage_monitor/image_capture_device_manager.h"
26 #include "chrome/browser/storage_monitor/storage_monitor_mac.h" 25 #include "chrome/browser/storage_monitor/storage_monitor_mac.h"
27 #include "chrome/common/chrome_paths.h" 26 #include "chrome/common/chrome_paths.h"
28 #include "chrome/common/chrome_switches.h" 27 #include "chrome/common/chrome_switches.h"
29 #include "content/public/common/main_function_params.h" 28 #include "content/public/common/main_function_params.h"
30 #include "content/public/common/result_codes.h" 29 #include "content/public/common/result_codes.h"
31 #include "ui/base/l10n/l10n_util_mac.h" 30 #include "ui/base/l10n/l10n_util_mac.h"
32 #include "ui/base/resource/resource_bundle.h" 31 #include "ui/base/resource/resource_bundle.h"
33 #include "ui/base/resource/resource_handle.h" 32 #include "ui/base/resource/resource_handle.h"
34 33
35 namespace { 34 namespace {
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 DCHECK([NSApp delegate]); 275 DCHECK([NSApp delegate]);
277 276
278 // Prevent Cocoa from turning command-line arguments into 277 // Prevent Cocoa from turning command-line arguments into
279 // |-application:openFiles:|, since we already handle them directly. 278 // |-application:openFiles:|, since we already handle them directly.
280 [[NSUserDefaults standardUserDefaults] 279 [[NSUserDefaults standardUserDefaults]
281 setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"]; 280 setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"];
282 } 281 }
283 282
284 void ChromeBrowserMainPartsMac::PreProfileInit() { 283 void ChromeBrowserMainPartsMac::PreProfileInit() {
285 storage_monitor_ = new chrome::StorageMonitorMac(); 284 storage_monitor_ = new chrome::StorageMonitorMac();
286 // TODO(gbillock): Make the ImageCapture manager owned by StorageMonitorMac.
287 if (base::mac::IsOSLionOrLater()) {
288 image_capture_device_manager_.reset(new chrome::ImageCaptureDeviceManager);
289 image_capture_device_manager_->SetNotifications(
290 storage_monitor_->receiver());
291 }
292 285
293 ChromeBrowserMainPartsPosix::PreProfileInit(); 286 ChromeBrowserMainPartsPosix::PreProfileInit();
294 } 287 }
295 288
289 void ChromeBrowserMainPartsMac::PostProfileInit() {
290 storage_monitor_->Init();
291
292 ChromeBrowserMainPartsPosix::PostProfileInit();
293 }
294
296 void ChromeBrowserMainPartsMac::DidEndMainMessageLoop() { 295 void ChromeBrowserMainPartsMac::DidEndMainMessageLoop() {
297 AppController* appController = [NSApp delegate]; 296 AppController* appController = [NSApp delegate];
298 [appController didEndMainMessageLoop]; 297 [appController didEndMainMessageLoop];
299 } 298 }
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_main_mac.h ('k') | chrome/browser/chromeos/chrome_browser_main_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698