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

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

Issue 357003: Move the spellchecker to the renderer.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: rename 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
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "chrome/renderer/extensions/event_bindings.h" 45 #include "chrome/renderer/extensions/event_bindings.h"
46 #include "chrome/renderer/extensions/extension_process_bindings.h" 46 #include "chrome/renderer/extensions/extension_process_bindings.h"
47 #include "chrome/renderer/extensions/renderer_extension_bindings.h" 47 #include "chrome/renderer/extensions/renderer_extension_bindings.h"
48 #include "chrome/renderer/localized_error.h" 48 #include "chrome/renderer/localized_error.h"
49 #include "chrome/renderer/media/audio_renderer_impl.h" 49 #include "chrome/renderer/media/audio_renderer_impl.h"
50 #include "chrome/renderer/navigation_state.h" 50 #include "chrome/renderer/navigation_state.h"
51 #include "chrome/renderer/notification_provider.h" 51 #include "chrome/renderer/notification_provider.h"
52 #include "chrome/renderer/plugin_channel_host.h" 52 #include "chrome/renderer/plugin_channel_host.h"
53 #include "chrome/renderer/print_web_view_helper.h" 53 #include "chrome/renderer/print_web_view_helper.h"
54 #include "chrome/renderer/render_process.h" 54 #include "chrome/renderer/render_process.h"
55 #if defined(SPELLCHECKER_IN_RENDERER)
56 #include "chrome/renderer/spellchecker/spellcheck.h"
57 #endif
55 #include "chrome/renderer/user_script_slave.h" 58 #include "chrome/renderer/user_script_slave.h"
56 #include "chrome/renderer/visitedlink_slave.h" 59 #include "chrome/renderer/visitedlink_slave.h"
57 #include "chrome/renderer/webplugin_delegate_pepper.h" 60 #include "chrome/renderer/webplugin_delegate_pepper.h"
58 #include "chrome/renderer/webplugin_delegate_proxy.h" 61 #include "chrome/renderer/webplugin_delegate_proxy.h"
59 #include "chrome/renderer/webworker_proxy.h" 62 #include "chrome/renderer/webworker_proxy.h"
60 #include "grit/generated_resources.h" 63 #include "grit/generated_resources.h"
61 #include "grit/renderer_resources.h" 64 #include "grit/renderer_resources.h"
62 #include "net/base/data_url.h" 65 #include "net/base/data_url.h"
63 #include "net/base/escape.h" 66 #include "net/base/escape.h"
64 #include "net/base/net_errors.h" 67 #include "net/base/net_errors.h"
(...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after
1489 did_execute_command = true; 1492 did_execute_command = true;
1490 } 1493 }
1491 1494
1492 return did_execute_command; 1495 return did_execute_command;
1493 } 1496 }
1494 1497
1495 void RenderView::spellCheck(const WebString& text, 1498 void RenderView::spellCheck(const WebString& text,
1496 int& misspelled_offset, 1499 int& misspelled_offset,
1497 int& misspelled_length) { 1500 int& misspelled_length) {
1498 EnsureDocumentTag(); 1501 EnsureDocumentTag();
1502
1503 #if defined(SPELLCHECKER_IN_RENDERER)
1504 string16 word(text);
1505 RenderThread::current()->spellchecker()->SpellCheckWord(
1506 word.c_str(), word.size(), document_tag_,
1507 &misspelled_offset, &misspelled_length, NULL);
1508 #else
1499 Send(new ViewHostMsg_SpellCheck(routing_id_, text, document_tag_, 1509 Send(new ViewHostMsg_SpellCheck(routing_id_, text, document_tag_,
1500 &misspelled_offset, &misspelled_length)); 1510 &misspelled_offset, &misspelled_length));
1511 #endif
1501 } 1512 }
1502 1513
1503 WebString RenderView::autoCorrectWord(const WebKit::WebString& word) { 1514 WebString RenderView::autoCorrectWord(const WebKit::WebString& word) {
1504 string16 autocorrect_word; 1515 string16 autocorrect_word;
1505 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 1516 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
1506 if (command_line.HasSwitch(switches::kExperimentalSpellcheckerFeatures)) { 1517 if (command_line.HasSwitch(switches::kExperimentalSpellcheckerFeatures)) {
1507 EnsureDocumentTag(); 1518 EnsureDocumentTag();
1519 #if defined(SPELLCHECKER_IN_RENDERER)
1520 autocorrect_word =
1521 RenderThread::current()->spellchecker()->GetAutoCorrectionWord(
1522 word, document_tag_);
1523 #else
1508 Send(new ViewHostMsg_GetAutoCorrectWord( 1524 Send(new ViewHostMsg_GetAutoCorrectWord(
1509 routing_id_, word, document_tag_, &autocorrect_word)); 1525 routing_id_, word, document_tag_, &autocorrect_word));
1526 #endif
1510 } 1527 }
1511 return autocorrect_word; 1528 return autocorrect_word;
1512 } 1529 }
1513 1530
1514 void RenderView::showSpellingUI(bool show) { 1531 void RenderView::showSpellingUI(bool show) {
1515 Send(new ViewHostMsg_ShowSpellingPanel(routing_id_, show)); 1532 Send(new ViewHostMsg_ShowSpellingPanel(routing_id_, show));
1516 } 1533 }
1517 1534
1518 bool RenderView::isShowingSpellingUI() { 1535 bool RenderView::isShowingSpellingUI() {
1519 return spelling_panel_visible_; 1536 return spelling_panel_visible_;
(...skipping 2268 matching lines...) Expand 10 before | Expand all | Expand 10 after
3788 new PluginMsg_SignalModalDialogEvent(host_window_)); 3805 new PluginMsg_SignalModalDialogEvent(host_window_));
3789 3806
3790 message->EnableMessagePumping(); // Runs a nested message loop. 3807 message->EnableMessagePumping(); // Runs a nested message loop.
3791 bool rv = Send(message); 3808 bool rv = Send(message);
3792 3809
3793 PluginChannelHost::Broadcast( 3810 PluginChannelHost::Broadcast(
3794 new PluginMsg_ResetModalDialogEvent(host_window_)); 3811 new PluginMsg_ResetModalDialogEvent(host_window_));
3795 3812
3796 return rv; 3813 return rv;
3797 } 3814 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698