| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/extensions/extension_migrator.h" | 5 #include "chrome/browser/extensions/extension_migrator.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/defaults.h" | 10 #include "chrome/browser/defaults.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 ExtensionMigrator::~ExtensionMigrator() { | 23 ExtensionMigrator::~ExtensionMigrator() { |
| 24 } | 24 } |
| 25 | 25 |
| 26 void ExtensionMigrator::StartLoading() { | 26 void ExtensionMigrator::StartLoading() { |
| 27 prefs_.reset(new base::DictionaryValue); | 27 prefs_.reset(new base::DictionaryValue); |
| 28 | 28 |
| 29 const bool should_have_extension = | 29 const bool should_have_extension = |
| 30 IsAppPresent(old_id_) || IsAppPresent(new_id_); | 30 IsAppPresent(old_id_) || IsAppPresent(new_id_); |
| 31 if (should_have_extension) { | 31 if (should_have_extension) { |
| 32 scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue); | 32 std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue); |
| 33 entry->SetStringWithoutPathExpansion( | 33 entry->SetStringWithoutPathExpansion( |
| 34 ExternalProviderImpl::kExternalUpdateUrl, | 34 ExternalProviderImpl::kExternalUpdateUrl, |
| 35 extension_urls::GetWebstoreUpdateUrl().spec()); | 35 extension_urls::GetWebstoreUpdateUrl().spec()); |
| 36 | 36 |
| 37 prefs_->SetWithoutPathExpansion(new_id_, std::move(entry)); | 37 prefs_->SetWithoutPathExpansion(new_id_, std::move(entry)); |
| 38 } | 38 } |
| 39 | 39 |
| 40 LoadFinished(); | 40 LoadFinished(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 bool ExtensionMigrator::IsAppPresent(const std::string& app_id) { | 43 bool ExtensionMigrator::IsAppPresent(const std::string& app_id) { |
| 44 return !!ExtensionRegistry::Get(profile_)->GetInstalledExtension(app_id); | 44 return !!ExtensionRegistry::Get(profile_)->GetInstalledExtension(app_id); |
| 45 } | 45 } |
| 46 | 46 |
| 47 } // namespace extensions | 47 } // namespace extensions |
| OLD | NEW |