| OLD | NEW |
| 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 Loading... |
| 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* thread = RenderThread::current(); | 1508 RenderThread::current()->spellchecker()->SpellCheckWord( |
| 1509 // Will be NULL during unit tests. | 1509 word.c_str(), word.size(), document_tag_, |
| 1510 if (thread) { | 1510 &misspelled_offset, &misspelled_length, NULL); |
| 1511 RenderThread::current()->spellchecker()->SpellCheckWord( | |
| 1512 word.c_str(), word.size(), document_tag_, | |
| 1513 &misspelled_offset, &misspelled_length, NULL); | |
| 1514 } | |
| 1515 #else | 1511 #else |
| 1516 Send(new ViewHostMsg_SpellCheck(routing_id_, text, document_tag_, | 1512 Send(new ViewHostMsg_SpellCheck(routing_id_, text, document_tag_, |
| 1517 &misspelled_offset, &misspelled_length)); | 1513 &misspelled_offset, &misspelled_length)); |
| 1518 #endif | 1514 #endif |
| 1519 } | 1515 } |
| 1520 | 1516 |
| 1521 WebString RenderView::autoCorrectWord(const WebKit::WebString& word) { | 1517 WebString RenderView::autoCorrectWord(const WebKit::WebString& word) { |
| 1522 string16 autocorrect_word; | 1518 string16 autocorrect_word; |
| 1523 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 1519 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 1524 if (command_line.HasSwitch(switches::kExperimentalSpellcheckerFeatures)) { | 1520 if (command_line.HasSwitch(switches::kExperimentalSpellcheckerFeatures)) { |
| 1525 EnsureDocumentTag(); | 1521 EnsureDocumentTag(); |
| 1526 #if defined(SPELLCHECKER_IN_RENDERER) | 1522 #if defined(SPELLCHECKER_IN_RENDERER) |
| 1527 RenderThread* thread = RenderThread::current(); | 1523 autocorrect_word = |
| 1528 // Will be NULL during unit tests. | 1524 RenderThread::current()->spellchecker()->GetAutoCorrectionWord( |
| 1529 if (thread) { | 1525 word, document_tag_); |
| 1530 autocorrect_word = | |
| 1531 RenderThread::current()->spellchecker()->GetAutoCorrectionWord( | |
| 1532 word, document_tag_); | |
| 1533 } | |
| 1534 #else | 1526 #else |
| 1535 Send(new ViewHostMsg_GetAutoCorrectWord( | 1527 Send(new ViewHostMsg_GetAutoCorrectWord( |
| 1536 routing_id_, word, document_tag_, &autocorrect_word)); | 1528 routing_id_, word, document_tag_, &autocorrect_word)); |
| 1537 #endif | 1529 #endif |
| 1538 } | 1530 } |
| 1539 return autocorrect_word; | 1531 return autocorrect_word; |
| 1540 } | 1532 } |
| 1541 | 1533 |
| 1542 void RenderView::showSpellingUI(bool show) { | 1534 void RenderView::showSpellingUI(bool show) { |
| 1543 Send(new ViewHostMsg_ShowSpellingPanel(routing_id_, show)); | 1535 Send(new ViewHostMsg_ShowSpellingPanel(routing_id_, show)); |
| (...skipping 2295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3839 new PluginMsg_SignalModalDialogEvent(host_window_)); | 3831 new PluginMsg_SignalModalDialogEvent(host_window_)); |
| 3840 | 3832 |
| 3841 message->EnableMessagePumping(); // Runs a nested message loop. | 3833 message->EnableMessagePumping(); // Runs a nested message loop. |
| 3842 bool rv = Send(message); | 3834 bool rv = Send(message); |
| 3843 | 3835 |
| 3844 PluginChannelHost::Broadcast( | 3836 PluginChannelHost::Broadcast( |
| 3845 new PluginMsg_ResetModalDialogEvent(host_window_)); | 3837 new PluginMsg_ResetModalDialogEvent(host_window_)); |
| 3846 | 3838 |
| 3847 return rv; | 3839 return rv; |
| 3848 } | 3840 } |
| OLD | NEW |