platform_spelling_engine.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_SPELLCHECK_RENDERER_PLATFORM_SPELLING_ENGINE_H_
  5. #define COMPONENTS_SPELLCHECK_RENDERER_PLATFORM_SPELLING_ENGINE_H_
  6. #include "base/compiler_specific.h"
  7. #include "components/spellcheck/common/spellcheck.mojom.h"
  8. #include "components/spellcheck/renderer/spelling_engine.h"
  9. #include "mojo/public/cpp/bindings/remote.h"
  10. class PlatformSpellingEngine : public SpellingEngine {
  11. public:
  12. explicit PlatformSpellingEngine(
  13. service_manager::LocalInterfaceProvider* embedder_provider);
  14. ~PlatformSpellingEngine() override;
  15. void Init(base::File bdict_file) override;
  16. bool InitializeIfNeeded() override;
  17. bool IsEnabled() override;
  18. bool CheckSpelling(const std::u16string& word_to_check, int tag) override;
  19. void FillSuggestionList(
  20. const std::u16string& wrong_word,
  21. std::vector<std::u16string>* optional_suggestions) override;
  22. private:
  23. spellcheck::mojom::SpellCheckHost& GetOrBindSpellCheckHost();
  24. // Not owned. |embedder_provider_| outlives PlatformSpellingEngine.
  25. service_manager::LocalInterfaceProvider* embedder_provider_;
  26. mojo::Remote<spellcheck::mojom::SpellCheckHost> spell_check_host_;
  27. };
  28. #endif // COMPONENTS_SPELLCHECK_RENDERER_PLATFORM_SPELLING_ENGINE_H_