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

Side by Side Diff: third_party/WebKit/Source/core/page/ContextMenuClient.cpp

Issue 2978823002: [SelectMiss...Async #2] Change ContextMenuClient::SelectMisspellingAsync() to return pair of strings (Closed)
Patch Set: Rebase Created 3 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
« no previous file with comments | « third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 } 353 }
354 } 354 }
355 355
356 if (r.IsContentEditable()) { 356 if (r.IsContentEditable()) {
357 data.is_editable = true; 357 data.is_editable = true;
358 358
359 // Spellchecker adds spelling markers to misspelled words and attaches 359 // Spellchecker adds spelling markers to misspelled words and attaches
360 // suggestions to these markers in the background. Therefore, when a 360 // suggestions to these markers in the background. Therefore, when a
361 // user right-clicks a mouse on a word, Chrome just needs to find a 361 // user right-clicks a mouse on a word, Chrome just needs to find a
362 // spelling marker on the word instead of spellchecking it. 362 // spelling marker on the word instead of spellchecking it.
363 String description; 363 std::pair<String, String> misspelled_word_and_description =
364 data.misspelled_word = 364 selected_frame->GetSpellChecker().SelectMisspellingAsync();
365 selected_frame->GetSpellChecker().SelectMisspellingAsync(description); 365 data.misspelled_word = misspelled_word_and_description.first;
366 const String& description = misspelled_word_and_description.second;
366 if (description.length()) { 367 if (description.length()) {
367 Vector<String> suggestions; 368 Vector<String> suggestions;
368 description.Split('\n', suggestions); 369 description.Split('\n', suggestions);
369 data.dictionary_suggestions = suggestions; 370 data.dictionary_suggestions = suggestions;
370 } else if (selected_web_frame->TextCheckClient()) { 371 } else if (selected_web_frame->TextCheckClient()) {
371 int misspelled_offset, misspelled_length; 372 int misspelled_offset, misspelled_length;
372 selected_web_frame->TextCheckClient()->CheckSpelling( 373 selected_web_frame->TextCheckClient()->CheckSpelling(
373 data.misspelled_word, misspelled_offset, misspelled_length, 374 data.misspelled_word, misspelled_offset, misspelled_length,
374 &data.dictionary_suggestions); 375 &data.dictionary_suggestions);
375 } 376 }
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 output_items[i] = sub_items[i]; 509 output_items[i] = sub_items[i];
509 sub_menu_items.Swap(output_items); 510 sub_menu_items.Swap(output_items);
510 } 511 }
511 512
512 void ContextMenuClient::PopulateCustomMenuItems(const ContextMenu* default_menu, 513 void ContextMenuClient::PopulateCustomMenuItems(const ContextMenu* default_menu,
513 WebContextMenuData* data) { 514 WebContextMenuData* data) {
514 PopulateSubMenuItems(default_menu->Items(), data->custom_items); 515 PopulateSubMenuItems(default_menu->Items(), data->custom_items);
515 } 516 }
516 517
517 } // namespace blink 518 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698