blob: 2420e9a721b9c81ace0867417c0801f675fee9cf [file]
// Copyright 2016 The Chromium Authors
// 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_FEATURES_H_
#define COMPONENTS_SPELLCHECK_COMMON_SPELLCHECK_FEATURES_H_
#include "base/feature_list.h"
#include "build/build_config.h"
#include "components/spellcheck/spellcheck_buildflags.h"
namespace spellcheck {
#if BUILDFLAG(ENABLE_SPELLCHECK)
bool UseBrowserSpellChecker();
#if BUILDFLAG(IS_WIN)
// Makes UseBrowserSpellChecker() return false in a scope.
//
// The non-browser spell checker (Hunspell) is used when the user hasn't
// installed the required Language Packs in the Windows settings. Disabling the
// browser spell checker allows testing it.
class ScopedDisableBrowserSpellCheckerForTesting {
public:
ScopedDisableBrowserSpellCheckerForTesting();
~ScopedDisableBrowserSpellCheckerForTesting();
private:
const bool previous_value_;
};
#endif // BUILDFLAG(IS_WIN)
#if BUILDFLAG(IS_ANDROID)
bool IsAndroidSpellCheckFeatureEnabled();
BASE_DECLARE_FEATURE(kAndroidGrammarCheck);
#endif // BUILDFLAG(IS_ANDROID)
// When enabled, the spellcheck service will use a regionalized endpoint based
// on the user's data region setting.
BASE_DECLARE_FEATURE(kEnableSpellcheckRegionalSignal);
// When enabled, spellcheck character attributes and break iterator rule sets
// are initialized lazily on first spellcheck use rather than at renderer
// launch.
BASE_DECLARE_FEATURE(kLazyInitializeSpellcheckCharAttribute);
// When enabled, the renderer custom dictionary is built asynchronously on
// a background worker thread rather than blocking the main thread.
BASE_DECLARE_FEATURE(kAsyncSpellcheckCustomDictionaryInit);
// When enabled, spellcheck initialization is completely pull-based (on-demand)
// across all platforms: the browser process does not push dictionaries to new
// renderer processes at startup, and renderers request them lazily when needed.
BASE_DECLARE_FEATURE(kOnDemandSpellcheckInitialization);
#endif // BUILDFLAG(ENABLE_SPELLCHECK)
} // namespace spellcheck
#endif // COMPONENTS_SPELLCHECK_COMMON_SPELLCHECK_FEATURES_H_