| // Copyright 2013 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 COMPONENTS_SPELLCHECK_COMMON_SPELLCHECK_MOJOM_BLINK_H_ |
| #define COMPONENTS_SPELLCHECK_COMMON_SPELLCHECK_MOJOM_BLINK_H_ |
| |
| #include <stdint.h> |
| |
| #include <limits> |
| #include <type_traits> |
| #include <utility> |
| |
| #include "base/callback.h" |
| #include "base/macros.h" |
| #include "base/optional.h" |
| |
| #include "mojo/public/cpp/bindings/mojo_buildflags.h" |
| #if BUILDFLAG(MOJO_TRACE_ENABLED) |
| #include "base/trace_event/trace_event.h" |
| #endif |
| #include "mojo/public/cpp/bindings/clone_traits.h" |
| #include "mojo/public/cpp/bindings/equals_traits.h" |
| #include "mojo/public/cpp/bindings/lib/serialization.h" |
| #include "mojo/public/cpp/bindings/struct_ptr.h" |
| #include "mojo/public/cpp/bindings/struct_traits.h" |
| #include "mojo/public/cpp/bindings/union_traits.h" |
| #include "components/spellcheck/common/spellcheck.mojom-shared.h" |
| #include "components/spellcheck/common/spellcheck.mojom-blink-forward.h" |
| #include "mojo/public/mojom/base/file.mojom-blink.h" |
| #include "mojo/public/mojom/base/string16.mojom-blink.h" |
| |
| #include "mojo/public/cpp/bindings/lib/wtf_clone_equals_util.h" |
| #include "mojo/public/cpp/bindings/lib/wtf_hash_util.h" |
| #include "third_party/blink/renderer/platform/wtf/hash_functions.h" |
| #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" |
| |
| #include "mojo/public/cpp/bindings/associated_interface_ptr.h" |
| #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" |
| #include "mojo/public/cpp/bindings/associated_interface_request.h" |
| #include "mojo/public/cpp/bindings/interface_ptr.h" |
| #include "mojo/public/cpp/bindings/interface_request.h" |
| #include "mojo/public/cpp/bindings/lib/control_message_handler.h" |
| #include "mojo/public/cpp/bindings/raw_ptr_impl_ref_traits.h" |
| #include "mojo/public/cpp/bindings/thread_safe_interface_ptr.h" |
| |
| |
| #include "mojo/public/cpp/bindings/lib/native_enum_serialization.h" |
| #include "mojo/public/cpp/bindings/lib/native_struct_serialization.h" |
| |
| #ifdef KYTHE_IS_RUNNING |
| #pragma kythe_inline_metadata "Metadata comment" |
| #endif |
| |
| |
| namespace WTF { |
| struct spellcheck_mojom_internal_Decoration_DataHashFn { |
| static unsigned GetHash(const ::spellcheck::mojom::Decoration& value) { |
| using utype = std::underlying_type<::spellcheck::mojom::Decoration>::type; |
| return DefaultHash<utype>::Hash().GetHash(static_cast<utype>(value)); |
| } |
| static bool Equal(const ::spellcheck::mojom::Decoration& left, const ::spellcheck::mojom::Decoration& right) { |
| return left == right; |
| } |
| static const bool safe_to_compare_to_empty_or_deleted = true; |
| }; |
| |
| template <> |
| struct HashTraits<::spellcheck::mojom::Decoration> |
| : public GenericHashTraits<::spellcheck::mojom::Decoration> { |
| static_assert(true, |
| "-1000000 is a reserved enum value"); |
| static_assert(true, |
| "-1000001 is a reserved enum value"); |
| static const bool hasIsEmptyValueFunction = true; |
| static bool IsEmptyValue(const ::spellcheck::mojom::Decoration& value) { |
| return value == static_cast<::spellcheck::mojom::Decoration>(-1000000); |
| } |
| static void ConstructDeletedValue(::spellcheck::mojom::Decoration& slot, bool) { |
| slot = static_cast<::spellcheck::mojom::Decoration>(-1000001); |
| } |
| static bool IsDeletedValue(const ::spellcheck::mojom::Decoration& value) { |
| return value == static_cast<::spellcheck::mojom::Decoration>(-1000001); |
| } |
| }; |
| } // namespace WTF |
| |
| |
| namespace spellcheck { |
| namespace mojom { |
| namespace blink { |
| |
| class SpellCheckerProxy; |
| |
| template <typename ImplRefTraits> |
| class SpellCheckerStub; |
| |
| class SpellCheckerRequestValidator; |
| |
| |
| // @generated_from: spellcheck.mojom.SpellChecker |
| class SpellChecker |
| : public SpellCheckerInterfaceBase { |
| public: |
| static const char Name_[]; |
| static constexpr uint32_t Version_ = 0; |
| static constexpr bool PassesAssociatedKinds_ = false; |
| static constexpr bool HasSyncMethods_ = false; |
| |
| using Base_ = SpellCheckerInterfaceBase; |
| using Proxy_ = SpellCheckerProxy; |
| |
| template <typename ImplRefTraits> |
| using Stub_ = SpellCheckerStub<ImplRefTraits>; |
| |
| using RequestValidator_ = SpellCheckerRequestValidator; |
| using ResponseValidator_ = mojo::PassThroughFilter; |
| enum MethodMinVersions : uint32_t { |
| kInitializeMinVersion = 0, |
| kCustomDictionaryChangedMinVersion = 0, |
| }; |
| virtual ~SpellChecker() {} |
| |
| |
| // @generated_from: spellcheck.mojom.SpellChecker.Initialize |
| virtual void Initialize(WTF::Vector<SpellCheckBDictLanguagePtr> dictionaries, const WTF::Vector<WTF::String>& custom_words, bool enable) = 0; |
| |
| |
| // @generated_from: spellcheck.mojom.SpellChecker.CustomDictionaryChanged |
| virtual void CustomDictionaryChanged(const WTF::Vector<WTF::String>& words_added, const WTF::Vector<WTF::String>& words_removed) = 0; |
| }; |
| |
| class SpellCheckHostProxy; |
| |
| template <typename ImplRefTraits> |
| class SpellCheckHostStub; |
| |
| class SpellCheckHostRequestValidator; |
| class SpellCheckHostResponseValidator; |
| |
| |
| // @generated_from: spellcheck.mojom.SpellCheckHost |
| class SpellCheckHost |
| : public SpellCheckHostInterfaceBase { |
| public: |
| static const char Name_[]; |
| static constexpr uint32_t Version_ = 0; |
| static constexpr bool PassesAssociatedKinds_ = false; |
| static constexpr bool HasSyncMethods_ = true; |
| |
| using Base_ = SpellCheckHostInterfaceBase; |
| using Proxy_ = SpellCheckHostProxy; |
| |
| template <typename ImplRefTraits> |
| using Stub_ = SpellCheckHostStub<ImplRefTraits>; |
| |
| using RequestValidator_ = SpellCheckHostRequestValidator; |
| using ResponseValidator_ = SpellCheckHostResponseValidator; |
| enum MethodMinVersions : uint32_t { |
| kRequestDictionaryMinVersion = 0, |
| kNotifyCheckedMinVersion = 0, |
| kCallSpellingServiceMinVersion = 0, |
| kRequestTextCheckMinVersion = 0, |
| kCheckSpellingMinVersion = 0, |
| kFillSuggestionListMinVersion = 0, |
| }; |
| virtual ~SpellCheckHost() {} |
| |
| |
| // @generated_from: spellcheck.mojom.SpellCheckHost.RequestDictionary |
| virtual void RequestDictionary() = 0; |
| |
| |
| // @generated_from: spellcheck.mojom.SpellCheckHost.NotifyChecked |
| virtual void NotifyChecked(const WTF::String& word, bool misspelled) = 0; |
| |
| |
| using CallSpellingServiceCallback = base::OnceCallback<void(bool, WTF::Vector<SpellCheckResultPtr>)>; |
| |
| // @generated_from: spellcheck.mojom.SpellCheckHost.CallSpellingService |
| virtual void CallSpellingService(const WTF::String& text, CallSpellingServiceCallback callback) = 0; |
| |
| |
| using RequestTextCheckCallback = base::OnceCallback<void(WTF::Vector<SpellCheckResultPtr>)>; |
| |
| // @generated_from: spellcheck.mojom.SpellCheckHost.RequestTextCheck |
| virtual void RequestTextCheck(const WTF::String& text, int32_t route_id, RequestTextCheckCallback callback) = 0; |
| |
| // Sync method. This signature is used by the client side; the service side |
| // should implement the signature with callback below. |
| |
| // @generated_from: spellcheck.mojom.SpellCheckHost.CheckSpelling |
| virtual bool CheckSpelling(const WTF::String& word, int32_t route_id, bool* out_correct); |
| |
| using CheckSpellingCallback = base::OnceCallback<void(bool)>; |
| |
| // @generated_from: spellcheck.mojom.SpellCheckHost.CheckSpelling |
| virtual void CheckSpelling(const WTF::String& word, int32_t route_id, CheckSpellingCallback callback) = 0; |
| |
| // Sync method. This signature is used by the client side; the service side |
| // should implement the signature with callback below. |
| |
| // @generated_from: spellcheck.mojom.SpellCheckHost.FillSuggestionList |
| virtual bool FillSuggestionList(const WTF::String& word, WTF::Vector<WTF::String>* out_suggestions); |
| |
| using FillSuggestionListCallback = base::OnceCallback<void(const WTF::Vector<WTF::String>&)>; |
| |
| // @generated_from: spellcheck.mojom.SpellCheckHost.FillSuggestionList |
| virtual void FillSuggestionList(const WTF::String& word, FillSuggestionListCallback callback) = 0; |
| }; |
| |
| class SpellCheckerProxy |
| : public SpellChecker { |
| public: |
| using InterfaceType = SpellChecker; |
| |
| explicit SpellCheckerProxy(mojo::MessageReceiverWithResponder* receiver); |
| void Initialize(WTF::Vector<SpellCheckBDictLanguagePtr> dictionaries, const WTF::Vector<WTF::String>& custom_words, bool enable) final; |
| void CustomDictionaryChanged(const WTF::Vector<WTF::String>& words_added, const WTF::Vector<WTF::String>& words_removed) final; |
| |
| private: |
| mojo::MessageReceiverWithResponder* receiver_; |
| }; |
| |
| class SpellCheckHostProxy |
| : public SpellCheckHost { |
| public: |
| using InterfaceType = SpellCheckHost; |
| |
| explicit SpellCheckHostProxy(mojo::MessageReceiverWithResponder* receiver); |
| void RequestDictionary() final; |
| void NotifyChecked(const WTF::String& word, bool misspelled) final; |
| void CallSpellingService(const WTF::String& text, CallSpellingServiceCallback callback) final; |
| void RequestTextCheck(const WTF::String& text, int32_t route_id, RequestTextCheckCallback callback) final; |
| bool CheckSpelling(const WTF::String& word, int32_t route_id, bool* out_correct) final; |
| void CheckSpelling(const WTF::String& word, int32_t route_id, CheckSpellingCallback callback) final; |
| bool FillSuggestionList(const WTF::String& word, WTF::Vector<WTF::String>* out_suggestions) final; |
| void FillSuggestionList(const WTF::String& word, FillSuggestionListCallback callback) final; |
| |
| private: |
| mojo::MessageReceiverWithResponder* receiver_; |
| }; |
| class SpellCheckerStubDispatch { |
| public: |
| static bool Accept(SpellChecker* impl, mojo::Message* message); |
| static bool AcceptWithResponder( |
| SpellChecker* impl, |
| mojo::Message* message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder); |
| }; |
| |
| template <typename ImplRefTraits = |
| mojo::RawPtrImplRefTraits<SpellChecker>> |
| class SpellCheckerStub |
| : public mojo::MessageReceiverWithResponderStatus { |
| public: |
| using ImplPointerType = typename ImplRefTraits::PointerType; |
| |
| SpellCheckerStub() {} |
| ~SpellCheckerStub() override {} |
| |
| void set_sink(ImplPointerType sink) { sink_ = std::move(sink); } |
| ImplPointerType& sink() { return sink_; } |
| |
| bool Accept(mojo::Message* message) override { |
| if (ImplRefTraits::IsNull(sink_)) |
| return false; |
| return SpellCheckerStubDispatch::Accept( |
| ImplRefTraits::GetRawPointer(&sink_), message); |
| } |
| |
| bool AcceptWithResponder( |
| mojo::Message* message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) override { |
| if (ImplRefTraits::IsNull(sink_)) |
| return false; |
| return SpellCheckerStubDispatch::AcceptWithResponder( |
| ImplRefTraits::GetRawPointer(&sink_), message, std::move(responder)); |
| } |
| |
| private: |
| ImplPointerType sink_; |
| }; |
| class SpellCheckHostStubDispatch { |
| public: |
| static bool Accept(SpellCheckHost* impl, mojo::Message* message); |
| static bool AcceptWithResponder( |
| SpellCheckHost* impl, |
| mojo::Message* message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder); |
| }; |
| |
| template <typename ImplRefTraits = |
| mojo::RawPtrImplRefTraits<SpellCheckHost>> |
| class SpellCheckHostStub |
| : public mojo::MessageReceiverWithResponderStatus { |
| public: |
| using ImplPointerType = typename ImplRefTraits::PointerType; |
| |
| SpellCheckHostStub() {} |
| ~SpellCheckHostStub() override {} |
| |
| void set_sink(ImplPointerType sink) { sink_ = std::move(sink); } |
| ImplPointerType& sink() { return sink_; } |
| |
| bool Accept(mojo::Message* message) override { |
| if (ImplRefTraits::IsNull(sink_)) |
| return false; |
| return SpellCheckHostStubDispatch::Accept( |
| ImplRefTraits::GetRawPointer(&sink_), message); |
| } |
| |
| bool AcceptWithResponder( |
| mojo::Message* message, |
| std::unique_ptr<mojo::MessageReceiverWithStatus> responder) override { |
| if (ImplRefTraits::IsNull(sink_)) |
| return false; |
| return SpellCheckHostStubDispatch::AcceptWithResponder( |
| ImplRefTraits::GetRawPointer(&sink_), message, std::move(responder)); |
| } |
| |
| private: |
| ImplPointerType sink_; |
| }; |
| class SpellCheckerRequestValidator : public mojo::MessageReceiver { |
| public: |
| bool Accept(mojo::Message* message) override; |
| }; |
| class SpellCheckHostRequestValidator : public mojo::MessageReceiver { |
| public: |
| bool Accept(mojo::Message* message) override; |
| }; |
| class SpellCheckHostResponseValidator : public mojo::MessageReceiver { |
| public: |
| bool Accept(mojo::Message* message) override; |
| }; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| // @generated_from: spellcheck.mojom.SpellCheckBDictLanguage |
| class SpellCheckBDictLanguage { |
| public: |
| template <typename T> |
| using EnableIfSame = std::enable_if_t<std::is_same<SpellCheckBDictLanguage, T>::value>; |
| using DataView = SpellCheckBDictLanguageDataView; |
| using Data_ = internal::SpellCheckBDictLanguage_Data; |
| |
| template <typename... Args> |
| static SpellCheckBDictLanguagePtr New(Args&&... args) { |
| return SpellCheckBDictLanguagePtr( |
| base::in_place, std::forward<Args>(args)...); |
| } |
| |
| template <typename U> |
| static SpellCheckBDictLanguagePtr From(const U& u) { |
| return mojo::TypeConverter<SpellCheckBDictLanguagePtr, U>::Convert(u); |
| } |
| |
| template <typename U> |
| U To() const { |
| return mojo::TypeConverter<U, SpellCheckBDictLanguage>::Convert(*this); |
| } |
| |
| |
| SpellCheckBDictLanguage(); |
| |
| SpellCheckBDictLanguage( |
| base::File file, |
| const WTF::String& language); |
| |
| ~SpellCheckBDictLanguage(); |
| |
| // Clone() is a template so it is only instantiated if it is used. Thus, the |
| // bindings generator does not need to know whether Clone() or copy |
| // constructor/assignment are available for members. |
| template <typename StructPtrType = SpellCheckBDictLanguagePtr> |
| SpellCheckBDictLanguagePtr Clone() const; |
| |
| // Equals() is a template so it is only instantiated if it is used. Thus, the |
| // bindings generator does not need to know whether Equals() or == operator |
| // are available for members. |
| template <typename T, SpellCheckBDictLanguage::EnableIfSame<T>* = nullptr> |
| bool Equals(const T& other) const; |
| |
| template <typename UserType> |
| static WTF::Vector<uint8_t> Serialize(UserType* input) { |
| return mojo::internal::SerializeImpl< |
| SpellCheckBDictLanguage::DataView, WTF::Vector<uint8_t>>(input); |
| } |
| |
| template <typename UserType> |
| static mojo::Message SerializeAsMessage(UserType* input) { |
| return mojo::internal::SerializeAsMessageImpl< |
| SpellCheckBDictLanguage::DataView>(input); |
| } |
| |
| // The returned Message is serialized only if the message is moved |
| // cross-process or cross-language. Otherwise if the message is Deserialized |
| // as the same UserType |input| will just be moved to |output| in |
| // DeserializeFromMessage. |
| template <typename UserType> |
| static mojo::Message WrapAsMessage(UserType input) { |
| return mojo::Message(std::make_unique< |
| internal::SpellCheckBDictLanguage_UnserializedMessageContext< |
| UserType, SpellCheckBDictLanguage::DataView>>(0, 0, std::move(input))); |
| } |
| |
| template <typename UserType> |
| static bool Deserialize(const void* data, |
| size_t data_num_bytes, |
| UserType* output) { |
| return mojo::internal::DeserializeImpl<SpellCheckBDictLanguage::DataView>( |
| data, data_num_bytes, std::vector<mojo::ScopedHandle>(), output, Validate); |
| } |
| |
| template <typename UserType> |
| static bool Deserialize(const WTF::Vector<uint8_t>& input, |
| UserType* output) { |
| return SpellCheckBDictLanguage::Deserialize( |
| input.size() == 0 ? nullptr : &input.front(), input.size(), output); |
| } |
| |
| template <typename UserType> |
| static bool DeserializeFromMessage(mojo::Message input, |
| UserType* output) { |
| auto context = input.TakeUnserializedContext< |
| internal::SpellCheckBDictLanguage_UnserializedMessageContext< |
| UserType, SpellCheckBDictLanguage::DataView>>(); |
| if (context) { |
| *output = std::move(context->TakeData()); |
| return true; |
| } |
| input.SerializeIfNecessary(); |
| return mojo::internal::DeserializeImpl<SpellCheckBDictLanguage::DataView>( |
| input.payload(), input.payload_num_bytes(), |
| std::move(*input.mutable_handles()), output, Validate); |
| } |
| |
| |
| // @generated_from: spellcheck.mojom.SpellCheckBDictLanguage.file |
| base::File file; |
| |
| // @generated_from: spellcheck.mojom.SpellCheckBDictLanguage.language |
| WTF::String language; |
| |
| private: |
| static bool Validate(const void* data, |
| mojo::internal::ValidationContext* validation_context); |
| DISALLOW_COPY_AND_ASSIGN(SpellCheckBDictLanguage); |
| }; |
| |
| // The comparison operators are templates, so they are only instantiated if they |
| // are used. Thus, the bindings generator does not need to know whether |
| // comparison operators are available for members. |
| template <typename T, SpellCheckBDictLanguage::EnableIfSame<T>* = nullptr> |
| bool operator<(const T& lhs, const T& rhs); |
| |
| template <typename T, SpellCheckBDictLanguage::EnableIfSame<T>* = nullptr> |
| bool operator<=(const T& lhs, const T& rhs) { |
| return !(rhs < lhs); |
| } |
| |
| template <typename T, SpellCheckBDictLanguage::EnableIfSame<T>* = nullptr> |
| bool operator>(const T& lhs, const T& rhs) { |
| return rhs < lhs; |
| } |
| |
| template <typename T, SpellCheckBDictLanguage::EnableIfSame<T>* = nullptr> |
| bool operator>=(const T& lhs, const T& rhs) { |
| return !(lhs < rhs); |
| } |
| |
| |
| |
| |
| |
| // @generated_from: spellcheck.mojom.SpellCheckResult |
| class SpellCheckResult { |
| public: |
| template <typename T> |
| using EnableIfSame = std::enable_if_t<std::is_same<SpellCheckResult, T>::value>; |
| using DataView = SpellCheckResultDataView; |
| using Data_ = internal::SpellCheckResult_Data; |
| |
| template <typename... Args> |
| static SpellCheckResultPtr New(Args&&... args) { |
| return SpellCheckResultPtr( |
| base::in_place, std::forward<Args>(args)...); |
| } |
| |
| template <typename U> |
| static SpellCheckResultPtr From(const U& u) { |
| return mojo::TypeConverter<SpellCheckResultPtr, U>::Convert(u); |
| } |
| |
| template <typename U> |
| U To() const { |
| return mojo::TypeConverter<U, SpellCheckResult>::Convert(*this); |
| } |
| |
| |
| SpellCheckResult(); |
| |
| SpellCheckResult( |
| Decoration decoration, |
| int32_t location, |
| int32_t length, |
| const WTF::Vector<WTF::String>& replacements); |
| |
| ~SpellCheckResult(); |
| |
| // Clone() is a template so it is only instantiated if it is used. Thus, the |
| // bindings generator does not need to know whether Clone() or copy |
| // constructor/assignment are available for members. |
| template <typename StructPtrType = SpellCheckResultPtr> |
| SpellCheckResultPtr Clone() const; |
| |
| // Equals() is a template so it is only instantiated if it is used. Thus, the |
| // bindings generator does not need to know whether Equals() or == operator |
| // are available for members. |
| template <typename T, SpellCheckResult::EnableIfSame<T>* = nullptr> |
| bool Equals(const T& other) const; |
| |
| template <typename UserType> |
| static WTF::Vector<uint8_t> Serialize(UserType* input) { |
| return mojo::internal::SerializeImpl< |
| SpellCheckResult::DataView, WTF::Vector<uint8_t>>(input); |
| } |
| |
| template <typename UserType> |
| static mojo::Message SerializeAsMessage(UserType* input) { |
| return mojo::internal::SerializeAsMessageImpl< |
| SpellCheckResult::DataView>(input); |
| } |
| |
| // The returned Message is serialized only if the message is moved |
| // cross-process or cross-language. Otherwise if the message is Deserialized |
| // as the same UserType |input| will just be moved to |output| in |
| // DeserializeFromMessage. |
| template <typename UserType> |
| static mojo::Message WrapAsMessage(UserType input) { |
| return mojo::Message(std::make_unique< |
| internal::SpellCheckResult_UnserializedMessageContext< |
| UserType, SpellCheckResult::DataView>>(0, 0, std::move(input))); |
| } |
| |
| template <typename UserType> |
| static bool Deserialize(const void* data, |
| size_t data_num_bytes, |
| UserType* output) { |
| return mojo::internal::DeserializeImpl<SpellCheckResult::DataView>( |
| data, data_num_bytes, std::vector<mojo::ScopedHandle>(), output, Validate); |
| } |
| |
| template <typename UserType> |
| static bool Deserialize(const WTF::Vector<uint8_t>& input, |
| UserType* output) { |
| return SpellCheckResult::Deserialize( |
| input.size() == 0 ? nullptr : &input.front(), input.size(), output); |
| } |
| |
| template <typename UserType> |
| static bool DeserializeFromMessage(mojo::Message input, |
| UserType* output) { |
| auto context = input.TakeUnserializedContext< |
| internal::SpellCheckResult_UnserializedMessageContext< |
| UserType, SpellCheckResult::DataView>>(); |
| if (context) { |
| *output = std::move(context->TakeData()); |
| return true; |
| } |
| input.SerializeIfNecessary(); |
| return mojo::internal::DeserializeImpl<SpellCheckResult::DataView>( |
| input.payload(), input.payload_num_bytes(), |
| std::move(*input.mutable_handles()), output, Validate); |
| } |
| |
| |
| // @generated_from: spellcheck.mojom.SpellCheckResult.decoration |
| Decoration decoration; |
| |
| // @generated_from: spellcheck.mojom.SpellCheckResult.location |
| int32_t location; |
| |
| // @generated_from: spellcheck.mojom.SpellCheckResult.length |
| int32_t length; |
| |
| // @generated_from: spellcheck.mojom.SpellCheckResult.replacements |
| WTF::Vector<WTF::String> replacements; |
| |
| private: |
| static bool Validate(const void* data, |
| mojo::internal::ValidationContext* validation_context); |
| }; |
| |
| // The comparison operators are templates, so they are only instantiated if they |
| // are used. Thus, the bindings generator does not need to know whether |
| // comparison operators are available for members. |
| template <typename T, SpellCheckResult::EnableIfSame<T>* = nullptr> |
| bool operator<(const T& lhs, const T& rhs); |
| |
| template <typename T, SpellCheckResult::EnableIfSame<T>* = nullptr> |
| bool operator<=(const T& lhs, const T& rhs) { |
| return !(rhs < lhs); |
| } |
| |
| template <typename T, SpellCheckResult::EnableIfSame<T>* = nullptr> |
| bool operator>(const T& lhs, const T& rhs) { |
| return rhs < lhs; |
| } |
| |
| template <typename T, SpellCheckResult::EnableIfSame<T>* = nullptr> |
| bool operator>=(const T& lhs, const T& rhs) { |
| return !(lhs < rhs); |
| } |
| |
| template <typename StructPtrType> |
| SpellCheckBDictLanguagePtr SpellCheckBDictLanguage::Clone() const { |
| return New( |
| mojo::Clone(file), |
| mojo::Clone(language) |
| ); |
| } |
| |
| template <typename T, SpellCheckBDictLanguage::EnableIfSame<T>*> |
| bool SpellCheckBDictLanguage::Equals(const T& other_struct) const { |
| if (!mojo::Equals(this->file, other_struct.file)) |
| return false; |
| if (!mojo::Equals(this->language, other_struct.language)) |
| return false; |
| return true; |
| } |
| |
| template <typename T, SpellCheckBDictLanguage::EnableIfSame<T>*> |
| bool operator<(const T& lhs, const T& rhs) { |
| if (lhs.file < rhs.file) |
| return true; |
| if (rhs.file < lhs.file) |
| return false; |
| if (lhs.language < rhs.language) |
| return true; |
| if (rhs.language < lhs.language) |
| return false; |
| return false; |
| } |
| template <typename StructPtrType> |
| SpellCheckResultPtr SpellCheckResult::Clone() const { |
| return New( |
| mojo::Clone(decoration), |
| mojo::Clone(location), |
| mojo::Clone(length), |
| mojo::Clone(replacements) |
| ); |
| } |
| |
| template <typename T, SpellCheckResult::EnableIfSame<T>*> |
| bool SpellCheckResult::Equals(const T& other_struct) const { |
| if (!mojo::Equals(this->decoration, other_struct.decoration)) |
| return false; |
| if (!mojo::Equals(this->location, other_struct.location)) |
| return false; |
| if (!mojo::Equals(this->length, other_struct.length)) |
| return false; |
| if (!mojo::Equals(this->replacements, other_struct.replacements)) |
| return false; |
| return true; |
| } |
| |
| template <typename T, SpellCheckResult::EnableIfSame<T>*> |
| bool operator<(const T& lhs, const T& rhs) { |
| if (lhs.decoration < rhs.decoration) |
| return true; |
| if (rhs.decoration < lhs.decoration) |
| return false; |
| if (lhs.location < rhs.location) |
| return true; |
| if (rhs.location < lhs.location) |
| return false; |
| if (lhs.length < rhs.length) |
| return true; |
| if (rhs.length < lhs.length) |
| return false; |
| if (lhs.replacements < rhs.replacements) |
| return true; |
| if (rhs.replacements < lhs.replacements) |
| return false; |
| return false; |
| } |
| |
| |
| } // namespace blink |
| } // namespace mojom |
| } // namespace spellcheck |
| |
| namespace mojo { |
| |
| |
| template <> |
| struct StructTraits<::spellcheck::mojom::blink::SpellCheckBDictLanguage::DataView, |
| ::spellcheck::mojom::blink::SpellCheckBDictLanguagePtr> { |
| static bool IsNull(const ::spellcheck::mojom::blink::SpellCheckBDictLanguagePtr& input) { return !input; } |
| static void SetToNull(::spellcheck::mojom::blink::SpellCheckBDictLanguagePtr* output) { output->reset(); } |
| |
| static decltype(::spellcheck::mojom::blink::SpellCheckBDictLanguage::file)& file( |
| ::spellcheck::mojom::blink::SpellCheckBDictLanguagePtr& input) { |
| return input->file; |
| } |
| |
| static const decltype(::spellcheck::mojom::blink::SpellCheckBDictLanguage::language)& language( |
| const ::spellcheck::mojom::blink::SpellCheckBDictLanguagePtr& input) { |
| return input->language; |
| } |
| |
| static bool Read(::spellcheck::mojom::blink::SpellCheckBDictLanguage::DataView input, ::spellcheck::mojom::blink::SpellCheckBDictLanguagePtr* output); |
| }; |
| |
| |
| template <> |
| struct StructTraits<::spellcheck::mojom::blink::SpellCheckResult::DataView, |
| ::spellcheck::mojom::blink::SpellCheckResultPtr> { |
| static bool IsNull(const ::spellcheck::mojom::blink::SpellCheckResultPtr& input) { return !input; } |
| static void SetToNull(::spellcheck::mojom::blink::SpellCheckResultPtr* output) { output->reset(); } |
| |
| static decltype(::spellcheck::mojom::blink::SpellCheckResult::decoration) decoration( |
| const ::spellcheck::mojom::blink::SpellCheckResultPtr& input) { |
| return input->decoration; |
| } |
| |
| static decltype(::spellcheck::mojom::blink::SpellCheckResult::location) location( |
| const ::spellcheck::mojom::blink::SpellCheckResultPtr& input) { |
| return input->location; |
| } |
| |
| static decltype(::spellcheck::mojom::blink::SpellCheckResult::length) length( |
| const ::spellcheck::mojom::blink::SpellCheckResultPtr& input) { |
| return input->length; |
| } |
| |
| static const decltype(::spellcheck::mojom::blink::SpellCheckResult::replacements)& replacements( |
| const ::spellcheck::mojom::blink::SpellCheckResultPtr& input) { |
| return input->replacements; |
| } |
| |
| static bool Read(::spellcheck::mojom::blink::SpellCheckResult::DataView input, ::spellcheck::mojom::blink::SpellCheckResultPtr* output); |
| }; |
| |
| } // namespace mojo |
| |
| #endif // COMPONENTS_SPELLCHECK_COMMON_SPELLCHECK_MOJOM_BLINK_H_
|
| /* Metadata comment
|
| eyJtZXRhIjogW3siZW5kIjogMzcyMywgImJlZ2luIjogMzcxMSwgImVkZ2UiOiAiJS9reXRoZS9l
|
| ZGdlL2dlbmVyYXRlcyIsICJ0eXBlIjogImFuY2hvcl9kZWZpbmVzIiwgInZuYW1lIjogeyJjb3Jw
|
| dXMiOiAiY2hyb21pdW0uZ29vZ2xlc291cmNlLmNvbS9jaHJvbWl1bS9zcmMiLCAibGFuZ3VhZ2Ui
|
| OiAibW9qb20iLCAic2lnbmF0dXJlIjogInNwZWxsY2hlY2subW9qb20uU3BlbGxDaGVja2VyIn19
|
| LCB7ImVuZCI6IDQ0NjYsICJiZWdpbiI6IDQ0NTYsICJlZGdlIjogIiUva3l0aGUvZWRnZS9nZW5l
|
| cmF0ZXMiLCAidHlwZSI6ICJhbmNob3JfZGVmaW5lcyIsICJ2bmFtZSI6IHsiY29ycHVzIj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