| 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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 // PathService::Get() returns false and yields an empty path if it fails | 433 // PathService::Get() returns false and yields an empty path if it fails |
| 434 // to create DIR_USER_DATA. Retrieve the default value manually to display | 434 // to create DIR_USER_DATA. Retrieve the default value manually to display |
| 435 // a more meaningful error to the user in that case. | 435 // a more meaningful error to the user in that case. |
| 436 if (user_data_dir.empty()) | 436 if (user_data_dir.empty()) |
| 437 chrome::GetDefaultUserDataDirectory(&user_data_dir); | 437 chrome::GetDefaultUserDataDirectory(&user_data_dir); |
| 438 chrome::SetInvalidSpecifiedUserDataDir(user_data_dir); | 438 chrome::SetInvalidSpecifiedUserDataDir(user_data_dir); |
| 439 } | 439 } |
| 440 | 440 |
| 441 // The browser process (which is identified by an empty |process_type|) will | 441 // The browser process (which is identified by an empty |process_type|) will |
| 442 // handle the error later; other processes that need the dir crash here. | 442 // handle the error later; other processes that need the dir crash here. |
| 443 CHECK(process_type.empty()) << "Unable to get the user data directory " | 443 // Unable to get the user data directory for process type. |
| 444 << "for process type: " << process_type; | 444 CHECK(process_type.empty()); |
| 445 } | 445 } |
| 446 | 446 |
| 447 // Append the fallback user data directory to the commandline. Otherwise, | 447 // Append the fallback user data directory to the commandline. Otherwise, |
| 448 // child or service processes will attempt to use the invalid directory. | 448 // child or service processes will attempt to use the invalid directory. |
| 449 if (specified_directory_was_invalid) | 449 if (specified_directory_was_invalid) |
| 450 command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir); | 450 command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir); |
| 451 #endif // OS_WIN | 451 #endif // OS_WIN |
| 452 } | 452 } |
| 453 | 453 |
| 454 #if !defined(OS_ANDROID) | 454 #if !defined(OS_ANDROID) |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 // The main app bundle should only be used for the browser process, so it | 716 // The main app bundle should only be used for the browser process, so it |
| 717 // should never see a --type switch (switches::kProcessType). Likewise, | 717 // should never see a --type switch (switches::kProcessType). Likewise, |
| 718 // the helper should always have a --type switch. | 718 // the helper should always have a --type switch. |
| 719 // | 719 // |
| 720 // This check is done this late so there is already a call to | 720 // This check is done this late so there is already a call to |
| 721 // base::mac::IsBackgroundOnlyProcess(), so there is no change in | 721 // base::mac::IsBackgroundOnlyProcess(), so there is no change in |
| 722 // startup/initialization order. | 722 // startup/initialization order. |
| 723 | 723 |
| 724 // The helper's Info.plist marks it as a background only app. | 724 // The helper's Info.plist marks it as a background only app. |
| 725 if (base::mac::IsBackgroundOnlyProcess()) { | 725 if (base::mac::IsBackgroundOnlyProcess()) { |
| 726 // Helper application requires --type. |
| 726 CHECK(command_line.HasSwitch(switches::kProcessType) && | 727 CHECK(command_line.HasSwitch(switches::kProcessType) && |
| 727 !process_type.empty()) | 728 !process_type.empty()); |
| 728 << "Helper application requires --type."; | |
| 729 } else { | 729 } else { |
| 730 // Main application forbids --type, saw |process_type|. |
| 730 CHECK(!command_line.HasSwitch(switches::kProcessType) && | 731 CHECK(!command_line.HasSwitch(switches::kProcessType) && |
| 731 process_type.empty()) | 732 process_type.empty()); |
| 732 << "Main application forbids --type, saw " << process_type; | |
| 733 } | 733 } |
| 734 } | 734 } |
| 735 | 735 |
| 736 void ChromeMainDelegate::SetUpInstallerPreferences( | 736 void ChromeMainDelegate::SetUpInstallerPreferences( |
| 737 const base::CommandLine& command_line) { | 737 const base::CommandLine& command_line) { |
| 738 const bool uma_setting = command_line.HasSwitch(switches::kEnableUserMetrics); | 738 const bool uma_setting = command_line.HasSwitch(switches::kEnableUserMetrics); |
| 739 const bool default_browser_setting = | 739 const bool default_browser_setting = |
| 740 command_line.HasSwitch(switches::kMakeChromeDefault); | 740 command_line.HasSwitch(switches::kMakeChromeDefault); |
| 741 | 741 |
| 742 if (uma_setting) | 742 if (uma_setting) |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 ui::MaterialDesignController::Initialize(); | 862 ui::MaterialDesignController::Initialize(); |
| 863 const std::string loaded_locale = | 863 const std::string loaded_locale = |
| 864 ui::ResourceBundle::InitSharedInstanceWithLocale( | 864 ui::ResourceBundle::InitSharedInstanceWithLocale( |
| 865 locale, NULL, ui::ResourceBundle::LOAD_COMMON_RESOURCES); | 865 locale, NULL, ui::ResourceBundle::LOAD_COMMON_RESOURCES); |
| 866 | 866 |
| 867 base::FilePath resources_pack_path; | 867 base::FilePath resources_pack_path; |
| 868 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); | 868 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); |
| 869 ResourceBundle::GetSharedInstance().AddDataPackFromPath( | 869 ResourceBundle::GetSharedInstance().AddDataPackFromPath( |
| 870 resources_pack_path, ui::SCALE_FACTOR_NONE); | 870 resources_pack_path, ui::SCALE_FACTOR_NONE); |
| 871 #endif | 871 #endif |
| 872 CHECK(!loaded_locale.empty()) << "Locale could not be found for " << | 872 // Locale could not be found for |locale|. |
| 873 locale; | 873 CHECK(!loaded_locale.empty()); |
| 874 } | 874 } |
| 875 | 875 |
| 876 #if !defined(CHROME_MULTIPLE_DLL_BROWSER) | 876 #if !defined(CHROME_MULTIPLE_DLL_BROWSER) |
| 877 if (process_type == switches::kUtilityProcess || | 877 if (process_type == switches::kUtilityProcess || |
| 878 process_type == switches::kZygoteProcess) { | 878 process_type == switches::kZygoteProcess) { |
| 879 ChromeContentUtilityClient::PreSandboxStartup(); | 879 ChromeContentUtilityClient::PreSandboxStartup(); |
| 880 } | 880 } |
| 881 | 881 |
| 882 chrome::InitializePDF(); | 882 chrome::InitializePDF(); |
| 883 #endif | 883 #endif |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1084 case version_info::Channel::CANARY: | 1084 case version_info::Channel::CANARY: |
| 1085 return true; | 1085 return true; |
| 1086 case version_info::Channel::DEV: | 1086 case version_info::Channel::DEV: |
| 1087 case version_info::Channel::BETA: | 1087 case version_info::Channel::BETA: |
| 1088 case version_info::Channel::STABLE: | 1088 case version_info::Channel::STABLE: |
| 1089 default: | 1089 default: |
| 1090 // Don't enable instrumentation. | 1090 // Don't enable instrumentation. |
| 1091 return false; | 1091 return false; |
| 1092 } | 1092 } |
| 1093 } | 1093 } |
| OLD | NEW |