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/browser/component_updater/recovery_component_installer.h" | 5 #include "chrome/browser/component_updater/recovery_component_installer.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 command_line.AppendArg(version_string); | 111 command_line.AppendArg(version_string); |
112 } | 112 } |
113 | 113 |
114 return command_line; | 114 return command_line; |
115 } | 115 } |
116 | 116 |
117 #if defined(OS_WIN) | 117 #if defined(OS_WIN) |
118 scoped_ptr<base::DictionaryValue> ReadManifest(const base::FilePath& manifest) { | 118 scoped_ptr<base::DictionaryValue> ReadManifest(const base::FilePath& manifest) { |
119 JSONFileValueDeserializer deserializer(manifest); | 119 JSONFileValueDeserializer deserializer(manifest); |
120 std::string error; | 120 std::string error; |
121 scoped_ptr<base::Value> root(deserializer.Deserialize(NULL, &error)); | 121 return base::DictionaryValue::From(deserializer.Deserialize(NULL, &error)); |
122 if (root.get() && root->IsType(base::Value::TYPE_DICTIONARY)) { | |
123 return scoped_ptr<base::DictionaryValue>( | |
124 static_cast<base::DictionaryValue*>(root.release())); | |
125 } | |
126 return scoped_ptr<base::DictionaryValue>(); | |
127 } | 122 } |
128 | 123 |
129 void WaitForElevatedInstallToComplete(base::Process process) { | 124 void WaitForElevatedInstallToComplete(base::Process process) { |
130 int installer_exit_code = 0; | 125 int installer_exit_code = 0; |
131 const base::TimeDelta kMaxWaitTime = base::TimeDelta::FromSeconds(600); | 126 const base::TimeDelta kMaxWaitTime = base::TimeDelta::FromSeconds(600); |
132 if (process.WaitForExitWithTimeout(kMaxWaitTime, &installer_exit_code)) { | 127 if (process.WaitForExitWithTimeout(kMaxWaitTime, &installer_exit_code)) { |
133 if (installer_exit_code == EXIT_CODE_RECOVERY_SUCCEEDED) { | 128 if (installer_exit_code == EXIT_CODE_RECOVERY_SUCCEEDED) { |
134 RecordRecoveryComponentUMAEvent(RCE_ELEVATED_SUCCEEDED); | 129 RecordRecoveryComponentUMAEvent(RCE_ELEVATED_SUCCEEDED); |
135 } else { | 130 } else { |
136 RecordRecoveryComponentUMAEvent(RCE_ELEVATED_SKIPPED); | 131 RecordRecoveryComponentUMAEvent(RCE_ELEVATED_SKIPPED); |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 #endif // OS_WIN | 412 #endif // OS_WIN |
418 prefs->SetBoolean(prefs::kRecoveryComponentNeedsElevation, false); | 413 prefs->SetBoolean(prefs::kRecoveryComponentNeedsElevation, false); |
419 } | 414 } |
420 | 415 |
421 void DeclinedElevatedRecoveryInstall(PrefService* prefs) { | 416 void DeclinedElevatedRecoveryInstall(PrefService* prefs) { |
422 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 417 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
423 prefs->SetBoolean(prefs::kRecoveryComponentNeedsElevation, false); | 418 prefs->SetBoolean(prefs::kRecoveryComponentNeedsElevation, false); |
424 } | 419 } |
425 | 420 |
426 } // namespace component_updater | 421 } // namespace component_updater |
OLD | NEW |