| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // Checks if elevated recovery simulation switch was present on the command | 83 // Checks if elevated recovery simulation switch was present on the command |
| 84 // line. This is for testing purpose. | 84 // line. This is for testing purpose. |
| 85 bool SimulatingElevatedRecovery() { | 85 bool SimulatingElevatedRecovery() { |
| 86 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 86 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 87 switches::kSimulateElevatedRecovery); | 87 switches::kSimulateElevatedRecovery); |
| 88 } | 88 } |
| 89 #endif // !defined(OS_CHROMEOS) | 89 #endif // !defined(OS_CHROMEOS) |
| 90 | 90 |
| 91 #if defined(OS_WIN) | 91 #if defined(OS_WIN) |
| 92 scoped_ptr<base::DictionaryValue> ReadManifest(const base::FilePath& manifest) { | 92 scoped_ptr<base::DictionaryValue> ReadManifest(const base::FilePath& manifest) { |
| 93 JSONFileValueSerializer serializer(manifest); | 93 JSONFileValueDeserializer deserializer(manifest); |
| 94 std::string error; | 94 std::string error; |
| 95 scoped_ptr<base::Value> root(serializer.Deserialize(NULL, &error)); | 95 scoped_ptr<base::Value> root(deserializer.Deserialize(NULL, &error)); |
| 96 if (root.get() && root->IsType(base::Value::TYPE_DICTIONARY)) { | 96 if (root.get() && root->IsType(base::Value::TYPE_DICTIONARY)) { |
| 97 return scoped_ptr<base::DictionaryValue>( | 97 return scoped_ptr<base::DictionaryValue>( |
| 98 static_cast<base::DictionaryValue*>(root.release())); | 98 static_cast<base::DictionaryValue*>(root.release())); |
| 99 } | 99 } |
| 100 return scoped_ptr<base::DictionaryValue>(); | 100 return scoped_ptr<base::DictionaryValue>(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void WaitForElevatedInstallToComplete(base::Process process) { | 103 void WaitForElevatedInstallToComplete(base::Process process) { |
| 104 int installer_exit_code = 0; | 104 int installer_exit_code = 0; |
| 105 const base::TimeDelta kMaxWaitTime = base::TimeDelta::FromSeconds(600); | 105 const base::TimeDelta kMaxWaitTime = base::TimeDelta::FromSeconds(600); |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 #endif // OS_WIN | 402 #endif // OS_WIN |
| 403 prefs->SetBoolean(prefs::kRecoveryComponentNeedsElevation, false); | 403 prefs->SetBoolean(prefs::kRecoveryComponentNeedsElevation, false); |
| 404 } | 404 } |
| 405 | 405 |
| 406 void DeclinedElevatedRecoveryInstall(PrefService* prefs) { | 406 void DeclinedElevatedRecoveryInstall(PrefService* prefs) { |
| 407 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 407 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 408 prefs->SetBoolean(prefs::kRecoveryComponentNeedsElevation, false); | 408 prefs->SetBoolean(prefs::kRecoveryComponentNeedsElevation, false); |
| 409 } | 409 } |
| 410 | 410 |
| 411 } // namespace component_updater | 411 } // namespace component_updater |
| OLD | NEW |