Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(680)

Side by Side Diff: chrome/browser/spellchecker/spellcheck_service.cc

Issue 1602303002: [mac] Send the system spellchecker language to the renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/spellchecker/spellcheck_service.h" 5 #include "chrome/browser/spellchecker/spellcheck_service.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/prefs/pref_member.h" 8 #include "base/prefs/pref_member.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } 74 }
75 75
76 // If a user goes back to single language spellchecking make sure there is 76 // If a user goes back to single language spellchecking make sure there is
77 // only one language in the dictionaries preference. 77 // only one language in the dictionaries preference.
78 if (!chrome::spellcheck_common::IsMultilingualSpellcheckEnabled() && 78 if (!chrome::spellcheck_common::IsMultilingualSpellcheckEnabled() &&
79 dictionaries_pref.GetValue().size() > 1) { 79 dictionaries_pref.GetValue().size() > 1) {
80 dictionaries_pref.SetValue( 80 dictionaries_pref.SetValue(
81 std::vector<std::string>(1, first_of_dictionaries)); 81 std::vector<std::string>(1, first_of_dictionaries));
82 } 82 }
83 83
84 #if defined(USE_BROWSER_SPELLCHECKER)
85 if (dictionaries_pref.GetValue().empty()) {
groby-ooo-7-16 2016/01/19 23:54:14 Do we really want to mess with prefs here? What ha
please use gerrit instead 2016/01/20 02:25:59 Yes, because the spelling service client is using
86 std::string language = spellcheck_platform::GetSpellCheckerLanguage();
87 if (!language.empty())
88 dictionaries_pref.SetValue(std::vector<std::string>(1, language));
89 }
90 #endif
91
84 std::string language_code; 92 std::string language_code;
85 std::string country_code; 93 std::string country_code;
86 chrome::spellcheck_common::GetISOLanguageCountryCodeFromLocale( 94 chrome::spellcheck_common::GetISOLanguageCountryCodeFromLocale(
87 first_of_dictionaries, 95 first_of_dictionaries,
88 &language_code, 96 &language_code,
89 &country_code); 97 &country_code);
90 feedback_sender_.reset(new spellcheck::FeedbackSender( 98 feedback_sender_.reset(new spellcheck::FeedbackSender(
91 context->GetRequestContext(), language_code, country_code)); 99 context->GetRequestContext(), language_code, country_code));
92 100
93 pref_change_registrar_.Add( 101 pref_change_registrar_.Add(
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 } 343 }
336 344
337 void SpellcheckService::UpdateFeedbackSenderState() { 345 void SpellcheckService::UpdateFeedbackSenderState() {
338 if (SpellingServiceClient::IsAvailable( 346 if (SpellingServiceClient::IsAvailable(
339 context_, SpellingServiceClient::SPELLCHECK)) { 347 context_, SpellingServiceClient::SPELLCHECK)) {
340 feedback_sender_->StartFeedbackCollection(); 348 feedback_sender_->StartFeedbackCollection();
341 } else { 349 } else {
342 feedback_sender_->StopFeedbackCollection(); 350 feedback_sender_->StopFeedbackCollection();
343 } 351 }
344 } 352 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698