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

Side by Side Diff: chrome/browser/gtk/options/languages_page_gtk.cc

Issue 395007: Move Mac to using renderer spellchecker. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: ui test fix Created 11 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/gtk/browser_actions_toolbar_gtk.cc ('k') | chrome/browser/profile.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/gtk/options/languages_page_gtk.h" 5 #include "chrome/browser/gtk/options/languages_page_gtk.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 9
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/language_combobox_model.h" 14 #include "chrome/browser/language_combobox_model.h"
15 #include "chrome/browser/language_order_table_model.h" 15 #include "chrome/browser/language_order_table_model.h"
16 #include "chrome/browser/spellchecker.h"
17 #include "chrome/common/chrome_switches.h" 16 #include "chrome/common/chrome_switches.h"
18 #include "chrome/common/gtk_util.h" 17 #include "chrome/common/gtk_util.h"
19 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
19 #include "chrome/common/spellcheck_common.h"
20 #include "grit/generated_resources.h" 20 #include "grit/generated_resources.h"
21 21
22 namespace { 22 namespace {
23 23
24 const int kWrapWidth = 475; 24 const int kWrapWidth = 475;
25 25
26 GtkWidget* NewComboboxFromModel(ComboboxModel* model) { 26 GtkWidget* NewComboboxFromModel(ComboboxModel* model) {
27 GtkWidget* combobox = gtk_combo_box_new_text(); 27 GtkWidget* combobox = gtk_combo_box_new_text();
28 int count = model->GetItemCount(); 28 int count = model->GetItemCount();
29 for (int i = 0; i < count; ++i) 29 for (int i = 0; i < count; ++i)
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 enable_autospellcorrect_checkbox_ = gtk_check_button_new_with_label( 239 enable_autospellcorrect_checkbox_ = gtk_check_button_new_with_label(
240 l10n_util::GetStringUTF8( 240 l10n_util::GetStringUTF8(
241 IDS_OPTIONS_ENABLE_AUTO_SPELL_CORRECTION).c_str()); 241 IDS_OPTIONS_ENABLE_AUTO_SPELL_CORRECTION).c_str());
242 g_signal_connect(G_OBJECT(enable_autospellcorrect_checkbox_), "toggled", 242 g_signal_connect(G_OBJECT(enable_autospellcorrect_checkbox_), "toggled",
243 G_CALLBACK(OnEnableAutoSpellCheckingToggled), this); 243 G_CALLBACK(OnEnableAutoSpellCheckingToggled), this);
244 gtk_box_pack_start(GTK_BOX(spellchecker_vbox), 244 gtk_box_pack_start(GTK_BOX(spellchecker_vbox),
245 enable_autospellcorrect_checkbox_, FALSE, FALSE, 0); 245 enable_autospellcorrect_checkbox_, FALSE, FALSE, 0);
246 } 246 }
247 247
248 std::vector<std::string> spell_check_languages; 248 std::vector<std::string> spell_check_languages;
249 SpellChecker::SpellCheckLanguages(&spell_check_languages); 249 SpellCheckCommon::SpellCheckLanguages(&spell_check_languages);
250 dictionary_language_model_.reset(new LanguageComboboxModel(profile(), 250 dictionary_language_model_.reset(new LanguageComboboxModel(profile(),
251 spell_check_languages)); 251 spell_check_languages));
252 dictionary_language_combobox_ = NewComboboxFromModel( 252 dictionary_language_combobox_ = NewComboboxFromModel(
253 dictionary_language_model_.get()); 253 dictionary_language_model_.get());
254 g_signal_connect(G_OBJECT(dictionary_language_combobox_), "changed", 254 g_signal_connect(G_OBJECT(dictionary_language_combobox_), "changed",
255 G_CALLBACK(OnDictionaryLanguageChangedThunk), this); 255 G_CALLBACK(OnDictionaryLanguageChangedThunk), this);
256 GtkWidget* dictionary_language_control = 256 GtkWidget* dictionary_language_control =
257 gtk_util::CreateLabeledControlsGroup(NULL, 257 gtk_util::CreateLabeledControlsGroup(NULL,
258 l10n_util::GetStringUTF8( 258 l10n_util::GetStringUTF8(
259 IDS_OPTIONS_CHROME_DICTIONARY_LANGUAGE).c_str(), 259 IDS_OPTIONS_CHROME_DICTIONARY_LANGUAGE).c_str(),
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 } 323 }
324 if (!pref_name || *pref_name == prefs::kSpellCheckDictionary) { 324 if (!pref_name || *pref_name == prefs::kSpellCheckDictionary) {
325 int index = dictionary_language_model_->GetSelectedLanguageIndex( 325 int index = dictionary_language_model_->GetSelectedLanguageIndex(
326 prefs::kSpellCheckDictionary); 326 prefs::kSpellCheckDictionary);
327 327
328 // If not found, fall back from "language-region" to "language". 328 // If not found, fall back from "language-region" to "language".
329 if (index < 0) { 329 if (index < 0) {
330 const std::string& lang_region = WideToASCII( 330 const std::string& lang_region = WideToASCII(
331 dictionary_language_.GetValue()); 331 dictionary_language_.GetValue());
332 dictionary_language_.SetValue(ASCIIToWide( 332 dictionary_language_.SetValue(ASCIIToWide(
333 SpellChecker::GetLanguageFromLanguageRegion(lang_region))); 333 SpellCheckCommon::GetLanguageFromLanguageRegion(lang_region)));
334 index = dictionary_language_model_->GetSelectedLanguageIndex( 334 index = dictionary_language_model_->GetSelectedLanguageIndex(
335 prefs::kSpellCheckDictionary); 335 prefs::kSpellCheckDictionary);
336 } 336 }
337 337
338 gtk_combo_box_set_active(GTK_COMBO_BOX(dictionary_language_combobox_), 338 gtk_combo_box_set_active(GTK_COMBO_BOX(dictionary_language_combobox_),
339 index); 339 index);
340 } 340 }
341 if (!pref_name || *pref_name == prefs::kEnableSpellCheck) { 341 if (!pref_name || *pref_name == prefs::kEnableSpellCheck) {
342 gtk_toggle_button_set_active( 342 gtk_toggle_button_set_active(
343 GTK_TOGGLE_BUTTON(enable_spellchecking_checkbox_), 343 GTK_TOGGLE_BUTTON(enable_spellchecking_checkbox_),
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 OnAddLanguage(language); 475 OnAddLanguage(language);
476 spellcheck_language_added_ = language; 476 spellcheck_language_added_ = language;
477 } else { 477 } else {
478 spellcheck_language_added_ = ""; 478 spellcheck_language_added_ = "";
479 } 479 }
480 480
481 UserMetricsRecordAction("Options_DictionaryLanguage", 481 UserMetricsRecordAction("Options_DictionaryLanguage",
482 profile()->GetPrefs()); 482 profile()->GetPrefs());
483 dictionary_language_.SetValue(ASCIIToWide(language)); 483 dictionary_language_.SetValue(ASCIIToWide(language));
484 } 484 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/browser_actions_toolbar_gtk.cc ('k') | chrome/browser/profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698