| 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/extension_info_generat
or.h" | 5 #include "chrome/browser/extensions/api/developer_private/extension_info_generat
or.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/extensions/api/developer_private/inspectable_views_find
er.h" | 9 #include "chrome/browser/extensions/api/developer_private/inspectable_views_find
er.h" |
| 10 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" | 10 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // Populates the common fields of an extension error. | 81 // Populates the common fields of an extension error. |
| 82 template <typename ErrorType> | 82 template <typename ErrorType> |
| 83 void PopulateErrorBase(const ExtensionError& error, ErrorType* out) { | 83 void PopulateErrorBase(const ExtensionError& error, ErrorType* out) { |
| 84 CHECK(out); | 84 CHECK(out); |
| 85 out->type = error.type() == ExtensionError::MANIFEST_ERROR ? | 85 out->type = error.type() == ExtensionError::MANIFEST_ERROR ? |
| 86 developer::ERROR_TYPE_MANIFEST : developer::ERROR_TYPE_RUNTIME; | 86 developer::ERROR_TYPE_MANIFEST : developer::ERROR_TYPE_RUNTIME; |
| 87 out->extension_id = error.extension_id(); | 87 out->extension_id = error.extension_id(); |
| 88 out->from_incognito = error.from_incognito(); | 88 out->from_incognito = error.from_incognito(); |
| 89 out->source = base::UTF16ToUTF8(error.source()); | 89 out->source = base::UTF16ToUTF8(error.source()); |
| 90 out->message = base::UTF16ToUTF8(error.message()); | 90 out->message = base::UTF16ToUTF8(error.message()); |
| 91 out->id = error.id(); |
| 91 } | 92 } |
| 92 | 93 |
| 93 // Given a ManifestError object, converts it into its developer_private | 94 // Given a ManifestError object, converts it into its developer_private |
| 94 // counterpart. | 95 // counterpart. |
| 95 linked_ptr<developer::ManifestError> ConstructManifestError( | 96 linked_ptr<developer::ManifestError> ConstructManifestError( |
| 96 const ManifestError& error) { | 97 const ManifestError& error) { |
| 97 linked_ptr<developer::ManifestError> result(new developer::ManifestError()); | 98 linked_ptr<developer::ManifestError> result(new developer::ManifestError()); |
| 98 PopulateErrorBase(error, result.get()); | 99 PopulateErrorBase(error, result.get()); |
| 99 result->manifest_key = base::UTF16ToUTF8(error.manifest_key()); | 100 result->manifest_key = base::UTF16ToUTF8(error.manifest_key()); |
| 100 if (!error.manifest_specific().empty()) { | 101 if (!error.manifest_specific().empty()) { |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 // that at the end of the method, any stored refs are destroyed. | 513 // that at the end of the method, any stored refs are destroyed. |
| 513 ExtensionInfoList list; | 514 ExtensionInfoList list; |
| 514 list.swap(list_); | 515 list.swap(list_); |
| 515 ExtensionInfosCallback callback = callback_; | 516 ExtensionInfosCallback callback = callback_; |
| 516 callback_.Reset(); | 517 callback_.Reset(); |
| 517 callback.Run(list); // WARNING: |this| is possibly deleted after this line! | 518 callback.Run(list); // WARNING: |this| is possibly deleted after this line! |
| 518 } | 519 } |
| 519 } | 520 } |
| 520 | 521 |
| 521 } // namespace extensions | 522 } // namespace extensions |
| OLD | NEW |