mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Further improvements to spell checking support (issue #137).
- Add "Add to dictionary" context menu option. - Use available translations for "Add to dictionary" and "No spelling suggestions". - Fix placement of context menu separators. - Display the "No spelling suggestions" option as grayed out. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1879 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@ -36,6 +36,8 @@
|
||||
#include "base/bind_helpers.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "chrome/browser/spellchecker/spellcheck_factory.h"
|
||||
#include "chrome/browser/spellchecker/spellcheck_service.h"
|
||||
#include "components/pdf/common/pdf_messages.h"
|
||||
#include "content/browser/gpu/compositor_util.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
||||
@ -61,6 +63,10 @@
|
||||
#include "ui/gfx/font_render_params.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#include "chrome/browser/spellchecker/spellcheck_platform_mac.h"
|
||||
#endif
|
||||
|
||||
#if defined(USE_AURA)
|
||||
#include "ui/views/widget/widget.h"
|
||||
#endif
|
||||
@ -876,6 +882,29 @@ void CefBrowserHostImpl::ReplaceMisspelling(const CefString& word) {
|
||||
web_contents()->ReplaceMisspelling(word);
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::AddWordToDictionary(const CefString& word) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::AddWordToDictionary, this, word));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!web_contents())
|
||||
return;
|
||||
|
||||
content::BrowserContext* browser_context =
|
||||
web_contents()->GetBrowserContext();
|
||||
if (browser_context) {
|
||||
SpellcheckService* spellcheck =
|
||||
SpellcheckServiceFactory::GetForContext(browser_context);
|
||||
if (spellcheck)
|
||||
spellcheck->GetCustomDictionary()->AddWord(word);
|
||||
}
|
||||
#if defined(OS_MACOSX)
|
||||
spellcheck_mac::AddWord(word);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::WasResized() {
|
||||
if (!IsWindowless()) {
|
||||
NOTREACHED() << "Window rendering is not disabled";
|
||||
|
Reference in New Issue
Block a user