| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/app/chrome_main_delegate.h" | 5 #include "chrome/app/chrome_main_delegate.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 #if defined(OS_WIN) || defined(OS_MACOSX) | 275 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 276 // Windows needs resources for the default/null plugin. | 276 // Windows needs resources for the default/null plugin. |
| 277 // Mac needs them for the plugin process name. | 277 // Mac needs them for the plugin process name. |
| 278 process_type == switches::kPluginProcess || | 278 process_type == switches::kPluginProcess || |
| 279 #endif | 279 #endif |
| 280 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 280 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 281 // The zygote process opens the resources for the renderers. | 281 // The zygote process opens the resources for the renderers. |
| 282 process_type == switches::kZygoteProcess || | 282 process_type == switches::kZygoteProcess || |
| 283 #endif | 283 #endif |
| 284 #if defined(OS_MACOSX) | 284 #if defined(OS_MACOSX) |
| 285 // Mac needs them to for scrollbar related images. | 285 // Mac needs them too for scrollbar related images and for sandbox |
| 286 // profiles. |
| 286 process_type == switches::kWorkerProcess || | 287 process_type == switches::kWorkerProcess || |
| 288 process_type == switches::kNaClLoaderProcess || |
| 289 process_type == switches::kPpapiPluginProcess || |
| 290 process_type == switches::kPpapiBrokerProcess || |
| 287 #endif | 291 #endif |
| 288 process_type == switches::kRendererProcess || | 292 process_type == switches::kRendererProcess || |
| 289 process_type == switches::kUtilityProcess; | 293 process_type == switches::kUtilityProcess; |
| 290 } | 294 } |
| 291 | 295 |
| 292 #if defined(OS_MACOSX) | 296 #if defined(OS_MACOSX) |
| 293 // Update the name shown in Activity Monitor so users are less likely to ask | 297 // Update the name shown in Activity Monitor so users are less likely to ask |
| 294 // why Chrome has so many processes. | 298 // why Chrome has so many processes. |
| 295 void SetMacProcessName(const CommandLine& command_line) { | 299 void SetMacProcessName(const CommandLine& command_line) { |
| 296 std::string process_type = | 300 std::string process_type = |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 #if defined(OS_WIN) | 604 #if defined(OS_WIN) |
| 601 // TODO(darin): Kill this once http://crbug.com/52609 is fixed. | 605 // TODO(darin): Kill this once http://crbug.com/52609 is fixed. |
| 602 ResourceBundle::SetResourcesDataDLL(_AtlBaseModule.GetResourceInstance()); | 606 ResourceBundle::SetResourcesDataDLL(_AtlBaseModule.GetResourceInstance()); |
| 603 #endif | 607 #endif |
| 604 | 608 |
| 605 if (SubprocessNeedsResourceBundle(process_type)) { | 609 if (SubprocessNeedsResourceBundle(process_type)) { |
| 606 // Initialize ResourceBundle which handles files loaded from external | 610 // Initialize ResourceBundle which handles files loaded from external |
| 607 // sources. The language should have been passed in to us from the | 611 // sources. The language should have been passed in to us from the |
| 608 // browser process as a command line flag. | 612 // browser process as a command line flag. |
| 609 DCHECK(command_line.HasSwitch(switches::kLang) || | 613 DCHECK(command_line.HasSwitch(switches::kLang) || |
| 610 process_type == switches::kZygoteProcess); | 614 process_type == switches::kZygoteProcess || |
| 615 process_type == switches::kNaClLoaderProcess || |
| 616 process_type == switches::kPpapiBrokerProcess || |
| 617 process_type == switches::kPpapiPluginProcess); |
| 611 | 618 |
| 612 // TODO(markusheintz): The command line flag --lang is actually processed | 619 // TODO(markusheintz): The command line flag --lang is actually processed |
| 613 // by the CommandLinePrefStore, and made available through the PrefService | 620 // by the CommandLinePrefStore, and made available through the PrefService |
| 614 // via the preference prefs::kApplicationLocale. The browser process uses | 621 // via the preference prefs::kApplicationLocale. The browser process uses |
| 615 // the --lang flag to pass the value of the PrefService in here. Maybe | 622 // the --lang flag to pass the value of the PrefService in here. Maybe |
| 616 // this value could be passed in a different way. | 623 // this value could be passed in a different way. |
| 617 const std::string locale = | 624 const std::string locale = |
| 618 command_line.GetSwitchValueASCII(switches::kLang); | 625 command_line.GetSwitchValueASCII(switches::kLang); |
| 619 const std::string loaded_locale = | 626 const std::string loaded_locale = |
| 620 ResourceBundle::InitSharedInstance(locale); | 627 ResourceBundle::InitSharedInstance(locale); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 | 738 |
| 732 #if defined(USE_LINUX_BREAKPAD) | 739 #if defined(USE_LINUX_BREAKPAD) |
| 733 // Needs to be called after we have chrome::DIR_USER_DATA. BrowserMain sets | 740 // Needs to be called after we have chrome::DIR_USER_DATA. BrowserMain sets |
| 734 // this up for the browser process in a different manner. | 741 // this up for the browser process in a different manner. |
| 735 InitCrashReporter(); | 742 InitCrashReporter(); |
| 736 #endif | 743 #endif |
| 737 | 744 |
| 738 InitializeChromeContentClient(process_type); | 745 InitializeChromeContentClient(process_type); |
| 739 } | 746 } |
| 740 #endif // OS_MACOSX | 747 #endif // OS_MACOSX |
| OLD | NEW |