| 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/api/developer_private/developer_private_mang
le.h" | 5 #include "chrome/browser/extensions/api/developer_private/developer_private_mang
le.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include <memory> |
| 8 |
| 8 #include "base/values.h" | 9 #include "base/values.h" |
| 9 #include "chrome/common/extensions/api/developer_private.h" | 10 #include "chrome/common/extensions/api/developer_private.h" |
| 10 #include "extensions/browser/extension_error.h" | 11 #include "extensions/browser/extension_error.h" |
| 11 #include "extensions/common/constants.h" | 12 #include "extensions/common/constants.h" |
| 12 | 13 |
| 13 namespace extensions { | 14 namespace extensions { |
| 14 namespace developer_private_mangle { | 15 namespace developer_private_mangle { |
| 15 | 16 |
| 16 api::developer_private::ItemInfo MangleExtensionInfo( | 17 api::developer_private::ItemInfo MangleExtensionInfo( |
| 17 const api::developer_private::ExtensionInfo& info) { | 18 const api::developer_private::ExtensionInfo& info) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 if (!info.home_page.url.empty()) | 74 if (!info.home_page.url.empty()) |
| 74 result.homepage_url.reset(new std::string(info.home_page.url)); | 75 result.homepage_url.reset(new std::string(info.home_page.url)); |
| 75 result.update_url.reset(new std::string(info.update_url)); | 76 result.update_url.reset(new std::string(info.update_url)); |
| 76 for (const std::string& str_warning : info.install_warnings) { | 77 for (const std::string& str_warning : info.install_warnings) { |
| 77 api::developer_private::InstallWarning warning; | 78 api::developer_private::InstallWarning warning; |
| 78 warning.message = str_warning; | 79 warning.message = str_warning; |
| 79 result.install_warnings.push_back(std::move(warning)); | 80 result.install_warnings.push_back(std::move(warning)); |
| 80 } | 81 } |
| 81 for (const api::developer_private::ManifestError& error : | 82 for (const api::developer_private::ManifestError& error : |
| 82 info.manifest_errors) { | 83 info.manifest_errors) { |
| 83 scoped_ptr<base::DictionaryValue> value = error.ToValue(); | 84 std::unique_ptr<base::DictionaryValue> value = error.ToValue(); |
| 84 value->SetInteger("type", static_cast<int>(ExtensionError::MANIFEST_ERROR)); | 85 value->SetInteger("type", static_cast<int>(ExtensionError::MANIFEST_ERROR)); |
| 85 value->SetInteger("level", static_cast<int>(logging::LOG_WARNING)); | 86 value->SetInteger("level", static_cast<int>(logging::LOG_WARNING)); |
| 86 result.manifest_errors.push_back(std::move(value)); | 87 result.manifest_errors.push_back(std::move(value)); |
| 87 } | 88 } |
| 88 for (const api::developer_private::RuntimeError& error : | 89 for (const api::developer_private::RuntimeError& error : |
| 89 info.runtime_errors) { | 90 info.runtime_errors) { |
| 90 scoped_ptr<base::DictionaryValue> value = error.ToValue(); | 91 std::unique_ptr<base::DictionaryValue> value = error.ToValue(); |
| 91 value->SetInteger("type", static_cast<int>(ExtensionError::RUNTIME_ERROR)); | 92 value->SetInteger("type", static_cast<int>(ExtensionError::RUNTIME_ERROR)); |
| 92 logging::LogSeverity severity = logging::LOG_INFO; | 93 logging::LogSeverity severity = logging::LOG_INFO; |
| 93 if (error.severity == api::developer_private::ERROR_LEVEL_WARN) | 94 if (error.severity == api::developer_private::ERROR_LEVEL_WARN) |
| 94 severity = logging::LOG_WARNING; | 95 severity = logging::LOG_WARNING; |
| 95 else if (error.severity == api::developer_private::ERROR_LEVEL_ERROR) | 96 else if (error.severity == api::developer_private::ERROR_LEVEL_ERROR) |
| 96 severity = logging::LOG_ERROR; | 97 severity = logging::LOG_ERROR; |
| 97 value->SetInteger("level", static_cast<int>(severity)); | 98 value->SetInteger("level", static_cast<int>(severity)); |
| 98 result.runtime_errors.push_back(std::move(value)); | 99 result.runtime_errors.push_back(std::move(value)); |
| 99 } | 100 } |
| 100 result.offline_enabled = info.offline_enabled; | 101 result.offline_enabled = info.offline_enabled; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 114 view_copy.generated_background_page = | 115 view_copy.generated_background_page = |
| 115 view_copy.path == kGeneratedBackgroundPageFilename; | 116 view_copy.path == kGeneratedBackgroundPageFilename; |
| 116 result.views.push_back(std::move(view_copy)); | 117 result.views.push_back(std::move(view_copy)); |
| 117 } | 118 } |
| 118 | 119 |
| 119 return result; | 120 return result; |
| 120 } | 121 } |
| 121 | 122 |
| 122 } // namespace developer_private_mangle | 123 } // namespace developer_private_mangle |
| 123 } // namespace extensions | 124 } // namespace extensions |
| OLD | NEW |