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

Side by Side Diff: chrome/browser/tab_contents/render_view_context_menu.cc

Issue 150139: [chromium-reviews] Change the use of "Language" in Spell Check files to "SpellCheckLanguage". "L... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/tab_contents/render_view_context_menu.h" 5 #include "chrome/browser/tab_contents/render_view_context_menu.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/clipboard.h" 8 #include "base/clipboard.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 AppendMenuItem(IDS_CONTENT_CONTEXT_COPY); 175 AppendMenuItem(IDS_CONTENT_CONTEXT_COPY);
176 AppendMenuItem(IDS_CONTENT_CONTEXT_PASTE); 176 AppendMenuItem(IDS_CONTENT_CONTEXT_PASTE);
177 AppendMenuItem(IDS_CONTENT_CONTEXT_DELETE); 177 AppendMenuItem(IDS_CONTENT_CONTEXT_DELETE);
178 AppendSeparator(); 178 AppendSeparator();
179 179
180 // Add Spell Check options sub menu. 180 // Add Spell Check options sub menu.
181 StartSubMenu(IDC_SPELLCHECK_MENU, 181 StartSubMenu(IDC_SPELLCHECK_MENU,
182 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLCHECK_MENU)); 182 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLCHECK_MENU));
183 183
184 // Add Spell Check languages to sub menu. 184 // Add Spell Check languages to sub menu.
185 SpellChecker::Languages spellcheck_languages; 185 std::vector<std::string> spellcheck_languages;
186 SpellChecker::GetSpellCheckLanguages(profile_, 186 SpellChecker::GetSpellCheckLanguages(profile_,
187 &spellcheck_languages); 187 &spellcheck_languages);
188 DCHECK(spellcheck_languages.size() < 188 DCHECK(spellcheck_languages.size() <
189 IDC_SPELLCHECK_LANGUAGES_LAST - IDC_SPELLCHECK_LANGUAGES_FIRST); 189 IDC_SPELLCHECK_LANGUAGES_LAST - IDC_SPELLCHECK_LANGUAGES_FIRST);
190 const std::string app_locale = g_browser_process->GetApplicationLocale(); 190 const std::string app_locale = g_browser_process->GetApplicationLocale();
191 for (size_t i = 0; i < spellcheck_languages.size(); ++i) { 191 for (size_t i = 0; i < spellcheck_languages.size(); ++i) {
192 string16 display_name(l10n_util::GetDisplayNameForLocale( 192 string16 display_name(l10n_util::GetDisplayNameForLocale(
193 spellcheck_languages[i], app_locale, true)); 193 spellcheck_languages[i], app_locale, true));
194 AppendRadioMenuItem(IDC_SPELLCHECK_LANGUAGES_FIRST + i, display_name); 194 AppendRadioMenuItem(IDC_SPELLCHECK_LANGUAGES_FIRST + i, display_name);
195 } 195 }
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 return (params_.spellcheck_enabled && 329 return (params_.spellcheck_enabled &&
330 profile_->GetPrefs()->GetBoolean(prefs::kEnableSpellCheck)); 330 profile_->GetPrefs()->GetBoolean(prefs::kEnableSpellCheck));
331 } 331 }
332 332
333 // Don't bother getting the display language vector if this isn't a spellcheck 333 // Don't bother getting the display language vector if this isn't a spellcheck
334 // language. 334 // language.
335 if ((id < IDC_SPELLCHECK_LANGUAGES_FIRST) || 335 if ((id < IDC_SPELLCHECK_LANGUAGES_FIRST) ||
336 (id >= IDC_SPELLCHECK_LANGUAGES_LAST)) 336 (id >= IDC_SPELLCHECK_LANGUAGES_LAST))
337 return false; 337 return false;
338 338
339 SpellChecker::Languages languages; 339 std::vector<std::string> languages;
340 return SpellChecker::GetSpellCheckLanguages(profile_, &languages) == 340 return SpellChecker::GetSpellCheckLanguages(profile_, &languages) ==
341 (id - IDC_SPELLCHECK_LANGUAGES_FIRST); 341 (id - IDC_SPELLCHECK_LANGUAGES_FIRST);
342 } 342 }
343 343
344 void RenderViewContextMenu::ExecuteItemCommand(int id) { 344 void RenderViewContextMenu::ExecuteItemCommand(int id) {
345 // Check to see if one of the spell check language ids have been clicked. 345 // Check to see if one of the spell check language ids have been clicked.
346 if (id >= IDC_SPELLCHECK_LANGUAGES_FIRST && 346 if (id >= IDC_SPELLCHECK_LANGUAGES_FIRST &&
347 id < IDC_SPELLCHECK_LANGUAGES_LAST) { 347 id < IDC_SPELLCHECK_LANGUAGES_LAST) {
348 const size_t language_number = id - IDC_SPELLCHECK_LANGUAGES_FIRST; 348 const size_t language_number = id - IDC_SPELLCHECK_LANGUAGES_FIRST;
349 SpellChecker::Languages languages; 349 std::vector<std::string> languages;
350 SpellChecker::GetSpellCheckLanguages(profile_, &languages); 350 SpellChecker::GetSpellCheckLanguages(profile_, &languages);
351 if (language_number < languages.size()) { 351 if (language_number < languages.size()) {
352 StringPrefMember dictionary_language; 352 StringPrefMember dictionary_language;
353 dictionary_language.Init(prefs::kSpellCheckDictionary, 353 dictionary_language.Init(prefs::kSpellCheckDictionary,
354 profile_->GetPrefs(), NULL); 354 profile_->GetPrefs(), NULL);
355 dictionary_language.SetValue(ASCIIToWide(languages[language_number])); 355 dictionary_language.SetValue(ASCIIToWide(languages[language_number]));
356 } 356 }
357 357
358 return; 358 return;
359 } 359 }
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 // applications may not enocode non-ASCII characters in UTF-8. 649 // applications may not enocode non-ASCII characters in UTF-8.
650 // So the 4th parameter of net::FormatUrl() should be false. 650 // So the 4th parameter of net::FormatUrl() should be false.
651 // See crbug.com/2820. 651 // See crbug.com/2820.
652 WideToUTF8(net::FormatUrl( 652 WideToUTF8(net::FormatUrl(
653 url, profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), 653 url, profile_->GetPrefs()->GetString(prefs::kAcceptLanguages),
654 false, UnescapeRule::NONE, NULL, NULL)); 654 false, UnescapeRule::NONE, NULL, NULL));
655 655
656 WriteTextToClipboard(UTF8ToUTF16(utf8_text)); 656 WriteTextToClipboard(UTF8ToUTF16(utf8_text));
657 DidWriteURLToClipboard(utf8_text); 657 DidWriteURLToClipboard(utf8_text);
658 } 658 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698