Add spell checking support (issue #137).

This includes:
- Red underline of misspelled words in html text areas.
- Right-click context menu options to correct the misspelled word.
- New CefBrowser::ReplaceMisspelling method for accepting a word replacement.
- Methods added to CefContextMenuParams for retrieving spelling-related information.
- Uses the unified text checker when auto-correct is not enabled to match Google Chrome behavior.
- On Windows and Linux a hunspell dictionary file will be downloaded to the "<cache_path>/Dictionaries" directory as needed, or used from the <cache_path> directory if the file already exists there. The dictionary file will be downloaded from http://cache.pack.google.com/edgedl/chrome/dict/<LANG>-3-0.bdic where <LANG> is the language abbreviation.
- On OS X the spell checking implementation will use the system NSSpellChecker implementation.

The following command-line flags have been added:
--disable-spell-checking => Disable spell-checking support (no red underline, no dictionary file download, etc).
--enable-spelling-auto-correct => Automatically correct common misspellings while typing (like 'omre' to 'more' on Windows/Linux or 'ehlo' to 'helo' on OS X).
--enable-spelling-service => Enable use of the remote Google spelling service (this requires Google API keys).
--override-spell-check-lang=<LANG> => Use the specified dictionary language <LANG> instead of the language specified in the locales.pak file. To see the default/supported dictionary languages: https://code.google.com/p/chromium/codesearch#search/&q=IDS_SPELLCHECK_DICTIONARY%20xtb&sq=package:chromium


git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1859 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2014-10-07 20:44:33 +00:00
parent de3d28f9a1
commit 77aa0be191
36 changed files with 779 additions and 64 deletions

57
cef.gyp
View File

@ -849,10 +849,14 @@
'<(DEPTH)/cc/blink/cc_blink.gyp:cc_blink', '<(DEPTH)/cc/blink/cc_blink.gyp:cc_blink',
'<(DEPTH)/cc/cc.gyp:cc', '<(DEPTH)/cc/cc.gyp:cc',
'<(DEPTH)/components/components.gyp:crash_component', '<(DEPTH)/components/components.gyp:crash_component',
'<(DEPTH)/components/components.gyp:keyed_service_content',
'<(DEPTH)/components/components.gyp:keyed_service_core',
'<(DEPTH)/components/components.gyp:navigation_interception', '<(DEPTH)/components/components.gyp:navigation_interception',
'<(DEPTH)/components/components.gyp:pdf_browser', '<(DEPTH)/components/components.gyp:pdf_browser',
'<(DEPTH)/components/components.gyp:pdf_common', '<(DEPTH)/components/components.gyp:pdf_common',
'<(DEPTH)/components/components.gyp:pdf_renderer', '<(DEPTH)/components/components.gyp:pdf_renderer',
'<(DEPTH)/components/components.gyp:pref_registry',
'<(DEPTH)/components/components.gyp:user_prefs',
'<(DEPTH)/components/components.gyp:web_cache_renderer', '<(DEPTH)/components/components.gyp:web_cache_renderer',
'<(DEPTH)/content/content.gyp:content_app_both', '<(DEPTH)/content/content.gyp:content_app_both',
'<(DEPTH)/content/content.gyp:content_browser', '<(DEPTH)/content/content.gyp:content_browser',
@ -872,6 +876,8 @@
'<(DEPTH)/pdf/pdf.gyp:pdf', '<(DEPTH)/pdf/pdf.gyp:pdf',
'<(DEPTH)/skia/skia.gyp:skia', '<(DEPTH)/skia/skia.gyp:skia',
'<(DEPTH)/storage/storage_browser.gyp:storage', '<(DEPTH)/storage/storage_browser.gyp:storage',
'<(DEPTH)/sync/sync.gyp:sync',
'<(DEPTH)/third_party/hunspell/hunspell.gyp:hunspell',
'<(DEPTH)/third_party/libxml/libxml.gyp:libxml', '<(DEPTH)/third_party/libxml/libxml.gyp:libxml',
'<(DEPTH)/third_party/re2/re2.gyp:re2', '<(DEPTH)/third_party/re2/re2.gyp:re2',
'<(DEPTH)/third_party/WebKit/public/blink.gyp:blink', '<(DEPTH)/third_party/WebKit/public/blink.gyp:blink',
@ -1126,6 +1132,50 @@
# determine the current locale. # determine the current locale.
'<(DEPTH)/chrome/browser/browser_process.cc', '<(DEPTH)/chrome/browser/browser_process.cc',
'<(DEPTH)/chrome/browser/browser_process.h', '<(DEPTH)/chrome/browser/browser_process.h',
# Include sources for spell checking support.
'<(DEPTH)/chrome/browser/spellchecker/feedback.cc',
'<(DEPTH)/chrome/browser/spellchecker/feedback.h',
'<(DEPTH)/chrome/browser/spellchecker/feedback_sender.cc',
'<(DEPTH)/chrome/browser/spellchecker/feedback_sender.h',
'<(DEPTH)/chrome/browser/spellchecker/misspelling.cc',
'<(DEPTH)/chrome/browser/spellchecker/misspelling.h',
'<(DEPTH)/chrome/browser/spellchecker/spellcheck_action.cc',
'<(DEPTH)/chrome/browser/spellchecker/spellcheck_action.h',
'<(DEPTH)/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc',
'<(DEPTH)/chrome/browser/spellchecker/spellcheck_custom_dictionary.h',
'<(DEPTH)/chrome/browser/spellchecker/spellcheck_factory.cc',
'<(DEPTH)/chrome/browser/spellchecker/spellcheck_factory.h',
'<(DEPTH)/chrome/browser/spellchecker/spellcheck_host_metrics.cc',
'<(DEPTH)/chrome/browser/spellchecker/spellcheck_host_metrics.h',
'<(DEPTH)/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc',
'<(DEPTH)/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h',
'<(DEPTH)/chrome/browser/spellchecker/spellcheck_message_filter.cc',
'<(DEPTH)/chrome/browser/spellchecker/spellcheck_message_filter.h',
'<(DEPTH)/chrome/browser/spellchecker/spellcheck_service.cc',
'<(DEPTH)/chrome/browser/spellchecker/spellcheck_service.h',
'<(DEPTH)/chrome/browser/spellchecker/spelling_service_client.cc',
'<(DEPTH)/chrome/browser/spellchecker/spelling_service_client.h',
'<(DEPTH)/chrome/browser/spellchecker/word_trimmer.cc',
'<(DEPTH)/chrome/browser/spellchecker/word_trimmer.h',
'<(DEPTH)/chrome/common/chrome_constants.cc',
'<(DEPTH)/chrome/common/spellcheck_common.cc',
'<(DEPTH)/chrome/common/spellcheck_common.h',
'<(DEPTH)/chrome/common/spellcheck_marker.h',
'<(DEPTH)/chrome/common/spellcheck_messages.h',
'<(DEPTH)/chrome/common/spellcheck_result.h',
'<(DEPTH)/chrome/renderer/spellchecker/custom_dictionary_engine.cc',
'<(DEPTH)/chrome/renderer/spellchecker/custom_dictionary_engine.h',
'<(DEPTH)/chrome/renderer/spellchecker/hunspell_engine.cc',
'<(DEPTH)/chrome/renderer/spellchecker/hunspell_engine.h',
'<(DEPTH)/chrome/renderer/spellchecker/spellcheck.cc',
'<(DEPTH)/chrome/renderer/spellchecker/spellcheck.h',
'<(DEPTH)/chrome/renderer/spellchecker/spellcheck_language.cc',
'<(DEPTH)/chrome/renderer/spellchecker/spellcheck_language.h',
'<(DEPTH)/chrome/renderer/spellchecker/spellcheck_provider.cc',
'<(DEPTH)/chrome/renderer/spellchecker/spellcheck_provider.h',
'<(DEPTH)/chrome/renderer/spellchecker/spellcheck_worditerator.cc',
'<(DEPTH)/chrome/renderer/spellchecker/spellcheck_worditerator.h',
'<(DEPTH)/chrome/renderer/spellchecker/spelling_engine.h',
], ],
'conditions': [ 'conditions': [
['OS=="win"', { ['OS=="win"', {
@ -1162,6 +1212,13 @@
# Include sources for CoreAnimation support. # Include sources for CoreAnimation support.
'<(DEPTH)/chrome/browser/ui/cocoa/nsview_additions.h', '<(DEPTH)/chrome/browser/ui/cocoa/nsview_additions.h',
'<(DEPTH)/chrome/browser/ui/cocoa/nsview_additions.mm', '<(DEPTH)/chrome/browser/ui/cocoa/nsview_additions.mm',
# Include sources for spell checking support.
'<(DEPTH)/chrome/browser/spellchecker/spellcheck_message_filter_mac.cc',
'<(DEPTH)/chrome/browser/spellchecker/spellcheck_message_filter_mac.h',
'<(DEPTH)/chrome/browser/spellchecker/spellcheck_platform_mac.h',
'<(DEPTH)/chrome/browser/spellchecker/spellcheck_platform_mac.mm',
'<(DEPTH)/chrome/renderer/spellchecker/cocoa_spelling_engine_mac.cc',
'<(DEPTH)/chrome/renderer/spellchecker/cocoa_spelling_engine_mac.h',
], ],
}], }],
[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', { [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {

View File

@ -358,6 +358,13 @@ typedef struct _cef_browser_host_t {
int (CEF_CALLBACK *is_mouse_cursor_change_disabled)( int (CEF_CALLBACK *is_mouse_cursor_change_disabled)(
struct _cef_browser_host_t* self); struct _cef_browser_host_t* self);
///
// If a misspelled word is currently selected in an editable node calling this
// function will replace it with the specified |word|.
///
void (CEF_CALLBACK *replace_misspelling)(struct _cef_browser_host_t* self,
const cef_string_t* word);
/// ///
// Returns true (1) if window rendering is disabled. // Returns true (1) if window rendering is disabled.
/// ///

View File

@ -198,11 +198,41 @@ typedef struct _cef_context_menu_params_t {
cef_string_userfree_t (CEF_CALLBACK *get_selection_text)( cef_string_userfree_t (CEF_CALLBACK *get_selection_text)(
struct _cef_context_menu_params_t* self); struct _cef_context_menu_params_t* self);
///
// Returns the text of the misspelled word, if any, that the context menu was
// invoked on.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_misspelled_word)(
struct _cef_context_menu_params_t* self);
///
// Returns the hash of the misspelled word, if any, that the context menu was
// invoked on.
///
int (CEF_CALLBACK *get_misspelling_hash)(
struct _cef_context_menu_params_t* self);
///
// Returns true (1) if suggestions exist, false (0) otherwise. Fills in
// |suggestions| from the spell check service for the misspelled word if there
// is one.
///
int (CEF_CALLBACK *get_dictionary_suggestions)(
struct _cef_context_menu_params_t* self, cef_string_list_t suggestions);
/// ///
// Returns true (1) if the context menu was invoked on an editable node. // Returns true (1) if the context menu was invoked on an editable node.
/// ///
int (CEF_CALLBACK *is_editable)(struct _cef_context_menu_params_t* self); int (CEF_CALLBACK *is_editable)(struct _cef_context_menu_params_t* self);
///
// Returns true (1) if the context menu was invoked on an editable node where
// spell-check is enabled.
///
int (CEF_CALLBACK *is_spell_check_enabled)(
struct _cef_context_menu_params_t* self);
/// ///
// Returns flags representing the actions supported by the editable node, if // Returns flags representing the actions supported by the editable node, if
// any, that the context menu was invoked on. // any, that the context menu was invoked on.

View File

@ -404,6 +404,13 @@ class CefBrowserHost : public virtual CefBase {
/*--cef()--*/ /*--cef()--*/
virtual bool IsMouseCursorChangeDisabled() =0; virtual bool IsMouseCursorChangeDisabled() =0;
///
// If a misspelled word is currently selected in an editable node calling
// this method will replace it with the specified |word|.
///
/*--cef()--*/
virtual void ReplaceMisspelling(const CefString& word) =0;
/// ///
// Returns true if window rendering is disabled. // Returns true if window rendering is disabled.
/// ///

View File

@ -193,12 +193,40 @@ class CefContextMenuParams : public virtual CefBase {
/*--cef()--*/ /*--cef()--*/
virtual CefString GetSelectionText() =0; virtual CefString GetSelectionText() =0;
///
// Returns the text of the misspelled word, if any, that the context menu was
// invoked on.
///
/*--cef()--*/
virtual CefString GetMisspelledWord() =0;
///
// Returns the hash of the misspelled word, if any, that the context menu was
// invoked on.
///
/*--cef()--*/
virtual int GetMisspellingHash() =0;
///
// Returns true if suggestions exist, false otherwise. Fills in |suggestions|
// from the spell check service for the misspelled word if there is one.
///
/*--cef()--*/
virtual bool GetDictionarySuggestions(std::vector<CefString>& suggestions) =0;
/// ///
// Returns true if the context menu was invoked on an editable node. // Returns true if the context menu was invoked on an editable node.
/// ///
/*--cef()--*/ /*--cef()--*/
virtual bool IsEditable() =0; virtual bool IsEditable() =0;
///
// Returns true if the context menu was invoked on an editable node where
// spell-check is enabled.
///
/*--cef()--*/
virtual bool IsSpellCheckEnabled() =0;
/// ///
// Returns flags representing the actions supported by the editable node, if // Returns flags representing the actions supported by the editable node, if
// any, that the context menu was invoked on. // any, that the context menu was invoked on.

View File

@ -1292,6 +1292,15 @@ typedef enum {
MENU_ID_PRINT = 131, MENU_ID_PRINT = 131,
MENU_ID_VIEW_SOURCE = 132, MENU_ID_VIEW_SOURCE = 132,
// Spell checking word correction suggestions.
MENU_ID_SPELLCHECK_SUGGESTION_0 = 200,
MENU_ID_SPELLCHECK_SUGGESTION_1 = 201,
MENU_ID_SPELLCHECK_SUGGESTION_2 = 202,
MENU_ID_SPELLCHECK_SUGGESTION_3 = 203,
MENU_ID_SPELLCHECK_SUGGESTION_4 = 204,
MENU_ID_SPELLCHECK_SUGGESTION_LAST = 204,
MENU_ID_NO_SPELLING_SUGGESTIONS = 205,
// All user-defined menu IDs should come between MENU_ID_USER_FIRST and // All user-defined menu IDs should come between MENU_ID_USER_FIRST and
// MENU_ID_USER_LAST to avoid overlapping the Chromium and CEF ID ranges // MENU_ID_USER_LAST to avoid overlapping the Chromium and CEF ID ranges
// defined in the tools/gritsettings/resource_ids file. // defined in the tools/gritsettings/resource_ids file.

View File

@ -15,6 +15,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/threading/thread.h" #include "base/threading/thread.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "content/public/browser/download_manager.h" #include "content/public/browser/download_manager.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/resource_context.h" #include "content/public/browser/resource_context.h"
@ -61,6 +62,10 @@ CefBrowserContextImpl::~CefBrowserContextImpl() {
BrowserThread::DeleteSoon( BrowserThread::DeleteSoon(
BrowserThread::IO, FROM_HERE, resource_context_.release()); BrowserThread::IO, FROM_HERE, resource_context_.release());
} }
// Remove any BrowserContextKeyedServiceFactory associations.
BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices(
this);
} }
base::FilePath CefBrowserContextImpl::GetPath() const { base::FilePath CefBrowserContextImpl::GetPath() const {

View File

@ -13,6 +13,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/threading/thread.h" #include "base/threading/thread.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/resource_context.h" #include "content/public/browser/resource_context.h"
#include "content/public/browser/storage_partition.h" #include "content/public/browser/storage_partition.h"
@ -59,6 +60,10 @@ CefBrowserContextProxy::~CefBrowserContextProxy() {
BrowserThread::DeleteSoon( BrowserThread::DeleteSoon(
BrowserThread::IO, FROM_HERE, resource_context_.release()); BrowserThread::IO, FROM_HERE, resource_context_.release());
} }
// Remove any BrowserContextKeyedServiceFactory associations.
BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices(
this);
} }
base::FilePath CefBrowserContextProxy::GetPath() const { base::FilePath CefBrowserContextProxy::GetPath() const {

View File

@ -860,6 +860,17 @@ bool CefBrowserHostImpl::IsWindowRenderingDisabled() {
return IsWindowless(); return IsWindowless();
} }
void CefBrowserHostImpl::ReplaceMisspelling(const CefString& word) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::ReplaceMisspelling, this, word));
return;
}
if(web_contents())
web_contents()->ReplaceMisspelling(word);
}
void CefBrowserHostImpl::WasResized() { void CefBrowserHostImpl::WasResized() {
if (!IsWindowless()) { if (!IsWindowless()) {
NOTREACHED() << "Window rendering is not disabled"; NOTREACHED() << "Window rendering is not disabled";

View File

@ -158,6 +158,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
virtual void SetMouseCursorChangeDisabled(bool disabled) OVERRIDE; virtual void SetMouseCursorChangeDisabled(bool disabled) OVERRIDE;
virtual bool IsMouseCursorChangeDisabled() OVERRIDE; virtual bool IsMouseCursorChangeDisabled() OVERRIDE;
virtual bool IsWindowRenderingDisabled() OVERRIDE; virtual bool IsWindowRenderingDisabled() OVERRIDE;
virtual void ReplaceMisspelling(const CefString& word) OVERRIDE;
virtual void WasResized() OVERRIDE; virtual void WasResized() OVERRIDE;
virtual void WasHidden(bool hidden) OVERRIDE; virtual void WasHidden(bool hidden) OVERRIDE;
virtual void NotifyScreenInfoChanged() OVERRIDE; virtual void NotifyScreenInfoChanged() OVERRIDE;

View File

@ -17,6 +17,7 @@
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "chrome/browser/net/proxy_service_factory.h" #include "chrome/browser/net/proxy_service_factory.h"
#include "components/user_prefs/user_prefs.h"
#include "content/browser/webui/content_web_ui_controller_factory.h" #include "content/browser/webui/content_web_ui_controller_factory.h"
#include "content/public/browser/gpu_data_manager.h" #include "content/public/browser/gpu_data_manager.h"
#include "content/public/browser/web_ui_controller_factory.h" #include "content/public/browser/web_ui_controller_factory.h"
@ -149,6 +150,8 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
LOG(WARNING) << "Invalid http debugger port number " << port; LOG(WARNING) << "Invalid http debugger port number " << port;
} }
} }
user_prefs::UserPrefs::Set(browser_context(), pref_service());
} }
void CefBrowserMainParts::PostMainMessageLoopRun() { void CefBrowserMainParts::PostMainMessageLoopRun() {

View File

@ -3,25 +3,83 @@
// be found in the LICENSE file. // be found in the LICENSE file.
#include "libcef/browser/browser_pref_store.h" #include "libcef/browser/browser_pref_store.h"
#include "libcef/browser/media_capture_devices_dispatcher.h" #include "libcef/browser/media_capture_devices_dispatcher.h"
#include "libcef/common/cef_switches.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/prefs/pref_service.h" #include "base/prefs/pref_service.h"
#include "base/prefs/pref_service_factory.h" #include "base/prefs/pref_service_factory.h"
#include "base/prefs/pref_registry_simple.h" #include "base/prefs/pref_registry_simple.h"
#include "base/strings/string_number_conversions.h"
#include "base/values.h" #include "base/values.h"
#include "chrome/browser/net/pref_proxy_config_tracker_impl.h" #include "chrome/browser/net/pref_proxy_config_tracker_impl.h"
#include "chrome/browser/prefs/command_line_pref_store.h" #include "chrome/browser/prefs/command_line_pref_store.h"
#include "chrome/browser/prefs/proxy_config_dictionary.h" #include "chrome/browser/prefs/proxy_config_dictionary.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "grit/cef_strings.h"
#include "ui/base/l10n/l10n_util.h"
namespace {
// A helper function for registering localized values.
// Based on CreateLocaleDefaultValue from
// components/pref_registry/pref_registry_syncable.cc.
void RegisterLocalizedValue(PrefRegistrySimple* registry,
const char* path,
base::Value::Type type,
int message_id) {
const std::string resource_string = l10n_util::GetStringUTF8(message_id);
DCHECK(!resource_string.empty());
switch (type) {
case base::Value::TYPE_BOOLEAN: {
if ("true" == resource_string)
registry->RegisterBooleanPref(path, true);
else if ("false" == resource_string)
registry->RegisterBooleanPref(path, false);
return;
}
case base::Value::TYPE_INTEGER: {
int val;
base::StringToInt(resource_string, &val);
registry->RegisterIntegerPref(path, val);
return;
}
case base::Value::TYPE_DOUBLE: {
double val;
base::StringToDouble(resource_string, &val);
registry->RegisterDoublePref(path, val);
return;
}
case base::Value::TYPE_STRING: {
registry->RegisterStringPref(path, resource_string);
return;
}
default: {
NOTREACHED() <<
"list and dictionary types cannot have default locale values";
}
}
NOTREACHED();
}
} // namespace
CefBrowserPrefStore::CefBrowserPrefStore() { CefBrowserPrefStore::CefBrowserPrefStore() {
} }
scoped_ptr<PrefService> CefBrowserPrefStore::CreateService() { scoped_ptr<PrefService> CefBrowserPrefStore::CreateService() {
const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
base::PrefServiceFactory factory; base::PrefServiceFactory factory;
factory.set_command_line_prefs( factory.set_command_line_prefs(
new CommandLinePrefStore(CommandLine::ForCurrentProcess())); new CommandLinePrefStore(command_line));
factory.set_user_prefs(this); factory.set_user_prefs(this);
scoped_refptr<PrefRegistrySimple> registry(new PrefRegistrySimple()); scoped_refptr<PrefRegistrySimple> registry(new PrefRegistrySimple());
@ -30,8 +88,28 @@ scoped_ptr<PrefService> CefBrowserPrefStore::CreateService() {
CefMediaCaptureDevicesDispatcher::RegisterPrefs(registry.get()); CefMediaCaptureDevicesDispatcher::RegisterPrefs(registry.get());
PrefProxyConfigTrackerImpl::RegisterPrefs(registry.get()); PrefProxyConfigTrackerImpl::RegisterPrefs(registry.get());
// Print settings.
registry->RegisterBooleanPref(prefs::kPrintingEnabled, true); registry->RegisterBooleanPref(prefs::kPrintingEnabled, true);
// Spell checking settings.
std::string spellcheck_lang =
command_line->GetSwitchValueASCII(switches::kOverrideSpellCheckLang);
if (!spellcheck_lang.empty()) {
registry->RegisterStringPref(prefs::kSpellCheckDictionary, spellcheck_lang);
} else {
RegisterLocalizedValue(registry.get(),
prefs::kSpellCheckDictionary,
base::Value::TYPE_STRING,
IDS_SPELLCHECK_DICTIONARY);
}
registry->RegisterBooleanPref(prefs::kSpellCheckUseSpellingService,
command_line->HasSwitch(switches::kEnableSpellingService));
registry->RegisterBooleanPref(prefs::kEnableContinuousSpellcheck, true);
// The kEnableSpellingAutoCorrect command-line value is also checked in
// SpellCheckProvider::autoCorrectWord.
registry->RegisterBooleanPref(prefs::kEnableAutoSpellCorrect,
command_line->HasSwitch(switches::kEnableSpellingAutoCorrect));
return factory.Create(registry.get()); return factory.Create(registry.get());
} }

View File

@ -31,6 +31,7 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/path_service.h" #include "base/path_service.h"
#include "chrome/browser/spellchecker/spellcheck_message_filter.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "content/browser/plugin_service_impl.h" #include "content/browser/plugin_service_impl.h"
#include "content/public/browser/access_token_store.h" #include "content/public/browser/access_token_store.h"
@ -47,6 +48,10 @@
#include "ui/base/ui_base_switches.h" #include "ui/base/ui_base_switches.h"
#include "url/gurl.h" #include "url/gurl.h"
#if defined(OS_MACOSX)
#include "chrome/browser/spellchecker/spellcheck_message_filter_mac.h"
#endif
#if defined(OS_POSIX) && !defined(OS_MACOSX) #if defined(OS_POSIX) && !defined(OS_MACOSX)
#include "base/debug/leak_annotations.h" #include "base/debug/leak_annotations.h"
#include "components/crash/app/breakpad_linux.h" #include "components/crash/app/breakpad_linux.h"
@ -357,7 +362,7 @@ void TranslatePopupFeatures(const blink::WebWindowFeatures& webKitFeatures,
breakpad::CrashHandlerHostLinux* CreateCrashHandlerHost( breakpad::CrashHandlerHostLinux* CreateCrashHandlerHost(
const std::string& process_type) { const std::string& process_type) {
base::FilePath dumps_path = base::FilePath dumps_path =
CommandLine::ForCurrentProcess()->GetSwitchValuePath( base::CommandLine::ForCurrentProcess()->GetSwitchValuePath(
switches::kCrashDumpsDir); switches::kCrashDumpsDir);
{ {
ANNOTATE_SCOPED_MEMORY_LEAK; ANNOTATE_SCOPED_MEMORY_LEAK;
@ -369,7 +374,7 @@ breakpad::CrashHandlerHostLinux* CreateCrashHandlerHost(
} }
} }
int GetCrashSignalFD(const CommandLine& command_line) { int GetCrashSignalFD(const base::CommandLine& command_line) {
if (!breakpad::IsCrashReporterEnabled()) if (!breakpad::IsCrashReporterEnabled())
return -1; return -1;
@ -606,8 +611,19 @@ content::BrowserMainParts* CefContentBrowserClient::CreateBrowserMainParts(
void CefContentBrowserClient::RenderProcessWillLaunch( void CefContentBrowserClient::RenderProcessWillLaunch(
content::RenderProcessHost* host) { content::RenderProcessHost* host) {
const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
const int id = host->GetID();
host->GetChannel()->AddFilter(new CefBrowserMessageFilter(host)); host->GetChannel()->AddFilter(new CefBrowserMessageFilter(host));
host->AddFilter(new printing::PrintingMessageFilter(host->GetID())); host->AddFilter(new printing::PrintingMessageFilter(id));
if (!command_line->HasSwitch(switches::kDisableSpellChecking)) {
host->AddFilter(new SpellCheckMessageFilter(id));
#if defined(OS_MACOSX)
host->AddFilter(new SpellCheckMessageFilterMac(id));
#endif
}
AddBrowserContextReference( AddBrowserContextReference(
static_cast<CefBrowserContext*>(host->GetBrowserContext())); static_cast<CefBrowserContext*>(host->GetBrowserContext()));
@ -653,8 +669,9 @@ bool CefContentBrowserClient::IsHandledURL(const GURL& url) {
} }
void CefContentBrowserClient::AppendExtraCommandLineSwitches( void CefContentBrowserClient::AppendExtraCommandLineSwitches(
CommandLine* command_line, int child_process_id) { base::CommandLine* command_line, int child_process_id) {
const CommandLine& browser_cmd = *CommandLine::ForCurrentProcess(); const base::CommandLine& browser_cmd =
*base::CommandLine::ForCurrentProcess();
{ {
// Propagate the following switches to all command lines (along with any // Propagate the following switches to all command lines (along with any
@ -683,8 +700,10 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
// any associated values) if present in the browser command line. // any associated values) if present in the browser command line.
static const char* const kSwitchNames[] = { static const char* const kSwitchNames[] = {
switches::kContextSafetyImplementation, switches::kContextSafetyImplementation,
switches::kDisableSpellChecking,
switches::kEnableMediaStream, switches::kEnableMediaStream,
switches::kEnableSpeechInput, switches::kEnableSpeechInput,
switches::kEnableSpellingAutoCorrect,
switches::kUncaughtExceptionStackSize, switches::kUncaughtExceptionStackSize,
}; };
command_line->CopySwitchesFrom(browser_cmd, kSwitchNames, command_line->CopySwitchesFrom(browser_cmd, kSwitchNames,
@ -726,8 +745,9 @@ content::MediaObserver* CefContentBrowserClient::GetMediaObserver() {
content::SpeechRecognitionManagerDelegate* content::SpeechRecognitionManagerDelegate*
CefContentBrowserClient::GetSpeechRecognitionManagerDelegate() { CefContentBrowserClient::GetSpeechRecognitionManagerDelegate() {
const CommandLine& command_line = *CommandLine::ForCurrentProcess(); const base::CommandLine* command_line =
if (command_line.HasSwitch(switches::kEnableSpeechInput)) base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kEnableSpeechInput))
return new CefSpeechRecognitionManagerDelegate(); return new CefSpeechRecognitionManagerDelegate();
return NULL; return NULL;
@ -933,6 +953,9 @@ void CefContentBrowserClient::OverrideWebkitPrefs(
content::RenderViewHost* rvh, content::RenderViewHost* rvh,
const GURL& url, const GURL& url,
content::WebPreferences* prefs) { content::WebPreferences* prefs) {
const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
CefRefPtr<CefBrowserHostImpl> browser = CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::GetBrowserForHost(rvh); CefBrowserHostImpl::GetBrowserForHost(rvh);
DCHECK(browser.get()); DCHECK(browser.get());
@ -941,6 +964,11 @@ void CefContentBrowserClient::OverrideWebkitPrefs(
BrowserToWebSettings(browser->settings(), *prefs); BrowserToWebSettings(browser->settings(), *prefs);
prefs->base_background_color = GetBaseBackgroundColor(rvh); prefs->base_background_color = GetBaseBackgroundColor(rvh);
prefs->asynchronous_spell_checking_enabled = true;
// Auto-correct does not work in combination with the unified text checker.
prefs->unified_textchecker_enabled =
!command_line->HasSwitch(switches::kEnableSpellingAutoCorrect);
} }
SkColor CefContentBrowserClient::GetBaseBackgroundColor( SkColor CefContentBrowserClient::GetBaseBackgroundColor(

View File

@ -95,11 +95,44 @@ CefString CefContextMenuParamsImpl::GetSelectionText() {
return const_value().selection_text; return const_value().selection_text;
} }
CefString CefContextMenuParamsImpl::GetMisspelledWord() {
CEF_VALUE_VERIFY_RETURN(false, CefString());
return const_value().misspelled_word;
}
int CefContextMenuParamsImpl::GetMisspellingHash() {
CEF_VALUE_VERIFY_RETURN(false, 0);
return const_value().misspelling_hash;
}
bool CefContextMenuParamsImpl::GetDictionarySuggestions(
std::vector<CefString>& suggestions) {
CEF_VALUE_VERIFY_RETURN(false, false);
if (!suggestions.empty())
suggestions.clear();
if(const_value().dictionary_suggestions.empty())
return false;
std::vector<base::string16>::const_iterator it =
const_value().dictionary_suggestions.begin();
for (; it != const_value().dictionary_suggestions.end(); ++it)
suggestions.push_back(*it);
return true;
}
bool CefContextMenuParamsImpl::IsEditable() { bool CefContextMenuParamsImpl::IsEditable() {
CEF_VALUE_VERIFY_RETURN(false, false); CEF_VALUE_VERIFY_RETURN(false, false);
return const_value().is_editable; return const_value().is_editable;
} }
bool CefContextMenuParamsImpl::IsSpellCheckEnabled() {
CEF_VALUE_VERIFY_RETURN(false, false);
return const_value().spellcheck_enabled;
}
CefContextMenuParamsImpl::EditStateFlags CefContextMenuParamsImpl::EditStateFlags
CefContextMenuParamsImpl::GetEditStateFlags() { CefContextMenuParamsImpl::GetEditStateFlags() {
CEF_VALUE_VERIFY_RETURN(false, CM_EDITFLAG_NONE); CEF_VALUE_VERIFY_RETURN(false, CM_EDITFLAG_NONE);

View File

@ -31,7 +31,12 @@ class CefContextMenuParamsImpl
virtual MediaType GetMediaType() OVERRIDE; virtual MediaType GetMediaType() OVERRIDE;
virtual MediaStateFlags GetMediaStateFlags() OVERRIDE; virtual MediaStateFlags GetMediaStateFlags() OVERRIDE;
virtual CefString GetSelectionText() OVERRIDE; virtual CefString GetSelectionText() OVERRIDE;
virtual CefString GetMisspelledWord() OVERRIDE;
virtual int GetMisspellingHash() OVERRIDE;
virtual bool GetDictionarySuggestions(
std::vector<CefString>& suggestions) OVERRIDE;
virtual bool IsEditable() OVERRIDE; virtual bool IsEditable() OVERRIDE;
virtual bool IsSpellCheckEnabled() OVERRIDE;
virtual EditStateFlags GetEditStateFlags() OVERRIDE; virtual EditStateFlags GetEditStateFlags() OVERRIDE;
DISALLOW_COPY_AND_ASSIGN(CefContextMenuParamsImpl); DISALLOW_COPY_AND_ASSIGN(CefContextMenuParamsImpl);

View File

@ -231,6 +231,26 @@ void CefMenuCreator::CreateDefaultModel() {
model_->SetEnabled(MENU_ID_DELETE, false); model_->SetEnabled(MENU_ID_DELETE, false);
if (!(params_.edit_flags & CM_EDITFLAG_CAN_SELECT_ALL)) if (!(params_.edit_flags & CM_EDITFLAG_CAN_SELECT_ALL))
model_->SetEnabled(MENU_ID_SELECT_ALL, false); model_->SetEnabled(MENU_ID_SELECT_ALL, false);
if(!params_.misspelled_word.empty()) {
if (!params_.dictionary_suggestions.empty())
model_->AddSeparator();
for (size_t i = 0;
i < params_.dictionary_suggestions.size() &&
MENU_ID_SPELLCHECK_SUGGESTION_0 + i <=
MENU_ID_SPELLCHECK_SUGGESTION_LAST;
++i) {
model_->AddItem(MENU_ID_SPELLCHECK_SUGGESTION_0 + static_cast<int>(i),
params_.dictionary_suggestions[i].c_str());
}
if (params_.dictionary_suggestions.empty()) {
model_->AddItem(
MENU_ID_NO_SPELLING_SUGGESTIONS,
GetLabel(IDS_MENU_NO_SPELLING_SUGGESTIONS));
}
}
} else if (!params_.selection_text.empty()) { } else if (!params_.selection_text.empty()) {
// Something is selected. // Something is selected.
model_->AddItem(MENU_ID_COPY, GetLabel(IDS_MENU_COPY)); model_->AddItem(MENU_ID_COPY, GetLabel(IDS_MENU_COPY));
@ -251,6 +271,18 @@ void CefMenuCreator::CreateDefaultModel() {
} }
void CefMenuCreator::ExecuteDefaultCommand(int command_id) { void CefMenuCreator::ExecuteDefaultCommand(int command_id) {
// If the user chose a replacement word for a misspelling, replace it here.
if (command_id >= MENU_ID_SPELLCHECK_SUGGESTION_0 &&
command_id <= MENU_ID_SPELLCHECK_SUGGESTION_LAST) {
const size_t suggestion_index =
static_cast<size_t>(command_id) - MENU_ID_SPELLCHECK_SUGGESTION_0;
if (suggestion_index < params_.dictionary_suggestions.size()) {
browser_->ReplaceMisspelling(
params_.dictionary_suggestions[suggestion_index]);
}
return;
}
switch (command_id) { switch (command_id) {
// Navigation. // Navigation.
case MENU_ID_BACK: case MENU_ID_BACK:

View File

@ -3,16 +3,22 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "base/logging.h" #include "base/logging.h"
#include "components/pref_registry/pref_registry_syncable.h" #include "content/public/browser/browser_context.h"
namespace user_prefs { // Used by chrome/browser/spellchecker/spellcheck_factory.cc.
namespace chrome {
// Required by PrefProxyConfigTrackerImpl::RegisterUserPrefs. // Returns the original browser context even for Incognito contexts.
void PrefRegistrySyncable::RegisterDictionaryPref( content::BrowserContext* GetBrowserContextRedirectedInIncognito(
const char* path, content::BrowserContext* context) {
base::DictionaryValue* default_value, return context;
PrefSyncStatus sync_status) {
NOTREACHED();
} }
} // namespace user_prefs // Returns non-NULL even for Incognito contexts so that a separate
// instance of a service is created for the Incognito context.
content::BrowserContext* GetBrowserContextOwnInstanceInIncognito(
content::BrowserContext* context) {
return context;
}
} // namespace chrome

View File

@ -215,6 +215,7 @@ struct ParamTraits<scoped_refptr<net::UploadData> > {
#include "chrome/common/prerender_messages.h" #include "chrome/common/prerender_messages.h"
#include "chrome/common/print_messages.h" #include "chrome/common/print_messages.h"
#include "chrome/common/spellcheck_messages.h"
#if defined(OS_WIN) #if defined(OS_WIN)
#include "chrome/common/chrome_utility_printing_messages.h" #include "chrome/common/chrome_utility_printing_messages.h"

View File

@ -85,4 +85,13 @@ const char kEnableProfanityFilter[] = "enable-profanity-filter";
// The directory breakpad should store minidumps in. // The directory breakpad should store minidumps in.
const char kCrashDumpsDir[] = "crash-dumps-dir"; const char kCrashDumpsDir[] = "crash-dumps-dir";
// Disable spell checking.
const char kDisableSpellChecking[] = "disable-spell-checking";
// Enable the remote spelling service.
const char kEnableSpellingService[] = "enable-spelling-service";
// Override the default spellchecking language which comes from locales.pak.
const char kOverrideSpellCheckLang[] = "override-spell-check-lang";
} // namespace switches } // namespace switches

View File

@ -38,6 +38,9 @@ extern const char kEnableMediaStream[];
extern const char kEnableSpeechInput[]; extern const char kEnableSpeechInput[];
extern const char kEnableProfanityFilter[]; extern const char kEnableProfanityFilter[];
extern const char kCrashDumpsDir[]; extern const char kCrashDumpsDir[];
extern const char kDisableSpellChecking[];
extern const char kEnableSpellingService[];
extern const char kOverrideSpellCheckLang[];
} // namespace switches } // namespace switches

View File

@ -409,13 +409,25 @@ void CefMainDelegate::PreSandboxStartup() {
#endif #endif
} }
#if defined(OS_MACOSX)
if (!command_line.HasSwitch(switches::kProcessType)) { if (!command_line.HasSwitch(switches::kProcessType)) {
// Only override the child process path when executing the main process. // Only these paths when executing the main process.
#if defined(OS_MACOSX)
OverrideChildProcessPath(); OverrideChildProcessPath();
}
#endif #endif
// Paths used to locate spell checking dictionary files.
// TODO(cef): It may be better to use a persistent location for
// DIR_USER_DATA. See the implementation of GetDefaultUserDataDirectory in
// chrome/common/chrome_paths_*.
const base::FilePath& cache_path = CefContext::Get()->cache_path();
PathService::Override(chrome::DIR_USER_DATA, cache_path);
PathService::OverrideAndCreateIfNeeded(
chrome::DIR_APP_DICTIONARIES,
cache_path.AppendASCII("Dictionaries"),
false, // May not be an absolute path.
true); // Create if necessary.
}
OverridePdfPluginPath(); OverridePdfPluginPath();
if (command_line.HasSwitch(switches::kDisablePackLoading)) if (command_line.HasSwitch(switches::kDisablePackLoading))

View File

@ -39,6 +39,8 @@ MSVC_POP_WARNING();
#include "chrome/renderer/loadtimes_extension_bindings.h" #include "chrome/renderer/loadtimes_extension_bindings.h"
#include "chrome/renderer/pepper/chrome_pdf_print_client.h" #include "chrome/renderer/pepper/chrome_pdf_print_client.h"
#include "chrome/renderer/printing/print_web_view_helper.h" #include "chrome/renderer/printing/print_web_view_helper.h"
#include "chrome/renderer/spellchecker/spellcheck.h"
#include "chrome/renderer/spellchecker/spellcheck_provider.h"
#include "components/pdf/renderer/ppb_pdf_impl.h" #include "components/pdf/renderer/ppb_pdf_impl.h"
#include "components/web_cache/renderer/web_cache_render_process_observer.h" #include "components/web_cache/renderer/web_cache_render_process_observer.h"
#include "content/child/child_thread.h" #include "content/child/child_thread.h"
@ -50,6 +52,7 @@ MSVC_POP_WARNING();
#include "content/public/common/content_paths.h" #include "content/public/common/content_paths.h"
#include "content/public/renderer/render_thread.h" #include "content/public/renderer/render_thread.h"
#include "content/public/renderer/render_view.h" #include "content/public/renderer/render_view.h"
#include "content/public/renderer/render_view_visitor.h"
#include "content/renderer/render_frame_impl.h" #include "content/renderer/render_frame_impl.h"
#include "ipc/ipc_sync_channel.h" #include "ipc/ipc_sync_channel.h"
#include "media/base/media.h" #include "media/base/media.h"
@ -439,6 +442,9 @@ void CefContentRendererClient::RunSingleProcessCleanup() {
} }
void CefContentRendererClient::RenderThreadStarted() { void CefContentRendererClient::RenderThreadStarted() {
const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
render_task_runner_ = base::MessageLoopProxy::current(); render_task_runner_ = base::MessageLoopProxy::current();
observer_.reset(new CefRenderProcessObserver()); observer_.reset(new CefRenderProcessObserver());
web_cache_observer_.reset(new web_cache::WebCacheRenderProcessObserver()); web_cache_observer_.reset(new web_cache::WebCacheRenderProcessObserver());
@ -449,6 +455,11 @@ void CefContentRendererClient::RenderThreadStarted() {
thread->GetChannel()->AddFilter(new CefRenderMessageFilter); thread->GetChannel()->AddFilter(new CefRenderMessageFilter);
thread->RegisterExtension(extensions_v8::LoadTimesExtension::Get()); thread->RegisterExtension(extensions_v8::LoadTimesExtension::Get());
if (!command_line->HasSwitch(switches::kDisableSpellChecking)) {
spellcheck_.reset(new SpellCheck());
thread->AddObserver(spellcheck_.get());
}
if (content::RenderProcessHost::run_renderer_in_process()) { if (content::RenderProcessHost::run_renderer_in_process()) {
// When running in single-process mode register as a destruction observer // When running in single-process mode register as a destruction observer
// on the render thread's MessageLoop. // on the render thread's MessageLoop.
@ -721,6 +732,9 @@ void CefContentRendererClient::WillDestroyCurrentMessageLoop() {
void CefContentRendererClient::BrowserCreated( void CefContentRendererClient::BrowserCreated(
content::RenderView* render_view, content::RenderView* render_view,
content::RenderFrame* render_frame) { content::RenderFrame* render_frame) {
const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
// Retrieve the browser information synchronously. This will also register // Retrieve the browser information synchronously. This will also register
// the routing ids with the browser info object in the browser process. // the routing ids with the browser info object in the browser process.
CefProcessHostMsg_GetNewBrowserInfo_Params params; CefProcessHostMsg_GetNewBrowserInfo_Params params;
@ -752,6 +766,9 @@ void CefContentRendererClient::BrowserCreated(
new CefPrerendererClient(render_view); new CefPrerendererClient(render_view);
new printing::PrintWebViewHelper(render_view); new printing::PrintWebViewHelper(render_view);
if (!command_line->HasSwitch(switches::kDisableSpellChecking))
new SpellCheckProvider(render_view, spellcheck_.get());
// Notify the render process handler. // Notify the render process handler.
CefRefPtr<CefApp> application = CefContentClient::Get()->application(); CefRefPtr<CefApp> application = CefContentClient::Get()->application();
if (application.get()) { if (application.get()) {

View File

@ -27,6 +27,7 @@ class WebCacheRenderProcessObserver;
class CefRenderProcessObserver; class CefRenderProcessObserver;
struct Cef_CrossOriginWhiteListEntry_Params; struct Cef_CrossOriginWhiteListEntry_Params;
class ChromePDFPrintClient; class ChromePDFPrintClient;
class SpellCheck;
class CefContentRendererClient : public content::ContentRendererClient, class CefContentRendererClient : public content::ContentRendererClient,
public base::MessageLoop::DestructionObserver { public base::MessageLoop::DestructionObserver {
@ -118,6 +119,7 @@ class CefContentRendererClient : public content::ContentRendererClient,
scoped_refptr<base::SequencedTaskRunner> render_task_runner_; scoped_refptr<base::SequencedTaskRunner> render_task_runner_;
scoped_ptr<CefRenderProcessObserver> observer_; scoped_ptr<CefRenderProcessObserver> observer_;
scoped_ptr<web_cache::WebCacheRenderProcessObserver> web_cache_observer_; scoped_ptr<web_cache::WebCacheRenderProcessObserver> web_cache_observer_;
scoped_ptr<SpellCheck> spellcheck_;
// Map of RenderView pointers to CefBrowserImpl references. // Map of RenderView pointers to CefBrowserImpl references.
typedef std::map<content::RenderView*, CefRefPtr<CefBrowserImpl> > BrowserMap; typedef std::map<content::RenderView*, CefRefPtr<CefBrowserImpl> > BrowserMap;

View File

@ -11,9 +11,7 @@ need to be translated for each locale.-->
<output filename="grit/cef_strings.h" type="rc_header"> <output filename="grit/cef_strings.h" type="rc_header">
<emit emit_type='prepend'></emit> <emit emit_type='prepend'></emit>
</output> </output>
<!-- TODO keep the list of output files synchronized with other grd files, e.g.
webkit/glue/webkit_strings.grd -->
<output filename="cef_strings_am.pak" type="data_package" lang="am" /> <output filename="cef_strings_am.pak" type="data_package" lang="am" />
<output filename="cef_strings_ar.pak" type="data_package" lang="ar" /> <output filename="cef_strings_ar.pak" type="data_package" lang="ar" />
<if expr="pp_ifdef('use_third_party_translations')"> <if expr="pp_ifdef('use_third_party_translations')">
@ -79,7 +77,9 @@ need to be translated for each locale.-->
<output filename="cef_strings_lv.pak" type="data_package" lang="lv" /> <output filename="cef_strings_lv.pak" type="data_package" lang="lv" />
<output filename="cef_strings_ml.pak" type="data_package" lang="ml" /> <output filename="cef_strings_ml.pak" type="data_package" lang="ml" />
<output filename="cef_strings_mr.pak" type="data_package" lang="mr" /> <output filename="cef_strings_mr.pak" type="data_package" lang="mr" />
<output filename="cef_strings_ms.pak" type="data_package" lang="ms" /> <if expr="pp_ifdef('use_third_party_translations')">
<output filename="cef_strings_ms.pak" type="data_package" lang="ms" />
</if>
<output filename="cef_strings_nl.pak" type="data_package" lang="nl" /> <output filename="cef_strings_nl.pak" type="data_package" lang="nl" />
<!-- The translation console uses 'no' for Norwegian Bokmål. It should <!-- The translation console uses 'no' for Norwegian Bokmål. It should
be 'nb'. --> be 'nb'. -->
@ -107,74 +107,51 @@ need to be translated for each locale.-->
<output filename="cef_strings_zh-TW.pak" type="data_package" lang="zh-TW" /> <output filename="cef_strings_zh-TW.pak" type="data_package" lang="zh-TW" />
</outputs> </outputs>
<translations> <translations>
<!-- TODO figure out a reliable way to generate XMB/XTB files. For more information see: <file path="../../../chrome/app/resources/generated_resources_am.xtb" lang="am" />
https://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/ce501a6ee4958c61 -->
<!-- The translation console uses 'iw' for Hebrew, but we use 'he'. -->
<file path="../../../chrome/app/resources/generated_resources_am.xtb" lang="am" />
<file path="../../../chrome/app/resources/generated_resources_ar.xtb" lang="ar" /> <file path="../../../chrome/app/resources/generated_resources_ar.xtb" lang="ar" />
<if expr="pp_ifdef('use_third_party_translations')"> <file path="../../../third_party/launchpad_translations/generated_resources_ast.xtb" lang="ast" />
<file path="../../../third_partylaunchpad_translations/generated_resources_ast.xtb" lang="ast" />
</if>
<file path="../../../chrome/app/resources/generated_resources_bg.xtb" lang="bg" /> <file path="../../../chrome/app/resources/generated_resources_bg.xtb" lang="bg" />
<file path="../../../chrome/app/resources/generated_resources_bn.xtb" lang="bn" /> <file path="../../../chrome/app/resources/generated_resources_bn.xtb" lang="bn" />
<if expr="pp_ifdef('use_third_party_translations')"> <file path="../../../third_party/launchpad_translations/generated_resources_bs.xtb" lang="bs" />
<file path="../../../third_partylaunchpad_translations/generated_resources_bs.xtb" lang="bs" />
</if>
<file path="../../../chrome/app/resources/generated_resources_ca.xtb" lang="ca" /> <file path="../../../chrome/app/resources/generated_resources_ca.xtb" lang="ca" />
<if expr="pp_ifdef('use_third_party_translations')"> <file path="../../../third_party/launchpad_translations/generated_resources_ca-valencia.xtb" lang="ca@valencia" />
<file path="../../../third_partylaunchpad_translations/generated_resources_ca-valencia.xtb" lang="ca@valencia" />
</if>
<file path="../../../chrome/app/resources/generated_resources_cs.xtb" lang="cs" /> <file path="../../../chrome/app/resources/generated_resources_cs.xtb" lang="cs" />
<file path="../../../chrome/app/resources/generated_resources_da.xtb" lang="da" /> <file path="../../../chrome/app/resources/generated_resources_da.xtb" lang="da" />
<file path="../../../chrome/app/resources/generated_resources_de.xtb" lang="de" /> <file path="../../../chrome/app/resources/generated_resources_de.xtb" lang="de" />
<file path="../../../chrome/app/resources/generated_resources_el.xtb" lang="el" /> <file path="../../../chrome/app/resources/generated_resources_el.xtb" lang="el" />
<if expr="pp_ifdef('use_third_party_translations')"> <file path="../../../third_party/launchpad_translations/generated_resources_en-AU.xtb" lang="en-AU" />
<file path="../../../third_partylaunchpad_translations/generated_resources_en-AU.xtb" lang="en-AU" />
</if>
<file path="../../../chrome/app/resources/generated_resources_en-GB.xtb" lang="en-GB" /> <file path="../../../chrome/app/resources/generated_resources_en-GB.xtb" lang="en-GB" />
<if expr="pp_ifdef('use_third_party_translations')"> <file path="../../../third_party/launchpad_translations/generated_resources_eo.xtb" lang="eo" />
<file path="../../../third_partylaunchpad_translations/generated_resources_eo.xtb" lang="eo" />
</if>
<file path="../../../chrome/app/resources/generated_resources_es.xtb" lang="es" /> <file path="../../../chrome/app/resources/generated_resources_es.xtb" lang="es" />
<file path="../../../chrome/app/resources/generated_resources_es-419.xtb" lang="es-419" /> <file path="../../../chrome/app/resources/generated_resources_es-419.xtb" lang="es-419" />
<file path="../../../chrome/app/resources/generated_resources_et.xtb" lang="et" /> <file path="../../../chrome/app/resources/generated_resources_et.xtb" lang="et" />
<if expr="pp_ifdef('use_third_party_translations')"> <file path="../../../third_party/launchpad_translations/generated_resources_eu.xtb" lang="eu" />
<file path="../../../third_partylaunchpad_translations/generated_resources_eu.xtb" lang="eu" />
</if>
<file path="../../../chrome/app/resources/generated_resources_fa.xtb" lang="fa" /> <file path="../../../chrome/app/resources/generated_resources_fa.xtb" lang="fa" />
<file path="../../../chrome/app/resources/generated_resources_fi.xtb" lang="fi" /> <file path="../../../chrome/app/resources/generated_resources_fi.xtb" lang="fi" />
<file path="../../../chrome/app/resources/generated_resources_fil.xtb" lang="fil" /> <file path="../../../chrome/app/resources/generated_resources_fil.xtb" lang="fil" />
<file path="../../../chrome/app/resources/generated_resources_fr.xtb" lang="fr" /> <file path="../../../chrome/app/resources/generated_resources_fr.xtb" lang="fr" />
<if expr="pp_ifdef('use_third_party_translations')"> <file path="../../../third_party/launchpad_translations/generated_resources_gl.xtb" lang="gl" />
<file path="../../../third_partylaunchpad_translations/generated_resources_gl.xtb" lang="gl" />
</if>
<file path="../../../chrome/app/resources/generated_resources_gu.xtb" lang="gu" /> <file path="../../../chrome/app/resources/generated_resources_gu.xtb" lang="gu" />
<file path="../../../chrome/app/resources/generated_resources_hi.xtb" lang="hi" /> <file path="../../../chrome/app/resources/generated_resources_hi.xtb" lang="hi" />
<file path="../../../chrome/app/resources/generated_resources_hr.xtb" lang="hr" /> <file path="../../../chrome/app/resources/generated_resources_hr.xtb" lang="hr" />
<file path="../../../chrome/app/resources/generated_resources_hu.xtb" lang="hu" /> <file path="../../../chrome/app/resources/generated_resources_hu.xtb" lang="hu" />
<if expr="pp_ifdef('use_third_party_translations')"> <file path="../../../third_party/launchpad_translations/generated_resources_hy.xtb" lang="hy" />
<file path="../../../third_partylaunchpad_translations/generated_resources_hy.xtb" lang="hy" /> <file path="../../../third_party/launchpad_translations/generated_resources_ia.xtb" lang="ia" />
<file path="../../../third_partylaunchpad_translations/generated_resources_ia.xtb" lang="ia" />
</if>
<file path="../../../chrome/app/resources/generated_resources_id.xtb" lang="id" /> <file path="../../../chrome/app/resources/generated_resources_id.xtb" lang="id" />
<file path="../../../chrome/app/resources/generated_resources_it.xtb" lang="it" /> <file path="../../../chrome/app/resources/generated_resources_it.xtb" lang="it" />
<!-- The translation console uses 'iw' for Hebrew, but we use 'he'. --> <!-- The translation console uses 'iw' for Hebrew, but we use 'he'. -->
<file path="../../../chrome/app/resources/generated_resources_iw.xtb" lang="he" /> <file path="../../../chrome/app/resources/generated_resources_iw.xtb" lang="he" />
<file path="../../../chrome/app/resources/generated_resources_ja.xtb" lang="ja" /> <file path="../../../chrome/app/resources/generated_resources_ja.xtb" lang="ja" />
<if expr="pp_ifdef('use_third_party_translations')"> <file path="../../../third_party/launchpad_translations/generated_resources_ka.xtb" lang="ka" />
<file path="../../../third_partylaunchpad_translations/generated_resources_ka.xtb" lang="ka" />
</if>
<file path="../../../chrome/app/resources/generated_resources_kn.xtb" lang="kn" /> <file path="../../../chrome/app/resources/generated_resources_kn.xtb" lang="kn" />
<file path="../../../chrome/app/resources/generated_resources_ko.xtb" lang="ko" /> <file path="../../../chrome/app/resources/generated_resources_ko.xtb" lang="ko" />
<if expr="pp_ifdef('use_third_party_translations')"> <file path="../../../third_party/launchpad_translations/generated_resources_ku.xtb" lang="ku" />
<file path="../../../third_partylaunchpad_translations/generated_resources_ku.xtb" lang="ku" /> <file path="../../../third_party/launchpad_translations/generated_resources_kw.xtb" lang="kw" />
<file path="../../../third_partylaunchpad_translations/generated_resources_kw.xtb" lang="kw" />
</if>
<file path="../../../chrome/app/resources/generated_resources_lt.xtb" lang="lt" /> <file path="../../../chrome/app/resources/generated_resources_lt.xtb" lang="lt" />
<file path="../../../chrome/app/resources/generated_resources_lv.xtb" lang="lv" /> <file path="../../../chrome/app/resources/generated_resources_lv.xtb" lang="lv" />
<file path="../../../chrome/app/resources/generated_resources_ml.xtb" lang="ml" /> <file path="../../../chrome/app/resources/generated_resources_ml.xtb" lang="ml" />
<file path="../../../chrome/app/resources/generated_resources_mr.xtb" lang="mr" /> <file path="../../../chrome/app/resources/generated_resources_mr.xtb" lang="mr" />
<file path="../../../chrome/app/resources/generated_resources_ms.xtb" lang="ms" /> <file path="../../../third_party/launchpad_translations/generated_resources_ms.xtb" lang="ms" />
<file path="../../../chrome/app/resources/generated_resources_nl.xtb" lang="nl" /> <file path="../../../chrome/app/resources/generated_resources_nl.xtb" lang="nl" />
<file path="../../../chrome/app/resources/generated_resources_no.xtb" lang="no" /> <file path="../../../chrome/app/resources/generated_resources_no.xtb" lang="no" />
<file path="../../../chrome/app/resources/generated_resources_pl.xtb" lang="pl" /> <file path="../../../chrome/app/resources/generated_resources_pl.xtb" lang="pl" />
@ -191,13 +168,64 @@ need to be translated for each locale.-->
<file path="../../../chrome/app/resources/generated_resources_te.xtb" lang="te" /> <file path="../../../chrome/app/resources/generated_resources_te.xtb" lang="te" />
<file path="../../../chrome/app/resources/generated_resources_th.xtb" lang="th" /> <file path="../../../chrome/app/resources/generated_resources_th.xtb" lang="th" />
<file path="../../../chrome/app/resources/generated_resources_tr.xtb" lang="tr" /> <file path="../../../chrome/app/resources/generated_resources_tr.xtb" lang="tr" />
<if expr="pp_ifdef('use_third_party_translations')"> <file path="../../../third_party/launchpad_translations/generated_resources_ug.xtb" lang="ug" />
<file path="../../../third_partylaunchpad_translations/generated_resources_ug.xtb" lang="ug" />
</if>
<file path="../../../chrome/app/resources/generated_resources_uk.xtb" lang="uk" /> <file path="../../../chrome/app/resources/generated_resources_uk.xtb" lang="uk" />
<file path="../../../chrome/app/resources/generated_resources_vi.xtb" lang="vi" /> <file path="../../../chrome/app/resources/generated_resources_vi.xtb" lang="vi" />
<file path="../../../chrome/app/resources/generated_resources_zh-CN.xtb" lang="zh-CN" /> <file path="../../../chrome/app/resources/generated_resources_zh-CN.xtb" lang="zh-CN" />
<file path="../../../chrome/app/resources/generated_resources_zh-TW.xtb" lang="zh-TW" /> <file path="../../../chrome/app/resources/generated_resources_zh-TW.xtb" lang="zh-TW" />
<file path="../../../chrome/app/resources/locale_settings_am.xtb" lang="am" />
<file path="../../../chrome/app/resources/locale_settings_ar.xtb" lang="ar" />
<file path="../../../chrome/app/resources/locale_settings_bg.xtb" lang="bg" />
<file path="../../../chrome/app/resources/locale_settings_bn.xtb" lang="bn" />
<file path="../../../chrome/app/resources/locale_settings_ca.xtb" lang="ca" />
<file path="../../../chrome/app/resources/locale_settings_cs.xtb" lang="cs" />
<file path="../../../chrome/app/resources/locale_settings_da.xtb" lang="da" />
<file path="../../../chrome/app/resources/locale_settings_de.xtb" lang="de" />
<file path="../../../chrome/app/resources/locale_settings_el.xtb" lang="el" />
<file path="../../../chrome/app/resources/locale_settings_en-GB.xtb" lang="en-GB" />
<file path="../../../chrome/app/resources/locale_settings_es.xtb" lang="es" />
<file path="../../../chrome/app/resources/locale_settings_es-419.xtb" lang="es-419" />
<file path="../../../chrome/app/resources/locale_settings_et.xtb" lang="et" />
<file path="../../../chrome/app/resources/locale_settings_fa.xtb" lang="fa" />
<file path="../../../chrome/app/resources/locale_settings_fi.xtb" lang="fi" />
<file path="../../../chrome/app/resources/locale_settings_fil.xtb" lang="fil" />
<file path="../../../chrome/app/resources/locale_settings_fr.xtb" lang="fr" />
<file path="../../../chrome/app/resources/locale_settings_gu.xtb" lang="gu" />
<file path="../../../chrome/app/resources/locale_settings_he.xtb" lang="he" />
<file path="../../../chrome/app/resources/locale_settings_hi.xtb" lang="hi" />
<file path="../../../chrome/app/resources/locale_settings_hr.xtb" lang="hr" />
<file path="../../../chrome/app/resources/locale_settings_hu.xtb" lang="hu" />
<file path="../../../chrome/app/resources/locale_settings_id.xtb" lang="id" />
<file path="../../../chrome/app/resources/locale_settings_it.xtb" lang="it" />
<file path="../../../chrome/app/resources/locale_settings_ja.xtb" lang="ja" />
<file path="../../../chrome/app/resources/locale_settings_kn.xtb" lang="kn" />
<file path="../../../chrome/app/resources/locale_settings_ko.xtb" lang="ko" />
<file path="../../../chrome/app/resources/locale_settings_lt.xtb" lang="lt" />
<file path="../../../chrome/app/resources/locale_settings_lv.xtb" lang="lv" />
<file path="../../../chrome/app/resources/locale_settings_ml.xtb" lang="ml" />
<file path="../../../chrome/app/resources/locale_settings_mr.xtb" lang="mr" />
<file path="../../../chrome/app/resources/locale_settings_ms.xtb" lang="ms" />
<file path="../../../chrome/app/resources/locale_settings_nl.xtb" lang="nl" />
<file path="../../../chrome/app/resources/locale_settings_nb.xtb" lang="no" />
<file path="../../../chrome/app/resources/locale_settings_pl.xtb" lang="pl" />
<file path="../../../chrome/app/resources/locale_settings_pt-BR.xtb" lang="pt-BR" />
<file path="../../../chrome/app/resources/locale_settings_pt-PT.xtb" lang="pt-PT" />
<file path="../../../chrome/app/resources/locale_settings_ro.xtb" lang="ro" />
<file path="../../../chrome/app/resources/locale_settings_ru.xtb" lang="ru" />
<file path="../../../chrome/app/resources/locale_settings_sk.xtb" lang="sk" />
<file path="../../../chrome/app/resources/locale_settings_sl.xtb" lang="sl" />
<file path="../../../chrome/app/resources/locale_settings_sr.xtb" lang="sr" />
<file path="../../../chrome/app/resources/locale_settings_sv.xtb" lang="sv" />
<file path="../../../chrome/app/resources/locale_settings_sw.xtb" lang="sw" />
<file path="../../../chrome/app/resources/locale_settings_ta.xtb" lang="ta" />
<file path="../../../chrome/app/resources/locale_settings_te.xtb" lang="te" />
<file path="../../../chrome/app/resources/locale_settings_th.xtb" lang="th" />
<file path="../../../chrome/app/resources/locale_settings_tr.xtb" lang="tr" />
<file path="../../../chrome/app/resources/locale_settings_uk.xtb" lang="uk" />
<file path="../../../chrome/app/resources/locale_settings_vi.xtb" lang="vi" />
<file path="../../../chrome/app/resources/locale_settings_zh-CN.xtb" lang="zh-CN" />
<file path="../../../chrome/app/resources/locale_settings_zh-TW.xtb" lang="zh-TW" />
</translations> </translations>
<release seq="1" allow_pseudo="false"> <release seq="1" allow_pseudo="false">
<messages fallback_to_english="true"> <messages fallback_to_english="true">
@ -277,6 +305,15 @@ need to be translated for each locale.-->
<message name="IDS_PRINT_INVALID_PRINTER_SETTINGS" desc="Message to display when selected printer is not reachable or its settings are invalid."> <message name="IDS_PRINT_INVALID_PRINTER_SETTINGS" desc="Message to display when selected printer is not reachable or its settings are invalid.">
The selected printer is not available or not installed correctly. Check your printer or try selecting another printer. The selected printer is not available or not installed correctly. Check your printer or try selecting another printer.
</message> </message>
<!-- Spell checking -->
<!-- The file name of the spellchecking dictionary without the extension (case-sensitive). -->
<message name="IDS_SPELLCHECK_DICTIONARY" use_name_for_id="true">
en-US
</message>
<message name="IDS_MENU_NO_SPELLING_SUGGESTIONS" desc="The name of the No Spelling Suggestions display in the content area context menu">
&amp;No spelling suggestions
</message>
</messages> </messages>
</release> </release>
</grit> </grit>

View File

@ -0,0 +1,2 @@
#include <grit/cef_resources.h>
#include <grit/cef_strings.h>

View File

@ -411,6 +411,23 @@ int CEF_CALLBACK browser_host_is_mouse_cursor_change_disabled(
return _retval; return _retval;
} }
void CEF_CALLBACK browser_host_replace_misspelling(
struct _cef_browser_host_t* self, const cef_string_t* word) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: word; type: string_byref_const
DCHECK(word);
if (!word)
return;
// Execute
CefBrowserHostCppToC::Get(self)->ReplaceMisspelling(
CefString(word));
}
int CEF_CALLBACK browser_host_is_window_rendering_disabled( int CEF_CALLBACK browser_host_is_window_rendering_disabled(
struct _cef_browser_host_t* self) { struct _cef_browser_host_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@ -782,6 +799,7 @@ CefBrowserHostCppToC::CefBrowserHostCppToC(CefBrowserHost* cls)
browser_host_set_mouse_cursor_change_disabled; browser_host_set_mouse_cursor_change_disabled;
struct_.struct_.is_mouse_cursor_change_disabled = struct_.struct_.is_mouse_cursor_change_disabled =
browser_host_is_mouse_cursor_change_disabled; browser_host_is_mouse_cursor_change_disabled;
struct_.struct_.replace_misspelling = browser_host_replace_misspelling;
struct_.struct_.is_window_rendering_disabled = struct_.struct_.is_window_rendering_disabled =
browser_host_is_window_rendering_disabled; browser_host_is_window_rendering_disabled;
struct_.struct_.was_resized = browser_host_was_resized; struct_.struct_.was_resized = browser_host_was_resized;

View File

@ -11,6 +11,7 @@
// //
#include "libcef_dll/cpptoc/context_menu_params_cpptoc.h" #include "libcef_dll/cpptoc/context_menu_params_cpptoc.h"
#include "libcef_dll/transfer_util.h"
// MEMBER FUNCTIONS - Body may be edited by hand. // MEMBER FUNCTIONS - Body may be edited by hand.
@ -214,6 +215,66 @@ cef_string_userfree_t CEF_CALLBACK context_menu_params_get_selection_text(
return _retval.DetachToUserFree(); return _retval.DetachToUserFree();
} }
cef_string_userfree_t CEF_CALLBACK context_menu_params_get_misspelled_word(
struct _cef_context_menu_params_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefContextMenuParamsCppToC::Get(self)->GetMisspelledWord(
);
// Return type: string
return _retval.DetachToUserFree();
}
int CEF_CALLBACK context_menu_params_get_misspelling_hash(
struct _cef_context_menu_params_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefContextMenuParamsCppToC::Get(self)->GetMisspellingHash();
// Return type: simple
return _retval;
}
int CEF_CALLBACK context_menu_params_get_dictionary_suggestions(
struct _cef_context_menu_params_t* self, cef_string_list_t suggestions) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: suggestions; type: string_vec_byref
DCHECK(suggestions);
if (!suggestions)
return 0;
// Translate param: suggestions; type: string_vec_byref
std::vector<CefString> suggestionsList;
transfer_string_list_contents(suggestions, suggestionsList);
// Execute
bool _retval = CefContextMenuParamsCppToC::Get(
self)->GetDictionarySuggestions(
suggestionsList);
// Restore param: suggestions; type: string_vec_byref
cef_string_list_clear(suggestions);
transfer_string_list_contents(suggestionsList, suggestions);
// Return type: bool
return _retval;
}
int CEF_CALLBACK context_menu_params_is_editable( int CEF_CALLBACK context_menu_params_is_editable(
struct _cef_context_menu_params_t* self) { struct _cef_context_menu_params_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@ -229,6 +290,21 @@ int CEF_CALLBACK context_menu_params_is_editable(
return _retval; return _retval;
} }
int CEF_CALLBACK context_menu_params_is_spell_check_enabled(
struct _cef_context_menu_params_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefContextMenuParamsCppToC::Get(self)->IsSpellCheckEnabled();
// Return type: bool
return _retval;
}
cef_context_menu_edit_state_flags_t CEF_CALLBACK context_menu_params_get_edit_state_flags( cef_context_menu_edit_state_flags_t CEF_CALLBACK context_menu_params_get_edit_state_flags(
struct _cef_context_menu_params_t* self) { struct _cef_context_menu_params_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@ -267,7 +343,14 @@ CefContextMenuParamsCppToC::CefContextMenuParamsCppToC(
struct_.struct_.get_media_state_flags = struct_.struct_.get_media_state_flags =
context_menu_params_get_media_state_flags; context_menu_params_get_media_state_flags;
struct_.struct_.get_selection_text = context_menu_params_get_selection_text; struct_.struct_.get_selection_text = context_menu_params_get_selection_text;
struct_.struct_.get_misspelled_word = context_menu_params_get_misspelled_word;
struct_.struct_.get_misspelling_hash =
context_menu_params_get_misspelling_hash;
struct_.struct_.get_dictionary_suggestions =
context_menu_params_get_dictionary_suggestions;
struct_.struct_.is_editable = context_menu_params_is_editable; struct_.struct_.is_editable = context_menu_params_is_editable;
struct_.struct_.is_spell_check_enabled =
context_menu_params_is_spell_check_enabled;
struct_.struct_.get_edit_state_flags = struct_.struct_.get_edit_state_flags =
context_menu_params_get_edit_state_flags; context_menu_params_get_edit_state_flags;
} }

View File

@ -315,6 +315,23 @@ void CEF_CALLBACK render_handler_update_drag_cursor(
operation); operation);
} }
void CEF_CALLBACK render_handler_on_scroll_offset_changed(
struct _cef_render_handler_t* self, cef_browser_t* browser) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser)
return;
// Execute
CefRenderHandlerCppToC::Get(self)->OnScrollOffsetChanged(
CefBrowserCToCpp::Wrap(browser));
}
// CONSTRUCTOR - Do not edit by hand. // CONSTRUCTOR - Do not edit by hand.
@ -331,6 +348,8 @@ CefRenderHandlerCppToC::CefRenderHandlerCppToC(CefRenderHandler* cls)
struct_.struct_.on_cursor_change = render_handler_on_cursor_change; struct_.struct_.on_cursor_change = render_handler_on_cursor_change;
struct_.struct_.start_dragging = render_handler_start_dragging; struct_.struct_.start_dragging = render_handler_start_dragging;
struct_.struct_.update_drag_cursor = render_handler_update_drag_cursor; struct_.struct_.update_drag_cursor = render_handler_update_drag_cursor;
struct_.struct_.on_scroll_offset_changed =
render_handler_on_scroll_offset_changed;
} }
#ifndef NDEBUG #ifndef NDEBUG

View File

@ -331,6 +331,22 @@ bool CefBrowserHostCToCpp::IsMouseCursorChangeDisabled() {
return _retval?true:false; return _retval?true:false;
} }
void CefBrowserHostCToCpp::ReplaceMisspelling(const CefString& word) {
if (CEF_MEMBER_MISSING(struct_, replace_misspelling))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: word; type: string_byref_const
DCHECK(!word.empty());
if (word.empty())
return;
// Execute
struct_->replace_misspelling(struct_,
word.GetStruct());
}
bool CefBrowserHostCToCpp::IsWindowRenderingDisabled() { bool CefBrowserHostCToCpp::IsWindowRenderingDisabled() {
if (CEF_MEMBER_MISSING(struct_, is_window_rendering_disabled)) if (CEF_MEMBER_MISSING(struct_, is_window_rendering_disabled))
return false; return false;

View File

@ -62,6 +62,7 @@ class CefBrowserHostCToCpp
virtual void CloseDevTools() OVERRIDE; virtual void CloseDevTools() OVERRIDE;
virtual void SetMouseCursorChangeDisabled(bool disabled) OVERRIDE; virtual void SetMouseCursorChangeDisabled(bool disabled) OVERRIDE;
virtual bool IsMouseCursorChangeDisabled() OVERRIDE; virtual bool IsMouseCursorChangeDisabled() OVERRIDE;
virtual void ReplaceMisspelling(const CefString& word) OVERRIDE;
virtual bool IsWindowRenderingDisabled() OVERRIDE; virtual bool IsWindowRenderingDisabled() OVERRIDE;
virtual void WasResized() OVERRIDE; virtual void WasResized() OVERRIDE;
virtual void WasHidden(bool hidden) OVERRIDE; virtual void WasHidden(bool hidden) OVERRIDE;

View File

@ -11,6 +11,7 @@
// //
#include "libcef_dll/ctocpp/context_menu_params_ctocpp.h" #include "libcef_dll/ctocpp/context_menu_params_ctocpp.h"
#include "libcef_dll/transfer_util.h"
// VIRTUAL METHODS - Body may be edited by hand. // VIRTUAL METHODS - Body may be edited by hand.
@ -200,6 +201,62 @@ CefString CefContextMenuParamsCToCpp::GetSelectionText() {
return _retvalStr; return _retvalStr;
} }
CefString CefContextMenuParamsCToCpp::GetMisspelledWord() {
if (CEF_MEMBER_MISSING(struct_, get_misspelled_word))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = struct_->get_misspelled_word(struct_);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
int CefContextMenuParamsCToCpp::GetMisspellingHash() {
if (CEF_MEMBER_MISSING(struct_, get_misspelling_hash))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->get_misspelling_hash(struct_);
// Return type: simple
return _retval;
}
bool CefContextMenuParamsCToCpp::GetDictionarySuggestions(
std::vector<CefString>& suggestions) {
if (CEF_MEMBER_MISSING(struct_, get_dictionary_suggestions))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Translate param: suggestions; type: string_vec_byref
cef_string_list_t suggestionsList = cef_string_list_alloc();
DCHECK(suggestionsList);
if (suggestionsList)
transfer_string_list_contents(suggestions, suggestionsList);
// Execute
int _retval = struct_->get_dictionary_suggestions(struct_,
suggestionsList);
// Restore param:suggestions; type: string_vec_byref
if (suggestionsList) {
suggestions.clear();
transfer_string_list_contents(suggestionsList, suggestions);
cef_string_list_free(suggestionsList);
}
// Return type: bool
return _retval?true:false;
}
bool CefContextMenuParamsCToCpp::IsEditable() { bool CefContextMenuParamsCToCpp::IsEditable() {
if (CEF_MEMBER_MISSING(struct_, is_editable)) if (CEF_MEMBER_MISSING(struct_, is_editable))
return false; return false;
@ -213,6 +270,19 @@ bool CefContextMenuParamsCToCpp::IsEditable() {
return _retval?true:false; return _retval?true:false;
} }
bool CefContextMenuParamsCToCpp::IsSpellCheckEnabled() {
if (CEF_MEMBER_MISSING(struct_, is_spell_check_enabled))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->is_spell_check_enabled(struct_);
// Return type: bool
return _retval?true:false;
}
CefContextMenuParams::EditStateFlags CefContextMenuParamsCToCpp::GetEditStateFlags( CefContextMenuParams::EditStateFlags CefContextMenuParamsCToCpp::GetEditStateFlags(
) { ) {
if (CEF_MEMBER_MISSING(struct_, get_edit_state_flags)) if (CEF_MEMBER_MISSING(struct_, get_edit_state_flags))

View File

@ -18,6 +18,7 @@
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") #pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
#else // USING_CEF_SHARED #else // USING_CEF_SHARED
#include <vector>
#include "include/cef_context_menu_handler.h" #include "include/cef_context_menu_handler.h"
#include "include/capi/cef_context_menu_handler_capi.h" #include "include/capi/cef_context_menu_handler_capi.h"
#include "libcef_dll/ctocpp/ctocpp.h" #include "libcef_dll/ctocpp/ctocpp.h"
@ -47,7 +48,12 @@ class CefContextMenuParamsCToCpp
virtual MediaType GetMediaType() OVERRIDE; virtual MediaType GetMediaType() OVERRIDE;
virtual MediaStateFlags GetMediaStateFlags() OVERRIDE; virtual MediaStateFlags GetMediaStateFlags() OVERRIDE;
virtual CefString GetSelectionText() OVERRIDE; virtual CefString GetSelectionText() OVERRIDE;
virtual CefString GetMisspelledWord() OVERRIDE;
virtual int GetMisspellingHash() OVERRIDE;
virtual bool GetDictionarySuggestions(
std::vector<CefString>& suggestions) OVERRIDE;
virtual bool IsEditable() OVERRIDE; virtual bool IsEditable() OVERRIDE;
virtual bool IsSpellCheckEnabled() OVERRIDE;
virtual EditStateFlags GetEditStateFlags() OVERRIDE; virtual EditStateFlags GetEditStateFlags() OVERRIDE;
}; };

View File

@ -250,6 +250,23 @@ void CefRenderHandlerCToCpp::UpdateDragCursor(CefRefPtr<CefBrowser> browser,
operation); operation);
} }
void CefRenderHandlerCToCpp::OnScrollOffsetChanged(
CefRefPtr<CefBrowser> browser) {
if (CEF_MEMBER_MISSING(struct_, on_scroll_offset_changed))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: browser; type: refptr_diff
DCHECK(browser.get());
if (!browser.get())
return;
// Execute
struct_->on_scroll_offset_changed(struct_,
CefBrowserCppToC::Wrap(browser));
}
#ifndef NDEBUG #ifndef NDEBUG
template<> base::AtomicRefCount CefCToCpp<CefRenderHandlerCToCpp, template<> base::AtomicRefCount CefCToCpp<CefRenderHandlerCToCpp,

View File

@ -55,6 +55,7 @@ class CefRenderHandlerCToCpp
int y) OVERRIDE; int y) OVERRIDE;
virtual void UpdateDragCursor(CefRefPtr<CefBrowser> browser, virtual void UpdateDragCursor(CefRefPtr<CefBrowser> browser,
DragOperation operation) OVERRIDE; DragOperation operation) OVERRIDE;
virtual void OnScrollOffsetChanged(CefRefPtr<CefBrowser> browser) OVERRIDE;
}; };
#endif // BUILDING_CEF_SHARED #endif // BUILDING_CEF_SHARED

View File

@ -117,6 +117,13 @@ patches = [
'name': 'renderer_415478', 'name': 'renderer_415478',
'path': '../content/renderer/', 'path': '../content/renderer/',
}, },
{
# Fix AtExitManager assertion on SpellcheckServiceFactory destruction during
# Windows multi-threaded message loop shutdown.
# https://code.google.com/p/chromiumembedded/issues/detail?id=137
'name': 'spellcheck_137',
'path': '../chrome/browser/spellchecker/',
},
{ {
# Disable scollbar bounce and overlay on OS X. # Disable scollbar bounce and overlay on OS X.
# http://code.google.com/p/chromiumembedded/issues/detail?id=364 # http://code.google.com/p/chromiumembedded/issues/detail?id=364

View File

@ -0,0 +1,49 @@
diff --git spellcheck_factory.cc spellcheck_factory.cc
index 8df78f4..33e4201e 100644
--- spellcheck_factory.cc
+++ spellcheck_factory.cc
@@ -14,6 +14,13 @@
#include "components/user_prefs/user_prefs.h"
#include "content/public/browser/render_process_host.h"
+namespace {
+
+static base::LazyInstance<SpellcheckServiceFactory>::Leaky
+ g_spellcheck_service_factory = LAZY_INSTANCE_INITIALIZER;
+
+} // namespace
+
// static
SpellcheckService* SpellcheckServiceFactory::GetForContext(
content::BrowserContext* context) {
@@ -36,7 +43,7 @@ SpellcheckService* SpellcheckServiceFactory::GetForRenderProcessId(
// static
SpellcheckServiceFactory* SpellcheckServiceFactory::GetInstance() {
- return Singleton<SpellcheckServiceFactory>::get();
+ return g_spellcheck_service_factory.Pointer();
}
SpellcheckServiceFactory::SpellcheckServiceFactory()
diff --git spellcheck_factory.h spellcheck_factory.h
index d2f4679..c1a790c 100644
--- spellcheck_factory.h
+++ spellcheck_factory.h
@@ -7,7 +7,7 @@
#include "base/basictypes.h"
#include "base/gtest_prod_util.h"
-#include "base/memory/singleton.h"
+#include "base/lazy_instance.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
class SpellcheckService;
@@ -26,7 +26,7 @@ class SpellcheckServiceFactory : public BrowserContextKeyedServiceFactory {
static SpellcheckServiceFactory* GetInstance();
private:
- friend struct DefaultSingletonTraits<SpellcheckServiceFactory>;
+ friend struct base::DefaultLazyInstanceTraits<SpellcheckServiceFactory>;
SpellcheckServiceFactory();
virtual ~SpellcheckServiceFactory();