| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser_main.h" | 5 #include "chrome/browser/browser_main.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 100 |
| 101 #if defined(OS_WIN) | 101 #if defined(OS_WIN) |
| 102 #include <windows.h> | 102 #include <windows.h> |
| 103 #include <commctrl.h> | 103 #include <commctrl.h> |
| 104 #include <shellapi.h> | 104 #include <shellapi.h> |
| 105 | 105 |
| 106 #include "app/l10n_util_win.h" | 106 #include "app/l10n_util_win.h" |
| 107 #include "app/win_util.h" | 107 #include "app/win_util.h" |
| 108 #include "base/registry.h" | 108 #include "base/registry.h" |
| 109 #include "base/win_util.h" | 109 #include "base/win_util.h" |
| 110 #include "chrome/browser/browser.h" | |
| 111 #include "chrome/browser/browser_trial.h" | 110 #include "chrome/browser/browser_trial.h" |
| 112 #include "chrome/browser/metrics/user_metrics.h" | 111 #include "chrome/browser/metrics/user_metrics.h" |
| 113 #include "chrome/browser/net/url_fixer_upper.h" | 112 #include "chrome/browser/net/url_fixer_upper.h" |
| 114 #include "chrome/browser/rlz/rlz.h" | 113 #include "chrome/browser/rlz/rlz.h" |
| 115 #include "chrome/browser/views/user_data_dir_dialog.h" | 114 #include "chrome/browser/views/user_data_dir_dialog.h" |
| 116 #include "chrome/common/env_vars.h" | 115 #include "chrome/common/env_vars.h" |
| 117 #include "chrome/common/sandbox_policy.h" | 116 #include "chrome/common/sandbox_policy.h" |
| 118 #include "chrome/installer/util/helper.h" | 117 #include "chrome/installer/util/helper.h" |
| 119 #include "chrome/installer/util/install_util.h" | 118 #include "chrome/installer/util/install_util.h" |
| 120 #include "chrome/installer/util/shell_util.h" | 119 #include "chrome/installer/util/shell_util.h" |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 if (size_arg.size()) { | 636 if (size_arg.size()) { |
| 638 std::vector<std::string> dimensions; | 637 std::vector<std::string> dimensions; |
| 639 SplitString(size_arg, ',', &dimensions); | 638 SplitString(size_arg, ',', &dimensions); |
| 640 if (dimensions.size() == 2) | 639 if (dimensions.size() == 2) |
| 641 size.SetSize(StringToInt(dimensions[0]), StringToInt(dimensions[1])); | 640 size.SetSize(StringToInt(dimensions[0]), StringToInt(dimensions[1])); |
| 642 } | 641 } |
| 643 browser::ShowLoginWizard(first_screen, size); | 642 browser::ShowLoginWizard(first_screen, size); |
| 644 } | 643 } |
| 645 } | 644 } |
| 646 | 645 |
| 647 bool OptionallyApplyServicesCustomizationFromCommandLine( | |
| 648 const CommandLine& parsed_command_line, | |
| 649 BrowserInit* browser_init) { | |
| 650 // For Chrome OS, we may need to fetch OEM partner's services customization | |
| 651 // manifest and apply the customizations. This happens on the very first run | |
| 652 // or if startup manifest is passed on the command line. | |
| 653 scoped_ptr<chromeos::ServicesCustomizationDocument> customization; | |
| 654 customization.reset(new chromeos::ServicesCustomizationDocument()); | |
| 655 bool manifest_loaded = false; | |
| 656 if (parsed_command_line.HasSwitch(switches::kServicesManifest)) { | |
| 657 // Load manifest from file specified by command line switch. | |
| 658 FilePath manifest_path = | |
| 659 parsed_command_line.GetSwitchValuePath(switches::kServicesManifest); | |
| 660 manifest_loaded = customization->LoadManifestFromFile(manifest_path); | |
| 661 DCHECK(manifest_loaded) << manifest_path.value(); | |
| 662 } | |
| 663 // If manifest was loaded successfully, apply the customizations. | |
| 664 if (manifest_loaded) { | |
| 665 browser_init->ApplyServicesCustomization(customization.get()); | |
| 666 } | |
| 667 return manifest_loaded; | |
| 668 } | |
| 669 | |
| 670 #else | 646 #else |
| 671 | 647 |
| 672 void OptionallyRunChromeOSLoginManager(const CommandLine& parsed_command_line) { | 648 void OptionallyRunChromeOSLoginManager(const CommandLine& parsed_command_line) { |
| 673 // Dummy empty function for non-ChromeOS builds to avoid extra ifdefs below. | 649 // Dummy empty function for non-ChromeOS builds to avoid extra ifdefs below. |
| 674 } | 650 } |
| 675 | 651 |
| 676 bool OptionallyApplyServicesCustomizationFromCommandLine( | |
| 677 const CommandLine& parsed_command_line, | |
| 678 BrowserInit* browser_init) { | |
| 679 // Dummy empty function for non-ChromeOS builds to avoid extra ifdefs below. | |
| 680 return false; | |
| 681 } | |
| 682 | |
| 683 #endif // defined(OS_CHROMEOS) | 652 #endif // defined(OS_CHROMEOS) |
| 684 | 653 |
| 685 #if defined(OS_MACOSX) | 654 #if defined(OS_MACOSX) |
| 686 OSStatus KeychainCallback(SecKeychainEvent keychain_event, | 655 OSStatus KeychainCallback(SecKeychainEvent keychain_event, |
| 687 SecKeychainCallbackInfo *info, void *context) { | 656 SecKeychainCallbackInfo *info, void *context) { |
| 688 return noErr; | 657 return noErr; |
| 689 } | 658 } |
| 690 #endif | 659 #endif |
| 691 | 660 |
| 692 } // namespace | 661 } // namespace |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1114 | 1083 |
| 1115 // Configure the network module so it has access to resources. | 1084 // Configure the network module so it has access to resources. |
| 1116 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider); | 1085 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider); |
| 1117 | 1086 |
| 1118 // Register our global network handler for chrome:// and | 1087 // Register our global network handler for chrome:// and |
| 1119 // chrome-extension:// URLs. | 1088 // chrome-extension:// URLs. |
| 1120 RegisterURLRequestChromeJob(); | 1089 RegisterURLRequestChromeJob(); |
| 1121 RegisterExtensionProtocols(); | 1090 RegisterExtensionProtocols(); |
| 1122 RegisterMetadataURLRequestHandler(); | 1091 RegisterMetadataURLRequestHandler(); |
| 1123 | 1092 |
| 1124 // If path to partner services customization document was passed on command | |
| 1125 // line, apply the customizations (Chrome OS only). | |
| 1126 // TODO(denisromanov): Remove this when not needed for testing. | |
| 1127 OptionallyApplyServicesCustomizationFromCommandLine(parsed_command_line, | |
| 1128 &browser_init); | |
| 1129 | |
| 1130 // In unittest mode, this will do nothing. In normal mode, this will create | 1093 // In unittest mode, this will do nothing. In normal mode, this will create |
| 1131 // the global GoogleURLTracker and IntranetRedirectDetector instances, which | 1094 // the global GoogleURLTracker and IntranetRedirectDetector instances, which |
| 1132 // will promptly go to sleep for five and seven seconds, respectively (to | 1095 // will promptly go to sleep for five and seven seconds, respectively (to |
| 1133 // avoid slowing startup), and wake up afterwards to see if they should do | 1096 // avoid slowing startup), and wake up afterwards to see if they should do |
| 1134 // anything else. | 1097 // anything else. |
| 1135 // | 1098 // |
| 1136 // A simpler way of doing all this would be to have some function which could | 1099 // A simpler way of doing all this would be to have some function which could |
| 1137 // give the time elapsed since startup, and simply have these objects check | 1100 // give the time elapsed since startup, and simply have these objects check |
| 1138 // that when asked to initialize themselves, but this doesn't seem to exist. | 1101 // that when asked to initialize themselves, but this doesn't seem to exist. |
| 1139 // | 1102 // |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1298 | 1261 |
| 1299 metrics->Stop(); | 1262 metrics->Stop(); |
| 1300 | 1263 |
| 1301 // browser_shutdown takes care of deleting browser_process, so we need to | 1264 // browser_shutdown takes care of deleting browser_process, so we need to |
| 1302 // release it. | 1265 // release it. |
| 1303 ignore_result(browser_process.release()); | 1266 ignore_result(browser_process.release()); |
| 1304 browser_shutdown::Shutdown(); | 1267 browser_shutdown::Shutdown(); |
| 1305 | 1268 |
| 1306 return result_code; | 1269 return result_code; |
| 1307 } | 1270 } |
| OLD | NEW |