| 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/app/chrome_main_delegate.h" | 5 #include "chrome/app/chrome_main_delegate.h" | 
| 6 | 6 | 
| 7 #include <stddef.h> | 7 #include <stddef.h> | 
| 8 #include <string> | 8 #include <string> | 
| 9 | 9 | 
| 10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" | 
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 186 #if defined(OS_POSIX) | 186 #if defined(OS_POSIX) | 
| 187 base::LazyInstance<ChromeCrashReporterClient>::Leaky g_chrome_crash_client = | 187 base::LazyInstance<ChromeCrashReporterClient>::Leaky g_chrome_crash_client = | 
| 188     LAZY_INSTANCE_INITIALIZER; | 188     LAZY_INSTANCE_INITIALIZER; | 
| 189 #endif | 189 #endif | 
| 190 | 190 | 
| 191 extern int NaClMain(const content::MainFunctionParams&); | 191 extern int NaClMain(const content::MainFunctionParams&); | 
| 192 extern int CloudPrintServiceProcessMain(const content::MainFunctionParams&); | 192 extern int CloudPrintServiceProcessMain(const content::MainFunctionParams&); | 
| 193 | 193 | 
| 194 namespace { | 194 namespace { | 
| 195 | 195 | 
|  | 196 base::LazyInstance<ChromeMainDelegate::ServiceCatalogFactory>::Leaky | 
|  | 197     g_service_catalog_factory = LAZY_INSTANCE_INITIALIZER; | 
|  | 198 | 
| 196 #if defined(OS_WIN) | 199 #if defined(OS_WIN) | 
| 197 // Early versions of Chrome incorrectly registered a chromehtml: URL handler, | 200 // Early versions of Chrome incorrectly registered a chromehtml: URL handler, | 
| 198 // which gives us nothing but trouble. Avoid launching chrome this way since | 201 // which gives us nothing but trouble. Avoid launching chrome this way since | 
| 199 // some apps fail to properly escape arguments. | 202 // some apps fail to properly escape arguments. | 
| 200 bool HasDeprecatedArguments(const base::string16& command_line) { | 203 bool HasDeprecatedArguments(const base::string16& command_line) { | 
| 201   const wchar_t kChromeHtml[] = L"chromehtml:"; | 204   const wchar_t kChromeHtml[] = L"chromehtml:"; | 
| 202   base::string16 command_line_lower = base::ToLowerASCII(command_line); | 205   base::string16 command_line_lower = base::ToLowerASCII(command_line); | 
| 203   // We are only searching for ASCII characters so this is OK. | 206   // We are only searching for ASCII characters so this is OK. | 
| 204   return (command_line_lower.find(kChromeHtml) != base::string16::npos); | 207   return (command_line_lower.find(kChromeHtml) != base::string16::npos); | 
| 205 } | 208 } | 
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 516   // is no way to know the type of process (process command line is not yet | 519   // is no way to know the type of process (process command line is not yet | 
| 517   // initialized), so the function below will also be called in renderers. | 520   // initialized), so the function below will also be called in renderers. | 
| 518   // This doesn't matter as it simply sets global variables. | 521   // This doesn't matter as it simply sets global variables. | 
| 519   RecordMainStartupMetrics(exe_entry_point_ticks); | 522   RecordMainStartupMetrics(exe_entry_point_ticks); | 
| 520 #endif  // !defined(CHROME_MULTIPLE_DLL_CHILD) | 523 #endif  // !defined(CHROME_MULTIPLE_DLL_CHILD) | 
| 521 } | 524 } | 
| 522 | 525 | 
| 523 ChromeMainDelegate::~ChromeMainDelegate() { | 526 ChromeMainDelegate::~ChromeMainDelegate() { | 
| 524 } | 527 } | 
| 525 | 528 | 
|  | 529 // static | 
|  | 530 void ChromeMainDelegate::InstallServiceCatalogFactory( | 
|  | 531     ServiceCatalogFactory factory) { | 
|  | 532   g_service_catalog_factory.Get() = std::move(factory); | 
|  | 533 } | 
|  | 534 | 
| 526 bool ChromeMainDelegate::BasicStartupComplete(int* exit_code) { | 535 bool ChromeMainDelegate::BasicStartupComplete(int* exit_code) { | 
| 527 #if defined(OS_CHROMEOS) | 536 #if defined(OS_CHROMEOS) | 
| 528   chromeos::BootTimesRecorder::Get()->SaveChromeMainStats(); | 537   chromeos::BootTimesRecorder::Get()->SaveChromeMainStats(); | 
| 529 #endif | 538 #endif | 
| 530 | 539 | 
| 531   const base::CommandLine& command_line = | 540   const base::CommandLine& command_line = | 
| 532       *base::CommandLine::ForCurrentProcess(); | 541       *base::CommandLine::ForCurrentProcess(); | 
| 533 | 542 | 
| 534 #if defined(OS_WIN) | 543 #if defined(OS_WIN) | 
| 535   // Browser should not be sandboxed. | 544   // Browser should not be sandboxed. | 
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1121   if (command_line.HasSwitch(switches::kMus) || | 1130   if (command_line.HasSwitch(switches::kMus) || | 
| 1122       command_line.HasSwitch(switches::kMash)) { | 1131       command_line.HasSwitch(switches::kMash)) { | 
| 1123     return service_manager::ProcessType::kServiceManager; | 1132     return service_manager::ProcessType::kServiceManager; | 
| 1124   } | 1133   } | 
| 1125 #endif | 1134 #endif | 
| 1126 | 1135 | 
| 1127   return service_manager::ProcessType::kDefault; | 1136   return service_manager::ProcessType::kDefault; | 
| 1128 } | 1137 } | 
| 1129 | 1138 | 
| 1130 std::unique_ptr<base::Value> ChromeMainDelegate::CreateServiceCatalog() { | 1139 std::unique_ptr<base::Value> ChromeMainDelegate::CreateServiceCatalog() { | 
|  | 1140   if (!g_service_catalog_factory.Get().is_null()) | 
|  | 1141     return g_service_catalog_factory.Get().Run(); | 
| 1131 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 1142 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 
| 1132   const auto& command_line = *base::CommandLine::ForCurrentProcess(); | 1143   const auto& command_line = *base::CommandLine::ForCurrentProcess(); | 
| 1133 #if defined(OS_CHROMEOS) | 1144 #if defined(OS_CHROMEOS) | 
| 1134   if (command_line.HasSwitch(switches::kMus)) | 1145   if (command_line.HasSwitch(switches::kMus)) | 
| 1135     return CreateChromeMusCatalog(); | 1146     return CreateChromeMusCatalog(); | 
| 1136 #endif  // defined(OS_CHROMEOS) | 1147 #endif  // defined(OS_CHROMEOS) | 
| 1137   if (command_line.HasSwitch(switches::kMash)) | 1148   if (command_line.HasSwitch(switches::kMash)) | 
| 1138     return CreateChromeMashCatalog(); | 1149     return CreateChromeMashCatalog(); | 
| 1139 #endif  // BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 1150 #endif  // BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 
| 1140   return nullptr; | 1151   return nullptr; | 
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1211 | 1222 | 
| 1212 std::unique_ptr<service_manager::Service> | 1223 std::unique_ptr<service_manager::Service> | 
| 1213 ChromeMainDelegate::CreateEmbeddedService(const std::string& service_name) { | 1224 ChromeMainDelegate::CreateEmbeddedService(const std::string& service_name) { | 
| 1214 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 1225 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 
| 1215   auto mash_service = CreateEmbeddedMashService(service_name); | 1226   auto mash_service = CreateEmbeddedMashService(service_name); | 
| 1216   if (mash_service) | 1227   if (mash_service) | 
| 1217     return mash_service; | 1228     return mash_service; | 
| 1218 #endif  // BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 1229 #endif  // BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 
| 1219   return nullptr; | 1230   return nullptr; | 
| 1220 } | 1231 } | 
| OLD | NEW | 
|---|