| 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 "base/memory/scoped_ptr.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/common/extensions/api/developer_private.h" | 9 #include "chrome/common/extensions/api/developer_private.h" |
| 10 #include "extensions/browser/extension_error.h" | 10 #include "extensions/browser/extension_error.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 for (const std::string& str_warning : info.install_warnings) { | 76 for (const std::string& str_warning : info.install_warnings) { |
| 77 api::developer_private::InstallWarning warning; | 77 api::developer_private::InstallWarning warning; |
| 78 warning.message = str_warning; | 78 warning.message = str_warning; |
| 79 result.install_warnings.push_back(std::move(warning)); | 79 result.install_warnings.push_back(std::move(warning)); |
| 80 } | 80 } |
| 81 for (const api::developer_private::ManifestError& error : | 81 for (const api::developer_private::ManifestError& error : |
| 82 info.manifest_errors) { | 82 info.manifest_errors) { |
| 83 scoped_ptr<base::DictionaryValue> value = error.ToValue(); | 83 scoped_ptr<base::DictionaryValue> value = error.ToValue(); |
| 84 value->SetInteger("type", static_cast<int>(ExtensionError::MANIFEST_ERROR)); | 84 value->SetInteger("type", static_cast<int>(ExtensionError::MANIFEST_ERROR)); |
| 85 value->SetInteger("level", static_cast<int>(logging::LOG_WARNING)); | 85 value->SetInteger("level", static_cast<int>(logging::LOG_WARNING)); |
| 86 result.manifest_errors.push_back(make_linked_ptr(value.release())); | 86 result.manifest_errors.push_back(std::move(value)); |
| 87 } | 87 } |
| 88 for (const api::developer_private::RuntimeError& error : | 88 for (const api::developer_private::RuntimeError& error : |
| 89 info.runtime_errors) { | 89 info.runtime_errors) { |
| 90 scoped_ptr<base::DictionaryValue> value = error.ToValue(); | 90 scoped_ptr<base::DictionaryValue> value = error.ToValue(); |
| 91 value->SetInteger("type", static_cast<int>(ExtensionError::RUNTIME_ERROR)); | 91 value->SetInteger("type", static_cast<int>(ExtensionError::RUNTIME_ERROR)); |
| 92 logging::LogSeverity severity = logging::LOG_INFO; | 92 logging::LogSeverity severity = logging::LOG_INFO; |
| 93 if (error.severity == api::developer_private::ERROR_LEVEL_WARN) | 93 if (error.severity == api::developer_private::ERROR_LEVEL_WARN) |
| 94 severity = logging::LOG_WARNING; | 94 severity = logging::LOG_WARNING; |
| 95 else if (error.severity == api::developer_private::ERROR_LEVEL_ERROR) | 95 else if (error.severity == api::developer_private::ERROR_LEVEL_ERROR) |
| 96 severity = logging::LOG_ERROR; | 96 severity = logging::LOG_ERROR; |
| 97 value->SetInteger("level", static_cast<int>(severity)); | 97 value->SetInteger("level", static_cast<int>(severity)); |
| 98 result.runtime_errors.push_back(make_linked_ptr(value.release())); | 98 result.runtime_errors.push_back(std::move(value)); |
| 99 } | 99 } |
| 100 result.offline_enabled = info.offline_enabled; | 100 result.offline_enabled = info.offline_enabled; |
| 101 for (const api::developer_private::ExtensionView& view : info.views) { | 101 for (const api::developer_private::ExtensionView& view : info.views) { |
| 102 api::developer_private::ItemInspectView view_copy; | 102 api::developer_private::ItemInspectView view_copy; |
| 103 GURL url(view.url); | 103 GURL url(view.url); |
| 104 if (url.scheme() == kExtensionScheme) { | 104 if (url.scheme() == kExtensionScheme) { |
| 105 // No leading slash. | 105 // No leading slash. |
| 106 view_copy.path = url.path().substr(1); | 106 view_copy.path = url.path().substr(1); |
| 107 } else { | 107 } else { |
| 108 // For live pages, use the full URL. | 108 // For live pages, use the full URL. |
| 109 view_copy.path = url.spec(); | 109 view_copy.path = url.spec(); |
| 110 } | 110 } |
| 111 view_copy.render_process_id = view.render_process_id; | 111 view_copy.render_process_id = view.render_process_id; |
| 112 view_copy.render_view_id = view.render_view_id; | 112 view_copy.render_view_id = view.render_view_id; |
| 113 view_copy.incognito = view.incognito; | 113 view_copy.incognito = view.incognito; |
| 114 view_copy.generated_background_page = | 114 view_copy.generated_background_page = |
| 115 view_copy.path == kGeneratedBackgroundPageFilename; | 115 view_copy.path == kGeneratedBackgroundPageFilename; |
| 116 result.views.push_back(std::move(view_copy)); | 116 result.views.push_back(std::move(view_copy)); |
| 117 } | 117 } |
| 118 | 118 |
| 119 return result; | 119 return result; |
| 120 } | 120 } |
| 121 | 121 |
| 122 } // namespace developer_private_mangle | 122 } // namespace developer_private_mangle |
| 123 } // namespace extensions | 123 } // namespace extensions |
| OLD | NEW |