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

Side by Side Diff: chrome/renderer/render_view.cc

Issue 397017: reland 31875. Revert was:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' 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/renderer/render_thread.cc ('k') | chrome/renderer/spellchecker/spellcheck.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 #if defined(ENABLE_PEPPER) 5 #if defined(ENABLE_PEPPER)
6 #define PEPPER_APIS_ENABLED 6 #define PEPPER_APIS_ENABLED
7 #endif 7 #endif
8 8
9 #include "chrome/renderer/render_view.h" 9 #include "chrome/renderer/render_view.h"
10 10
(...skipping 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after
1498 return did_execute_command; 1498 return did_execute_command;
1499 } 1499 }
1500 1500
1501 void RenderView::spellCheck(const WebString& text, 1501 void RenderView::spellCheck(const WebString& text,
1502 int& misspelled_offset, 1502 int& misspelled_offset,
1503 int& misspelled_length) { 1503 int& misspelled_length) {
1504 EnsureDocumentTag(); 1504 EnsureDocumentTag();
1505 1505
1506 #if defined(SPELLCHECKER_IN_RENDERER) 1506 #if defined(SPELLCHECKER_IN_RENDERER)
1507 string16 word(text); 1507 string16 word(text);
1508 RenderThread::current()->spellchecker()->SpellCheckWord( 1508 RenderThread* thread = RenderThread::current();
1509 word.c_str(), word.size(), document_tag_, 1509 // Will be NULL during unit tests.
1510 &misspelled_offset, &misspelled_length, NULL); 1510 if (thread) {
1511 RenderThread::current()->spellchecker()->SpellCheckWord(
1512 word.c_str(), word.size(), document_tag_,
1513 &misspelled_offset, &misspelled_length, NULL);
1514 }
1511 #else 1515 #else
1512 Send(new ViewHostMsg_SpellCheck(routing_id_, text, document_tag_, 1516 Send(new ViewHostMsg_SpellCheck(routing_id_, text, document_tag_,
1513 &misspelled_offset, &misspelled_length)); 1517 &misspelled_offset, &misspelled_length));
1514 #endif 1518 #endif
1515 } 1519 }
1516 1520
1517 WebString RenderView::autoCorrectWord(const WebKit::WebString& word) { 1521 WebString RenderView::autoCorrectWord(const WebKit::WebString& word) {
1518 string16 autocorrect_word; 1522 string16 autocorrect_word;
1519 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 1523 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
1520 if (command_line.HasSwitch(switches::kExperimentalSpellcheckerFeatures)) { 1524 if (command_line.HasSwitch(switches::kExperimentalSpellcheckerFeatures)) {
1521 EnsureDocumentTag(); 1525 EnsureDocumentTag();
1522 #if defined(SPELLCHECKER_IN_RENDERER) 1526 #if defined(SPELLCHECKER_IN_RENDERER)
1523 autocorrect_word = 1527 RenderThread* thread = RenderThread::current();
1524 RenderThread::current()->spellchecker()->GetAutoCorrectionWord( 1528 // Will be NULL during unit tests.
1525 word, document_tag_); 1529 if (thread) {
1530 autocorrect_word =
1531 RenderThread::current()->spellchecker()->GetAutoCorrectionWord(
1532 word, document_tag_);
1533 }
1526 #else 1534 #else
1527 Send(new ViewHostMsg_GetAutoCorrectWord( 1535 Send(new ViewHostMsg_GetAutoCorrectWord(
1528 routing_id_, word, document_tag_, &autocorrect_word)); 1536 routing_id_, word, document_tag_, &autocorrect_word));
1529 #endif 1537 #endif
1530 } 1538 }
1531 return autocorrect_word; 1539 return autocorrect_word;
1532 } 1540 }
1533 1541
1534 void RenderView::showSpellingUI(bool show) { 1542 void RenderView::showSpellingUI(bool show) {
1535 Send(new ViewHostMsg_ShowSpellingPanel(routing_id_, show)); 1543 Send(new ViewHostMsg_ShowSpellingPanel(routing_id_, show));
(...skipping 2295 matching lines...) Expand 10 before | Expand all | Expand 10 after
3831 new PluginMsg_SignalModalDialogEvent(host_window_)); 3839 new PluginMsg_SignalModalDialogEvent(host_window_));
3832 3840
3833 message->EnableMessagePumping(); // Runs a nested message loop. 3841 message->EnableMessagePumping(); // Runs a nested message loop.
3834 bool rv = Send(message); 3842 bool rv = Send(message);
3835 3843
3836 PluginChannelHost::Broadcast( 3844 PluginChannelHost::Broadcast(
3837 new PluginMsg_ResetModalDialogEvent(host_window_)); 3845 new PluginMsg_ResetModalDialogEvent(host_window_));
3838 3846
3839 return rv; 3847 return rv;
3840 } 3848 }
OLDNEW
« no previous file with comments | « chrome/renderer/render_thread.cc ('k') | chrome/renderer/spellchecker/spellcheck.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698