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