| // Copyright 2017 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #ifndef DeprecationReport_h |
| #define DeprecationReport_h |
| |
| #include "bindings/core/v8/SourceLocation.h" |
| #include "core/frame/ReportBody.h" |
| |
| namespace blink { |
| |
| class CORE_EXPORT DeprecationReport : public ReportBody { |
| DEFINE_WRAPPERTYPEINFO(); |
| |
| public: |
| DeprecationReport(const String& id, |
| double anticipatedRemoval, |
| const String& message, |
| std::unique_ptr<SourceLocation> location) |
| : id_(id), |
| anticipatedRemoval_(anticipatedRemoval), |
| message_(message), |
| location_(std::move(location)) {} |
| |
| ~DeprecationReport() override {} |
| |
| String id() const { return id_; } |
| double anticipatedRemoval(bool& is_null) const { |
| is_null = !anticipatedRemoval_; |
| return anticipatedRemoval_; |
| } |
| String message() const { return message_; } |
| long lineNumber() const { return location_->LineNumber(); } |
| String sourceFile() const { |
| return location_->Url().IsNull() ? "" : location_->Url(); |
| } |
| |
| virtual void Trace(blink::Visitor* visitor) { ReportBody::Trace(visitor); } |
| |
| private: |
| const String id_; |
| const double anticipatedRemoval_; |
| const String message_; |
| std::unique_ptr<SourceLocation> location_; |
| }; |
| |
| } // namespace blink |
| |
| #endif // DeprecationReport_h |