| 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 // Defines the installation manifest, which is specific to each application and | |
| 17 // version. This is a quasi-static data structure returned by the server in | |
| 18 // the update response. | |
| 19 | |
| 20 #ifndef OMAHA_COMMON_INSTALL_MANIFEST_H_ | |
| 21 #define OMAHA_COMMON_INSTALL_MANIFEST_H_ | |
| 22 | |
| 23 #include <atlstr.h> | |
| 24 #include <vector> | |
| 25 #include "base/basictypes.h" | |
| 26 #include "omaha/common/const_goopdate.h" | |
| 27 | |
| 28 namespace omaha { | |
| 29 | |
| 30 namespace xml { | |
| 31 | |
| 32 struct InstallPackage { | |
| 33 InstallPackage() : is_required(false), size(0) {} | |
| 34 | |
| 35 CString name; | |
| 36 CString version; | |
| 37 bool is_required; | |
| 38 int size; | |
| 39 CString hash; | |
| 40 }; | |
| 41 | |
| 42 struct InstallAction { | |
| 43 InstallAction() | |
| 44 : install_event(static_cast<InstallEvent>(0)), | |
| 45 needs_admin(NEEDS_ADMIN_NO), | |
| 46 terminate_all_browsers(false), | |
| 47 success_action(SUCCESS_ACTION_DEFAULT) {} | |
| 48 | |
| 49 enum InstallEvent { kPreInstall = 1, kInstall, kUpdate, kPostInstall }; | |
| 50 | |
| 51 InstallEvent install_event; | |
| 52 | |
| 53 // Whether the action should be run as admin. This may differ from whether the | |
| 54 // app is_machine. | |
| 55 // TODO(omaha3): This value is defined in the protocol but not implemented: | |
| 56 // * It is not yet set by the XML parser. | |
| 57 // * This should probably be renamed run_elevated since it is more likely to | |
| 58 // be used to run de-elevated from an elevated Omaha instance. | |
| 59 // * What should machine Omaha do if there is no logged in user and the | |
| 60 // action cannot be de-elevated? | |
| 61 // * This should default to the bundle's is_machine. | |
| 62 // * Assert if !is_machine and needs_admin == NEEDS_ADMIN_YES. | |
| 63 NeedsAdmin needs_admin; | |
| 64 | |
| 65 // TODO(omaha3): Need some more thinking here. On one hand, overloading this | |
| 66 // is tempting. On the other hand, it may be hard to read. | |
| 67 // This could also be SuccessfulInstallActions such as "launch_browser", or | |
| 68 // "terminate_all_browsers". The program_params in the case of | |
| 69 // "launch_browser" would be the URL to navigate to. | |
| 70 CString program_to_run; | |
| 71 CString program_arguments; | |
| 72 | |
| 73 CString success_url; // URL to launch the browser on success. | |
| 74 bool terminate_all_browsers; | |
| 75 SuccessfulInstallAction success_action; // Action after install success. | |
| 76 }; | |
| 77 | |
| 78 // TODO(omaha3): Should all these really be public members? | |
| 79 struct InstallManifest { | |
| 80 CString name; // TBD. | |
| 81 CString version; | |
| 82 std::vector<InstallPackage> packages; | |
| 83 // TODO(omaha3): Maybe this should be a map or array of kPostInstall + 1 ptrs. | |
| 84 std::vector<InstallAction> install_actions; | |
| 85 }; | |
| 86 | |
| 87 } // namespace xml | |
| 88 | |
| 89 } // namespace omaha | |
| 90 | |
| 91 #endif // OMAHA_COMMON_INSTALL_MANIFEST_H_ | |
| OLD | NEW |