| OLD | NEW |
| (Empty) |
| 1 // Copyright 2008-2009 Google Inc. | |
| 2 // | |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
| 4 // you may not use this file except in compliance with the License. | |
| 5 // You may obtain a copy of the License at | |
| 6 // | |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | |
| 8 // | |
| 9 // Unless required by applicable law or agreed to in writing, software | |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 12 // See the License for the specific language governing permissions and | |
| 13 // limitations under the License. | |
| 14 // ======================================================================== | |
| 15 | |
| 16 #ifndef OMAHA_COMMON_COMMAND_LINE_BUILDER_H__ | |
| 17 #define OMAHA_COMMON_COMMAND_LINE_BUILDER_H__ | |
| 18 | |
| 19 #include <windows.h> | |
| 20 #include <atlstr.h> | |
| 21 | |
| 22 #include "base/basictypes.h" | |
| 23 #include "omaha/common/command_line.h" | |
| 24 | |
| 25 namespace omaha { | |
| 26 | |
| 27 // This class builds a GoogleUpdate.exe command line and makes sure it's | |
| 28 // valid against the GoopdateCommandLineValidator. | |
| 29 class CommandLineBuilder { | |
| 30 public: | |
| 31 explicit CommandLineBuilder(CommandLineMode mode); | |
| 32 ~CommandLineBuilder(); | |
| 33 | |
| 34 CommandLineMode mode() const { return mode_; } | |
| 35 | |
| 36 bool is_interactive_set() const { return is_interactive_set_; } | |
| 37 void set_is_interactive_set(bool is_interactive_set); | |
| 38 | |
| 39 bool is_machine_set() const { return is_machine_set_; } | |
| 40 void set_is_machine_set(bool is_machine_set); | |
| 41 | |
| 42 bool is_silent_set() const { return is_silent_set_; } | |
| 43 void set_is_silent_set(bool is_silent_set); | |
| 44 | |
| 45 bool is_eula_required_set() const { return is_eula_required_set_; } | |
| 46 void set_is_eula_required_set(bool is_eula_required_set); | |
| 47 | |
| 48 CString extra_args() const { return extra_args_; } | |
| 49 void set_extra_args(const CString& extra_args); | |
| 50 | |
| 51 CString app_args() const { return app_args_; } | |
| 52 void set_app_args(const CString& app_args); | |
| 53 | |
| 54 CString install_source() const { return install_source_; } | |
| 55 void set_install_source(const CString& install_source); | |
| 56 | |
| 57 CString session_id() const { return session_id_; } | |
| 58 void set_session_id(const CString& session_id); | |
| 59 | |
| 60 CString crash_filename() const { return crash_filename_; } | |
| 61 void set_crash_filename(const CString& crash_filename); | |
| 62 | |
| 63 CString custom_info_filename() const { return custom_info_filename_; } | |
| 64 void set_custom_info_filename(const CString& custom_info_filename); | |
| 65 | |
| 66 CString webplugin_url_domain() const { return webplugin_url_domain_; } | |
| 67 void set_webplugin_url_domain(const CString& webplugin_url_domain); | |
| 68 | |
| 69 CString webplugin_args() const { return webplugin_args_; } | |
| 70 void set_webplugin_args(const CString& webplugin_args); | |
| 71 | |
| 72 CString code_red_metainstaller_path() const { | |
| 73 return code_red_metainstaller_path_; | |
| 74 } | |
| 75 void set_code_red_metainstaller_path( | |
| 76 const CString& code_red_metainstaller_path); | |
| 77 | |
| 78 CString ping_string() const { return ping_string_; } | |
| 79 void set_ping_string(const CString& ping_string); | |
| 80 | |
| 81 CString offline_dir() const { return offline_dir_; } | |
| 82 | |
| 83 // Sets the offline directory after removing any trailing backslash. | |
| 84 void SetOfflineDir(const CString& offline_dir); | |
| 85 | |
| 86 // Outputs the proper command line string for the properties that are set. | |
| 87 // If the properties aren't in a valid combination, function will assert. | |
| 88 CString GetCommandLineArgs() const; | |
| 89 | |
| 90 CString GetCommandLine(const CString& program_name) const; | |
| 91 | |
| 92 private: | |
| 93 CString GetSingleSwitch(const CString& switch_name) const; | |
| 94 CString GetExtraAndAppArgs(const TCHAR* extra_switch_name) const; | |
| 95 | |
| 96 CString GetCore() const; | |
| 97 CString GetCrashHandler() const; | |
| 98 CString GetService() const; | |
| 99 CString GetServiceRegister() const; | |
| 100 CString GetServiceUnregister() const; | |
| 101 CString GetRegServer() const; | |
| 102 CString GetUnregServer() const; | |
| 103 CString GetNetDiags() const; | |
| 104 CString GetCrash() const; | |
| 105 CString GetReportCrash() const; | |
| 106 CString GetInstall() const; | |
| 107 CString GetUpdate() const; | |
| 108 CString GetHandoffInstall() const; | |
| 109 CString GetUA() const; | |
| 110 CString GetRecover() const; | |
| 111 CString GetWebPlugin() const; | |
| 112 CString GetCodeRedCheck() const; | |
| 113 CString GetComServer() const; | |
| 114 CString GetComBroker() const; | |
| 115 CString GetOnDemand() const; | |
| 116 CString GetMediumService() const; | |
| 117 CString GetUninstall() const; | |
| 118 CString GetRegisterProduct() const; | |
| 119 CString GetUnregisterProduct() const; | |
| 120 CString GetPing() const; | |
| 121 | |
| 122 const CommandLineMode mode_; | |
| 123 bool is_interactive_set_; | |
| 124 bool is_machine_set_; | |
| 125 bool is_silent_set_; | |
| 126 bool is_eula_required_set_; | |
| 127 CString extra_args_; | |
| 128 CString app_args_; | |
| 129 CString install_source_; | |
| 130 CString crash_filename_; | |
| 131 CString custom_info_filename_; | |
| 132 CString webplugin_url_domain_; | |
| 133 CString webplugin_args_; | |
| 134 CString code_red_metainstaller_path_; | |
| 135 CString ping_string_; | |
| 136 CString offline_dir_; | |
| 137 CString session_id_; | |
| 138 | |
| 139 DISALLOW_EVIL_CONSTRUCTORS(CommandLineBuilder); | |
| 140 }; | |
| 141 | |
| 142 } // namespace omaha | |
| 143 | |
| 144 #endif // OMAHA_COMMON_COMMAND_LINE_BUILDER_H__ | |
| 145 | |
| OLD | NEW |