| Index: chrome/browser/spellchecker/spellcheck_host_impl.h
|
| diff --git a/chrome/browser/spellchecker/spellcheck_host_impl.h b/chrome/browser/spellchecker/spellcheck_host_impl.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..fc3e3056639b3120852f2cddb136016e37394fb4
|
| --- /dev/null
|
| +++ b/chrome/browser/spellchecker/spellcheck_host_impl.h
|
| @@ -0,0 +1,77 @@
|
| +// 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 CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_IMPL_H_
|
| +#define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_IMPL_H_
|
| +
|
| +#include <memory>
|
| +#include <vector>
|
| +
|
| +#include "base/macros.h"
|
| +#include "components/spellcheck/common/spellcheck.mojom.h"
|
| +#include "components/spellcheck/spellcheck_build_features.h"
|
| +
|
| +#if !BUILDFLAG(ENABLE_SPELLCHECK)
|
| +#error "Spellcheck should be enabled."
|
| +#endif
|
| +
|
| +class SpellcheckCustomDictionary;
|
| +class SpellcheckService;
|
| +class SpellingServiceClient;
|
| +
|
| +struct SpellCheckResult;
|
| +
|
| +namespace service_manager {
|
| +struct BindSourceInfo;
|
| +}
|
| +
|
| +class SpellCheckHostImpl : public spellcheck::mojom::SpellCheckHost {
|
| + public:
|
| + explicit SpellCheckHostImpl(int render_process_id);
|
| + ~SpellCheckHostImpl() override;
|
| +
|
| + static void Create(int render_process_id,
|
| + const service_manager::BindSourceInfo& source_info,
|
| + spellcheck::mojom::SpellCheckHostRequest request);
|
| +
|
| + private:
|
| + friend class TestSpellCheckHostImpl;
|
| +
|
| + // spellcheck::mojom::SpellCheckHost:
|
| + void RequestDictionary() override;
|
| + void NotifyChecked(const base::string16& word, bool misspelled) override;
|
| + void CallSpellingService(
|
| + const base::string16& text,
|
| + const CallSpellingServiceCallback& callback) override;
|
| +
|
| +#if !BUILDFLAG(USE_BROWSER_SPELLCHECKER)
|
| + // Invoked when the remote Spelling service has finished checking the
|
| + // text of a CallSpellingService request.
|
| + void CallSpellingServiceDone(
|
| + const CallSpellingServiceCallback& callback,
|
| + bool success,
|
| + const base::string16& text,
|
| + const std::vector<SpellCheckResult>& service_results);
|
| +
|
| + // Filter out spelling corrections of custom dictionary words from the
|
| + // Spelling service results.
|
| + static std::vector<SpellCheckResult> FilterCustomWordResults(
|
| + const std::string& text,
|
| + const SpellcheckCustomDictionary& custom_dictionary,
|
| + const std::vector<SpellCheckResult>& service_results);
|
| +#endif
|
| +
|
| + // Returns the SpellcheckService of our |render_process_id_|.
|
| + virtual SpellcheckService* GetSpellcheckService() const;
|
| +
|
| + // The process ID of our render process host.
|
| + int render_process_id_;
|
| +
|
| + // A JSON-RPC client that calls the remote Spelling service.
|
| + std::unique_ptr<SpellingServiceClient> client_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(SpellCheckHostImpl);
|
| +};
|
| +
|
| +#endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_IMPL_H_
|
|
|