| 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" |
| 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 #import "chrome/browser/mac/keystone_glue.h" | 20 #import "chrome/browser/mac/keystone_glue.h" |
| 21 #include "chrome/browser/metrics/metrics_service.h" | 21 #include "chrome/browser/metrics/metrics_service.h" |
| 22 #include "chrome/common/chrome_paths.h" | 22 #include "chrome/common/chrome_paths.h" |
| 23 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
| 24 #include "content/public/common/main_function_params.h" | 24 #include "content/public/common/main_function_params.h" |
| 25 #include "content/public/common/result_codes.h" | 25 #include "content/public/common/result_codes.h" |
| 26 #include "ui/base/l10n/l10n_util_mac.h" | 26 #include "ui/base/l10n/l10n_util_mac.h" |
| 27 #include "ui/base/resource/resource_bundle.h" | 27 #include "ui/base/resource/resource_bundle.h" |
| 28 #include "ui/base/resource/resource_handle.h" |
| 28 | 29 |
| 29 void RecordBreakpadStatusUMA(MetricsService* metrics) { | 30 void RecordBreakpadStatusUMA(MetricsService* metrics) { |
| 30 metrics->RecordBreakpadRegistration(IsCrashReporterEnabled()); | 31 metrics->RecordBreakpadRegistration(IsCrashReporterEnabled()); |
| 31 metrics->RecordBreakpadHasDebugger(base::debug::BeingDebugged()); | 32 metrics->RecordBreakpadHasDebugger(base::debug::BeingDebugged()); |
| 32 } | 33 } |
| 33 | 34 |
| 34 void RecordBrowserStartupTime() { | 35 void RecordBrowserStartupTime() { |
| 35 // Not implemented on Mac for now. | 36 // Not implemented on Mac for now. |
| 36 } | 37 } |
| 37 | 38 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 // Before we load the nib, we need to start up the resource bundle so we | 86 // Before we load the nib, we need to start up the resource bundle so we |
| 86 // have the strings avaiable for localization. | 87 // have the strings avaiable for localization. |
| 87 // TODO(markusheintz): Read preference pref::kApplicationLocale in order | 88 // TODO(markusheintz): Read preference pref::kApplicationLocale in order |
| 88 // to enforce the application locale. | 89 // to enforce the application locale. |
| 89 const std::string loaded_locale = | 90 const std::string loaded_locale = |
| 90 ResourceBundle::InitSharedInstanceWithLocale(std::string()); | 91 ResourceBundle::InitSharedInstanceWithLocale(std::string()); |
| 91 CHECK(!loaded_locale.empty()) << "Default locale could not be found"; | 92 CHECK(!loaded_locale.empty()) << "Default locale could not be found"; |
| 92 | 93 |
| 93 FilePath resources_pack_path; | 94 FilePath resources_pack_path; |
| 94 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); | 95 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); |
| 95 ResourceBundle::GetSharedInstance().AddDataPack(resources_pack_path); | 96 ResourceBundle::GetSharedInstance().AddDataPack( |
| 97 resources_pack_path, ui::ResourceHandle::kScaleFactor100x); |
| 96 } | 98 } |
| 97 | 99 |
| 98 // This is a no-op if the KeystoneRegistration framework is not present. | 100 // This is a no-op if the KeystoneRegistration framework is not present. |
| 99 // The framework is only distributed with branded Google Chrome builds. | 101 // The framework is only distributed with branded Google Chrome builds. |
| 100 [[KeystoneGlue defaultKeystoneGlue] registerWithKeystone]; | 102 [[KeystoneGlue defaultKeystoneGlue] registerWithKeystone]; |
| 101 | 103 |
| 102 // Disk image installation is sort of a first-run task, so it shares the | 104 // Disk image installation is sort of a first-run task, so it shares the |
| 103 // kNoFirstRun switch. | 105 // kNoFirstRun switch. |
| 104 // | 106 // |
| 105 // This needs to be done after the resource bundle is initialized (for | 107 // This needs to be done after the resource bundle is initialized (for |
| (...skipping 26 matching lines...) Expand all Loading... |
| 132 // Prevent Cocoa from turning command-line arguments into | 134 // Prevent Cocoa from turning command-line arguments into |
| 133 // |-application:openFiles:|, since we already handle them directly. | 135 // |-application:openFiles:|, since we already handle them directly. |
| 134 [[NSUserDefaults standardUserDefaults] | 136 [[NSUserDefaults standardUserDefaults] |
| 135 setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"]; | 137 setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"]; |
| 136 } | 138 } |
| 137 | 139 |
| 138 void ChromeBrowserMainPartsMac::DidEndMainMessageLoop() { | 140 void ChromeBrowserMainPartsMac::DidEndMainMessageLoop() { |
| 139 AppController* appController = [NSApp delegate]; | 141 AppController* appController = [NSApp delegate]; |
| 140 [appController didEndMainMessageLoop]; | 142 [appController didEndMainMessageLoop]; |
| 141 } | 143 } |
| OLD | NEW |