OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/renderer_context_menu/spelling_options_submenu_observer
.h" | 5 #include "chrome/browser/renderer_context_menu/spelling_options_submenu_observer
.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 IDC_SPELLCHECK_LANGUAGES_FIRST + i, | 59 IDC_SPELLCHECK_LANGUAGES_FIRST + i, |
60 l10n_util::GetDisplayNameForLocale(dictionaries_[i].language, | 60 l10n_util::GetDisplayNameForLocale(dictionaries_[i].language, |
61 app_locale, true), | 61 app_locale, true), |
62 language_group_id_); | 62 language_group_id_); |
63 if (dictionaries_[i].used_for_spellcheck) | 63 if (dictionaries_[i].used_for_spellcheck) |
64 ++num_selected_dictionaries_; | 64 ++num_selected_dictionaries_; |
65 } | 65 } |
66 | 66 |
67 // Add an item that opens the 'Settings - Languages' page. This item is | 67 // Add an item that opens the 'Settings - Languages' page. This item is |
68 // handled in RenderViewContextMenu. | 68 // handled in RenderViewContextMenu. |
69 submenu_model_.AddSeparator(ui::NORMAL_SEPARATOR); | |
70 submenu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_LANGUAGE_SETTINGS, | 69 submenu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_LANGUAGE_SETTINGS, |
71 IDS_CONTENT_CONTEXT_LANGUAGE_SETTINGS); | 70 IDS_CONTENT_CONTEXT_LANGUAGE_SETTINGS); |
| 71 submenu_model_.AddSeparator(ui::NORMAL_SEPARATOR); |
72 | 72 |
73 if (num_selected_dictionaries_ > 0) { | 73 if (num_selected_dictionaries_ > 0) { |
74 // Add a 'Check spelling while typing' item in the sub menu. | 74 // Add a 'Check spelling while typing' item in the sub menu. |
75 submenu_model_.AddCheckItem( | 75 submenu_model_.AddCheckItem( |
76 IDC_CHECK_SPELLING_WHILE_TYPING, | 76 IDC_CHECK_SPELLING_WHILE_TYPING, |
77 l10n_util::GetStringUTF16( | 77 l10n_util::GetStringUTF16( |
78 IDS_CONTENT_CONTEXT_CHECK_SPELLING_WHILE_TYPING)); | 78 IDS_CONTENT_CONTEXT_CHECK_SPELLING_WHILE_TYPING)); |
79 } | 79 } |
80 | 80 |
81 // Add a check item 'Ask Google for spelling suggestions'. This item is | 81 // Add a check item 'Ask Google for spelling suggestions'. This item is |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 StringListPrefMember dictionaries_pref; | 184 StringListPrefMember dictionaries_pref; |
185 dictionaries_pref.Init(prefs::kSpellCheckDictionaries, | 185 dictionaries_pref.Init(prefs::kSpellCheckDictionaries, |
186 profile->GetPrefs()); | 186 profile->GetPrefs()); |
187 std::vector<std::string> all_languages; | 187 std::vector<std::string> all_languages; |
188 for (const auto& dictionary : dictionaries_) | 188 for (const auto& dictionary : dictionaries_) |
189 all_languages.push_back(dictionary.language); | 189 all_languages.push_back(dictionary.language); |
190 dictionaries_pref.SetValue(all_languages); | 190 dictionaries_pref.SetValue(all_languages); |
191 break; | 191 break; |
192 } | 192 } |
193 } | 193 } |
OLD | NEW |