blob: 0f17118a967852309b42c74d5c41516df3288d73 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
// 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.
#include "components/spellcheck/common/spellcheck_features.h"
#include "base/system/sys_info.h"
#include "build/build_config.h"
#include "components/spellcheck/spellcheck_buildflags.h"
#if BUILDFLAG(IS_WIN)
#include "base/win/windows_version.h"
#endif
namespace spellcheck {
#if BUILDFLAG(ENABLE_SPELLCHECK)
bool UseBrowserSpellChecker() {
#if !BUILDFLAG(USE_BROWSER_SPELLCHECKER)
return false;
#elif BUILDFLAG(IS_WIN)
return base::FeatureList::IsEnabled(spellcheck::kWinUseBrowserSpellChecker) &&
WindowsVersionSupportsSpellchecker();
#else
return true;
#endif
}
#if BUILDFLAG(IS_WIN)
BASE_FEATURE(kWinUseBrowserSpellChecker,
"WinUseBrowserSpellChecker",
base::FEATURE_ENABLED_BY_DEFAULT);
BASE_FEATURE(kWinDelaySpellcheckServiceInit,
"WinDelaySpellcheckServiceInit",
base::FEATURE_ENABLED_BY_DEFAULT);
BASE_FEATURE(kWinRetrieveSuggestionsOnlyOnDemand,
"WinRetrieveSuggestionsOnlyOnDemand",
base::FEATURE_ENABLED_BY_DEFAULT);
bool WindowsVersionSupportsSpellchecker() {
return base::win::GetVersion() > base::win::Version::WIN7 &&
base::win::GetVersion() < base::win::Version::WIN_LAST;
}
#endif // BUILDFLAG(IS_WIN)
#if BUILDFLAG(IS_ANDROID)
bool IsAndroidSpellCheckFeatureEnabled() {
return !base::SysInfo::IsLowEndDevice();
}
#endif // BUILDFLAG(IS_ANDROID)
#endif // BUILDFLAG(ENABLE_SPELLCHECK)
} // namespace spellcheck
|