| 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/installer/util/google_update_util.h" | 5 #include "chrome/installer/util/google_update_util.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 // If Google Update is present at system-level, sets |cmd_string| to the command | 64 // If Google Update is present at system-level, sets |cmd_string| to the command |
| 65 // line to install Google Update at user-level and returns true. | 65 // line to install Google Update at user-level and returns true. |
| 66 // Otherwise, clears |cmd_string| and returns false. | 66 // Otherwise, clears |cmd_string| and returns false. |
| 67 bool GetUserLevelGoogleUpdateInstallCommandLine(string16* cmd_string) { | 67 bool GetUserLevelGoogleUpdateInstallCommandLine(string16* cmd_string) { |
| 68 cmd_string->clear(); | 68 cmd_string->clear(); |
| 69 base::FilePath google_update_setup( | 69 base::FilePath google_update_setup( |
| 70 GetGoogleUpdateSetupExe(true)); // system-level. | 70 GetGoogleUpdateSetupExe(true)); // system-level. |
| 71 if (!google_update_setup.empty()) { | 71 if (!google_update_setup.empty()) { |
| 72 CommandLine cmd(google_update_setup); | 72 CommandLine cmd(google_update_setup); |
| 73 // Appends parameter "/install runtime=true&needsadmin=false /silent" | 73 // Appends "/install runtime=true&needsadmin=false /silent /nomitag". |
| 74 // NB: /nomitag needs to be at the end. |
| 74 // Constants are found in code.google.com/p/omaha/common/const_cmd_line.h. | 75 // Constants are found in code.google.com/p/omaha/common/const_cmd_line.h. |
| 75 cmd.AppendArg("/install"); | 76 cmd.AppendArg("/install"); |
| 76 // The "&" can be used in base::LaunchProcess() without quotation | 77 // The "&" can be used in base::LaunchProcess() without quotation |
| 77 // (this is problematic only if run from command prompt). | 78 // (this is problematic only if run from command prompt). |
| 78 cmd.AppendArg("runtime=true&needsadmin=false"); | 79 cmd.AppendArg("runtime=true&needsadmin=false"); |
| 79 cmd.AppendArg("/silent"); | 80 cmd.AppendArg("/silent"); |
| 81 cmd.AppendArg("/nomitag"); |
| 80 *cmd_string = cmd.GetCommandLineString(); | 82 *cmd_string = cmd.GetCommandLineString(); |
| 81 } | 83 } |
| 82 return !cmd_string->empty(); | 84 return !cmd_string->empty(); |
| 83 } | 85 } |
| 84 | 86 |
| 85 // Launches command |cmd_string|, and waits for |timeout| milliseconds before | 87 // Launches command |cmd_string|, and waits for |timeout| milliseconds before |
| 86 // timing out. To wait indefinitely, one can set | 88 // timing out. To wait indefinitely, one can set |
| 87 // |timeout| to be base::TimeDelta::FromMilliseconds(INFINITE). | 89 // |timeout| to be base::TimeDelta::FromMilliseconds(INFINITE). |
| 88 // Returns true if this executes successfully. | 90 // Returns true if this executes successfully. |
| 89 // Returns false if command execution fails to execute, or times out. | 91 // Returns false if command execution fails to execute, or times out. |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 std::map<std::string, std::string>::const_iterator data_it( | 209 std::map<std::string, std::string>::const_iterator data_it( |
| 208 untrusted_data.find(key)); | 210 untrusted_data.find(key)); |
| 209 if (data_it != untrusted_data.end()) | 211 if (data_it != untrusted_data.end()) |
| 210 return data_it->second; | 212 return data_it->second; |
| 211 } | 213 } |
| 212 | 214 |
| 213 return std::string(); | 215 return std::string(); |
| 214 } | 216 } |
| 215 | 217 |
| 216 } // namespace google_update | 218 } // namespace google_update |
| OLD | NEW |