diff options
author | dylanking <dylanking@google.com> | 2015-08-04 12:56:32 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-04 19:58:45 +0000 |
commit | 990eb97f091d9719b2061de67b7e585f6a967d8b (patch) | |
tree | cbc49525c04a86f26cdce332e36155eb9ac49d0e | |
parent | 796afe619bb0cecbe4538d748f75fe83b824d871 (diff) | |
download | chromium_src-990eb97f091d9719b2061de67b7e585f6a967d8b.zip chromium_src-990eb97f091d9719b2061de67b7e585f6a967d8b.tar.gz chromium_src-990eb97f091d9719b2061de67b7e585f6a967d8b.tar.bz2 |
Rename spellchecker preprocessor flag
Renamed USE_PLATFORM_SPELLCHECKER preprocessor flag to
USE_BROWSER_SPELLCHECKER to more accurately reflect the fact
that the browser side contains other services such as red
underlines that will be leveraged by any spellchecker.
BUG=415302
Review URL: https://codereview.chromium.org/1263423006
Cr-Commit-Position: refs/heads/master@{#341771}
-rw-r--r-- | build/common.gypi | 10 | ||||
-rw-r--r-- | build/config/BUILD.gn | 4 | ||||
-rw-r--r-- | build/config/features.gni | 2 | ||||
-rw-r--r-- | chrome/browser/chrome_content_browser_client.cc | 4 | ||||
-rw-r--r-- | chrome/browser/renderer_context_menu/spelling_menu_observer.cc | 2 | ||||
-rw-r--r-- | chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc | 10 | ||||
-rw-r--r-- | chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h | 2 | ||||
-rw-r--r-- | chrome/browser/spellchecker/spellcheck_message_filter.cc | 6 | ||||
-rw-r--r-- | chrome/browser/spellchecker/spellcheck_message_filter_unittest.cc | 6 | ||||
-rw-r--r-- | chrome/chrome_renderer.gypi | 2 | ||||
-rw-r--r-- | chrome/common/spellcheck_messages.h | 10 | ||||
-rw-r--r-- | chrome/renderer/BUILD.gn | 2 | ||||
-rw-r--r-- | chrome/renderer/spellchecker/hunspell_engine.cc | 2 | ||||
-rw-r--r-- | chrome/renderer/spellchecker/spellcheck_provider.cc | 20 | ||||
-rw-r--r-- | chrome/renderer/spellchecker/spellcheck_provider.h | 4 | ||||
-rw-r--r-- | chrome/renderer/spellchecker/spellcheck_provider_test.cc | 4 |
16 files changed, 45 insertions, 45 deletions
diff --git a/build/common.gypi b/build/common.gypi index 7127a59..a17066a 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -573,7 +573,7 @@ # Use the operating system spellchecker, e.g. NSSpellChecker on Mac or # SpellCheckerSession on Android. - 'use_platform_spellchecker%': 0, + 'use_browser_spellchecker%': 0, # Webrtc compilation is enabled by default. Set to 0 to disable. 'enable_webrtc%': 1, @@ -829,7 +829,7 @@ # Android and OSX have built-in spellcheckers that can be utilized. ['OS=="android" or OS=="mac"', { - 'use_platform_spellchecker%': 1, + 'use_browser_spellchecker%': 1, }], # Android OS includes support for proprietary codecs regardless of @@ -1211,7 +1211,7 @@ 'enable_basic_printing%': '<(enable_basic_printing)', 'enable_print_preview%': '<(enable_print_preview)', 'enable_spellcheck%': '<(enable_spellcheck)', - 'use_platform_spellchecker%': '<(use_platform_spellchecker)', + 'use_browser_spellchecker%': '<(use_browser_spellchecker)', 'enable_google_now%': '<(enable_google_now)', 'cld_version%': '<(cld_version)', 'cld2_table_size%': '<(cld2_table_size)', @@ -3029,8 +3029,8 @@ ['enable_spellcheck==1', { 'defines': ['ENABLE_SPELLCHECK=1'], }], - ['use_platform_spellchecker', { - 'defines': ['USE_PLATFORM_SPELLCHECKER=1'], + ['use_browser_spellchecker', { + 'defines': ['USE_BROWSER_SPELLCHECKER=1'], }], ['enable_captive_portal_detection==1', { 'defines': ['ENABLE_CAPTIVE_PORTAL_DETECTION=1'], diff --git a/build/config/BUILD.gn b/build/config/BUILD.gn index d72d404..b6b9520 100644 --- a/build/config/BUILD.gn +++ b/build/config/BUILD.gn @@ -87,8 +87,8 @@ config("feature_flags") { if (enable_spellcheck) { defines += [ "ENABLE_SPELLCHECK=1" ] } - if (use_platform_spellchecker) { - defines += [ "USE_PLATFORM_SPELLCHECKER=1" ] + if (use_browser_spellchecker) { + defines += [ "USE_BROWSER_SPELLCHECKER=1" ] } if (dont_embed_build_metadata) { defines += [ "DONT_EMBED_BUILD_METADATA" ] diff --git a/build/config/features.gni b/build/config/features.gni index 50993df..c076262 100644 --- a/build/config/features.gni +++ b/build/config/features.gni @@ -127,7 +127,7 @@ use_udev = is_linux enable_spellcheck = !is_ios # Use the operating system's spellchecker rather than hunspell. -use_platform_spellchecker = is_android || is_mac +use_browser_spellchecker = is_android || is_mac enable_pepper_cdms = enable_plugins && (is_linux || is_mac || is_win) diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 7fc1b41..a0b0ed0 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -247,7 +247,7 @@ #include "chrome/browser/spellchecker/spellcheck_message_filter.h" #endif -#if defined(USE_PLATFORM_SPELLCHECKER) +#if defined(USE_BROWSER_SPELLCHECKER) #include "chrome/browser/spellchecker/spellcheck_message_filter_platform.h" #endif @@ -845,7 +845,7 @@ void ChromeContentBrowserClient::RenderProcessWillLaunch( #if defined(ENABLE_SPELLCHECK) host->AddFilter(new SpellCheckMessageFilter(id)); #endif -#if defined(USE_PLATFORM_SPELLCHECKER) +#if defined(USE_BROWSER_SPELLCHECKER) host->AddFilter(new SpellCheckMessageFilterPlatform(id)); #endif host->AddFilter(new ChromeNetBenchmarkingMessageFilter(profile, context)); diff --git a/chrome/browser/renderer_context_menu/spelling_menu_observer.cc b/chrome/browser/renderer_context_menu/spelling_menu_observer.cc index 37499ed..330e583 100644 --- a/chrome/browser/renderer_context_menu/spelling_menu_observer.cc +++ b/chrome/browser/renderer_context_menu/spelling_menu_observer.cc @@ -292,7 +292,7 @@ void SpellingMenuObserver::ExecuteCommand(int command_id) { spellcheck->GetFeedbackSender()->AddedToDictionary(misspelling_hash_); } } -#if defined(USE_PLATFORM_SPELLCHECKER) +#if defined(USE_BROWSER_SPELLCHECKER) spellcheck_platform::AddWord(misspelled_word_); #endif } diff --git a/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc b/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc index 69145f1..9a538d4 100644 --- a/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc +++ b/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc @@ -97,7 +97,7 @@ SpellcheckHunspellDictionary::SpellcheckHunspellDictionary( net::URLRequestContextGetter* request_context_getter, SpellcheckService* spellcheck_service) : language_(language), - use_platform_spellchecker_(false), + use_browser_spellchecker_(false), request_context_getter_(request_context_getter), spellcheck_service_(spellcheck_service), download_status_(DOWNLOAD_NONE), @@ -110,10 +110,10 @@ SpellcheckHunspellDictionary::~SpellcheckHunspellDictionary() { void SpellcheckHunspellDictionary::Load() { DCHECK_CURRENTLY_ON(BrowserThread::UI); -#if defined(USE_PLATFORM_SPELLCHECKER) +#if defined(USE_BROWSER_SPELLCHECKER) if (spellcheck_platform::SpellCheckerAvailable() && spellcheck_platform::PlatformSupportsLanguage(language_)) { - use_platform_spellchecker_ = true; + use_browser_spellchecker_ = true; spellcheck_platform::SetLanguage(language_); base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind( @@ -121,7 +121,7 @@ void SpellcheckHunspellDictionary::Load() { weak_ptr_factory_.GetWeakPtr())); return; } -#endif // USE_PLATFORM_SPELLCHECKER +#endif // USE_BROWSER_SPELLCHECKER // Mac falls back on hunspell if its platform spellchecker isn't available. // However, Android does not support hunspell. @@ -156,7 +156,7 @@ const std::string& SpellcheckHunspellDictionary::GetLanguage() const { } bool SpellcheckHunspellDictionary::IsUsingPlatformChecker() const { - return use_platform_spellchecker_; + return use_browser_spellchecker_; } void SpellcheckHunspellDictionary::AddObserver(Observer* observer) { diff --git a/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h b/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h index 92f6b52..2a37a55 100644 --- a/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h +++ b/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h @@ -138,7 +138,7 @@ class SpellcheckHunspellDictionary std::string language_; // Whether to use the platform spellchecker instead of Hunspell. - bool use_platform_spellchecker_; + bool use_browser_spellchecker_; // Used for downloading the dictionary file. SpellcheckHunspellDictionary does // not hold a reference, and it is only valid to use it on the UI thread. diff --git a/chrome/browser/spellchecker/spellcheck_message_filter.cc b/chrome/browser/spellchecker/spellcheck_message_filter.cc index 5c39888..2cd28a1 100644 --- a/chrome/browser/spellchecker/spellcheck_message_filter.cc +++ b/chrome/browser/spellchecker/spellcheck_message_filter.cc @@ -37,7 +37,7 @@ void SpellCheckMessageFilter::OverrideThreadForMessage( message.type() == SpellCheckHostMsg_NotifyChecked::ID || message.type() == SpellCheckHostMsg_RespondDocumentMarkers::ID) *thread = BrowserThread::UI; -#if !defined(USE_PLATFORM_SPELLCHECKER) +#if !defined(USE_BROWSER_SPELLCHECKER) if (message.type() == SpellCheckHostMsg_CallSpellingService::ID) *thread = BrowserThread::UI; #endif @@ -52,7 +52,7 @@ bool SpellCheckMessageFilter::OnMessageReceived(const IPC::Message& message) { OnNotifyChecked) IPC_MESSAGE_HANDLER(SpellCheckHostMsg_RespondDocumentMarkers, OnRespondDocumentMarkers) -#if !defined(USE_PLATFORM_SPELLCHECKER) +#if !defined(USE_BROWSER_SPELLCHECKER) IPC_MESSAGE_HANDLER(SpellCheckHostMsg_CallSpellingService, OnCallSpellingService) #endif @@ -106,7 +106,7 @@ void SpellCheckMessageFilter::OnRespondDocumentMarkers( render_process_id_, markers); } -#if !defined(USE_PLATFORM_SPELLCHECKER) +#if !defined(USE_BROWSER_SPELLCHECKER) void SpellCheckMessageFilter::OnCallSpellingService( int route_id, int identifier, diff --git a/chrome/browser/spellchecker/spellcheck_message_filter_unittest.cc b/chrome/browser/spellchecker/spellcheck_message_filter_unittest.cc index bd1f49e..fb4c9fc 100644 --- a/chrome/browser/spellchecker/spellcheck_message_filter_unittest.cc +++ b/chrome/browser/spellchecker/spellcheck_message_filter_unittest.cc @@ -28,7 +28,7 @@ class TestingSpellCheckMessageFilter : public SpellCheckMessageFilter { return spellcheck_.get(); } -#if !defined(USE_PLATFORM_SPELLCHECKER) +#if !defined(USE_BROWSER_SPELLCHECKER) void OnTextCheckComplete(int route_id, int identifier, const std::vector<SpellCheckMarker>& markers, @@ -57,7 +57,7 @@ TEST(SpellCheckMessageFilterTest, TestOverrideThread) { SpellCheckHostMsg_RequestDictionary::ID, SpellCheckHostMsg_NotifyChecked::ID, SpellCheckHostMsg_RespondDocumentMarkers::ID, -#if !defined(USE_PLATFORM_SPELLCHECKER) +#if !defined(USE_BROWSER_SPELLCHECKER) SpellCheckHostMsg_CallSpellingService::ID, #endif }; @@ -74,7 +74,7 @@ TEST(SpellCheckMessageFilterTest, TestOverrideThread) { } } -#if !defined(USE_PLATFORM_SPELLCHECKER) +#if !defined(USE_BROWSER_SPELLCHECKER) TEST(SpellCheckMessageFilterTest, OnTextCheckCompleteTestCustomDictionary) { static const std::string kCustomWord = "Helllo"; static const int kRouteId = 0; diff --git a/chrome/chrome_renderer.gypi b/chrome/chrome_renderer.gypi index 467f3dd..488ca45 100644 --- a/chrome/chrome_renderer.gypi +++ b/chrome/chrome_renderer.gypi @@ -352,7 +352,7 @@ }], ], }], - ['use_platform_spellchecker==0', { + ['use_browser_spellchecker==0', { 'sources!': [ 'renderer/spellchecker/platform_spelling_engine.cc', 'renderer/spellchecker/platform_spelling_engine.h', diff --git a/chrome/common/spellcheck_messages.h b/chrome/common/spellcheck_messages.h index dd2cd8b..f4878ac 100644 --- a/chrome/common/spellcheck_messages.h +++ b/chrome/common/spellcheck_messages.h @@ -69,7 +69,7 @@ IPC_MESSAGE_CONTROL0(SpellCheckMsg_RequestDocumentMarkers) IPC_MESSAGE_CONTROL1(SpellCheckHostMsg_RespondDocumentMarkers, std::vector<uint32> /* document marker identifiers */) -#if !defined(USE_PLATFORM_SPELLCHECKER) +#if !defined(USE_BROWSER_SPELLCHECKER) // Sends text-check results from the Spelling service when the service finishes // checking text received by a SpellCheckHostMsg_CallSpellingService message. // If the service is not available, the 4th parameter should be false and the @@ -81,7 +81,7 @@ IPC_MESSAGE_ROUTED4(SpellCheckMsg_RespondSpellingService, std::vector<SpellCheckResult>) #endif -#if defined(USE_PLATFORM_SPELLCHECKER) +#if defined(USE_BROWSER_SPELLCHECKER) // This message tells the renderer to advance to the next misspelling. It is // sent when the user clicks the "Find Next" button on the spelling panel. IPC_MESSAGE_ROUTED0(SpellCheckMsg_AdvanceToNextMisspelling) @@ -109,7 +109,7 @@ IPC_MESSAGE_ROUTED2(SpellCheckHostMsg_NotifyChecked, base::string16 /* word */, bool /* true if checked word is misspelled */) -#if !defined(USE_PLATFORM_SPELLCHECKER) +#if !defined(USE_BROWSER_SPELLCHECKER) // Asks the Spelling service to check text. When the service finishes checking // the input text, it sends a SpellingCheckMsg_RespondSpellingService with // text-check results. @@ -120,7 +120,7 @@ IPC_MESSAGE_CONTROL4(SpellCheckHostMsg_CallSpellingService, std::vector<SpellCheckMarker> /* markers */) #endif -#if defined(USE_PLATFORM_SPELLCHECKER) +#if defined(USE_BROWSER_SPELLCHECKER) // Tells the browser to display or not display the SpellingPanel IPC_MESSAGE_ROUTED1(SpellCheckHostMsg_ShowSpellingPanel, bool /* if true, then show it, otherwise hide it*/) @@ -148,4 +148,4 @@ IPC_MESSAGE_CONTROL4(SpellCheckHostMsg_RequestTextCheck, IPC_MESSAGE_ROUTED2(SpellCheckHostMsg_ToggleSpellCheck, bool /* enabled */, bool /* checked */) -#endif // USE_PLATFORM_SPELLCHECKER +#endif // USE_BROWSER_SPELLCHECKER diff --git a/chrome/renderer/BUILD.gn b/chrome/renderer/BUILD.gn index 5db68a0..29627ca 100644 --- a/chrome/renderer/BUILD.gn +++ b/chrome/renderer/BUILD.gn @@ -145,7 +145,7 @@ static_library("renderer") { deps += [ "//third_party/hunspell" ] } } - if (!use_platform_spellchecker) { + if (!use_browser_spellchecker) { sources -= [ "spellchecker/platform_spelling_engine.cc", "spellchecker/platform_spelling_engine.h", diff --git a/chrome/renderer/spellchecker/hunspell_engine.cc b/chrome/renderer/spellchecker/hunspell_engine.cc index f50f860..34934fc 100644 --- a/chrome/renderer/spellchecker/hunspell_engine.cc +++ b/chrome/renderer/spellchecker/hunspell_engine.cc @@ -31,7 +31,7 @@ namespace { "MaxSuggestLen too long"); } // namespace -#if !defined(USE_PLATFORM_SPELLCHECKER) +#if !defined(USE_BROWSER_SPELLCHECKER) SpellingEngine* CreateNativeSpellingEngine() { return new HunspellEngine(); } diff --git a/chrome/renderer/spellchecker/spellcheck_provider.cc b/chrome/renderer/spellchecker/spellcheck_provider.cc index 1330114..001484e 100644 --- a/chrome/renderer/spellchecker/spellcheck_provider.cc +++ b/chrome/renderer/spellchecker/spellcheck_provider.cc @@ -73,7 +73,7 @@ void SpellCheckProvider::RequestTextChecking( last_request_.clear(); last_results_.assign(blink::WebVector<blink::WebTextCheckingResult>()); -#if defined(USE_PLATFORM_SPELLCHECKER) +#if defined(USE_BROWSER_SPELLCHECKER) // Text check (unified request for grammar and spell check) is only // available for browser process, so we ask the system spellchecker // over IPC or return an empty result if the checker is not @@ -89,17 +89,17 @@ void SpellCheckProvider::RequestTextChecking( text_check_completions_.Add(completion), base::string16(text), markers)); -#endif // !USE_PLATFORM_SPELLCHECKER +#endif // !USE_BROWSER_SPELLCHECKER } bool SpellCheckProvider::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(SpellCheckProvider, message) -#if !defined(USE_PLATFORM_SPELLCHECKER) +#if !defined(USE_BROWSER_SPELLCHECKER) IPC_MESSAGE_HANDLER(SpellCheckMsg_RespondSpellingService, OnRespondSpellingService) #endif -#if defined(USE_PLATFORM_SPELLCHECKER) +#if defined(USE_BROWSER_SPELLCHECKER) IPC_MESSAGE_HANDLER(SpellCheckMsg_AdvanceToNextMisspelling, OnAdvanceToNextMisspelling) IPC_MESSAGE_HANDLER(SpellCheckMsg_RespondTextCheck, OnRespondTextCheck) @@ -111,7 +111,7 @@ bool SpellCheckProvider::OnMessageReceived(const IPC::Message& message) { } void SpellCheckProvider::FocusedNodeChanged(const blink::WebNode& unused) { -#if defined(USE_PLATFORM_SPELLCHECKER) +#if defined(USE_BROWSER_SPELLCHECKER) WebFrame* frame = render_view()->GetWebView()->focusedFrame(); WebElement element = frame->document().isNull() ? WebElement() : frame->document().focusedElement(); @@ -121,7 +121,7 @@ void SpellCheckProvider::FocusedNodeChanged(const blink::WebNode& unused) { frame->isContinuousSpellCheckingEnabled(); Send(new SpellCheckHostMsg_ToggleSpellCheck(routing_id(), enabled, checked)); -#endif // USE_PLATFORM_SPELLCHECKER +#endif // USE_BROWSER_SPELLCHECKER } void SpellCheckProvider::spellCheck( @@ -187,7 +187,7 @@ WebString SpellCheckProvider::autoCorrectWord(const WebString& word) { } void SpellCheckProvider::showSpellingUI(bool show) { -#if defined(USE_PLATFORM_SPELLCHECKER) +#if defined(USE_BROWSER_SPELLCHECKER) UMA_HISTOGRAM_BOOLEAN("SpellCheck.api.showUI", show); Send(new SpellCheckHostMsg_ShowSpellingPanel(routing_id(), show)); #endif @@ -199,13 +199,13 @@ bool SpellCheckProvider::isShowingSpellingUI() { void SpellCheckProvider::updateSpellingUIWithMisspelledWord( const WebString& word) { -#if defined(USE_PLATFORM_SPELLCHECKER) +#if defined(USE_BROWSER_SPELLCHECKER) Send(new SpellCheckHostMsg_UpdateSpellingPanelWithMisspelledWord(routing_id(), word)); #endif } -#if !defined(USE_PLATFORM_SPELLCHECKER) +#if !defined(USE_BROWSER_SPELLCHECKER) void SpellCheckProvider::OnRespondSpellingService( int identifier, bool succeeded, @@ -254,7 +254,7 @@ bool SpellCheckProvider::HasWordCharacters( return false; } -#if defined(USE_PLATFORM_SPELLCHECKER) +#if defined(USE_BROWSER_SPELLCHECKER) void SpellCheckProvider::OnAdvanceToNextMisspelling() { if (!render_view()->GetWebView()) return; diff --git a/chrome/renderer/spellchecker/spellcheck_provider.h b/chrome/renderer/spellchecker/spellcheck_provider.h index 2ad9e30..a1838d0 100644 --- a/chrome/renderer/spellchecker/spellcheck_provider.h +++ b/chrome/renderer/spellchecker/spellcheck_provider.h @@ -91,7 +91,7 @@ class SpellCheckProvider void updateSpellingUIWithMisspelledWord( const blink::WebString& word) override; -#if !defined(USE_PLATFORM_SPELLCHECKER) +#if !defined(USE_BROWSER_SPELLCHECKER) void OnRespondSpellingService( int identifier, bool succeeded, @@ -103,7 +103,7 @@ class SpellCheckProvider // needs to check this text. bool HasWordCharacters(const base::string16& text, int index) const; -#if defined(USE_PLATFORM_SPELLCHECKER) +#if defined(USE_BROWSER_SPELLCHECKER) void OnAdvanceToNextMisspelling(); void OnRespondTextCheck( int identifier, diff --git a/chrome/renderer/spellchecker/spellcheck_provider_test.cc b/chrome/renderer/spellchecker/spellcheck_provider_test.cc index 9cbba2c..b655940 100644 --- a/chrome/renderer/spellchecker/spellcheck_provider_test.cc +++ b/chrome/renderer/spellchecker/spellcheck_provider_test.cc @@ -40,7 +40,7 @@ TestingSpellCheckProvider::~TestingSpellCheckProvider() { } bool TestingSpellCheckProvider::Send(IPC::Message* message) { -#if !defined(USE_PLATFORM_SPELLCHECKER) +#if !defined(USE_BROWSER_SPELLCHECKER) // Call our mock message handlers. bool handled = true; IPC_BEGIN_MESSAGE_MAP(TestingSpellCheckProvider, *message) @@ -63,7 +63,7 @@ void TestingSpellCheckProvider::OnCallSpellingService(int route_id, int identifier, const base::string16& text, const std::vector<SpellCheckMarker>& markers) { -#if defined (USE_PLATFORM_SPELLCHECKER) +#if defined (USE_BROWSER_SPELLCHECKER) NOTREACHED(); #else ++spelling_service_call_count_; |