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

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

Issue 6289009: [Mac] Implement the system dictionary popup by implementing NSTextInput methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 9 years, 10 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/renderer/render_view.h" 5 #include "chrome/renderer/render_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 #include "chrome/renderer/render_view_visitor.h" 85 #include "chrome/renderer/render_view_visitor.h"
86 #include "chrome/renderer/render_widget_fullscreen.h" 86 #include "chrome/renderer/render_widget_fullscreen.h"
87 #include "chrome/renderer/render_widget_fullscreen_pepper.h" 87 #include "chrome/renderer/render_widget_fullscreen_pepper.h"
88 #include "chrome/renderer/renderer_webapplicationcachehost_impl.h" 88 #include "chrome/renderer/renderer_webapplicationcachehost_impl.h"
89 #include "chrome/renderer/renderer_webstoragenamespace_impl.h" 89 #include "chrome/renderer/renderer_webstoragenamespace_impl.h"
90 #include "chrome/renderer/safe_browsing/malware_dom_details.h" 90 #include "chrome/renderer/safe_browsing/malware_dom_details.h"
91 #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h" 91 #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h"
92 #include "chrome/renderer/searchbox.h" 92 #include "chrome/renderer/searchbox.h"
93 #include "chrome/renderer/speech_input_dispatcher.h" 93 #include "chrome/renderer/speech_input_dispatcher.h"
94 #include "chrome/renderer/spellchecker/spellcheck.h" 94 #include "chrome/renderer/spellchecker/spellcheck.h"
95 #include "chrome/renderer/text_input_client_observer.h"
95 #include "chrome/renderer/translate_helper.h" 96 #include "chrome/renderer/translate_helper.h"
96 #include "chrome/renderer/user_script_idle_scheduler.h" 97 #include "chrome/renderer/user_script_idle_scheduler.h"
97 #include "chrome/renderer/user_script_slave.h" 98 #include "chrome/renderer/user_script_slave.h"
98 #include "chrome/renderer/visitedlink_slave.h" 99 #include "chrome/renderer/visitedlink_slave.h"
99 #include "chrome/renderer/web_ui_bindings.h" 100 #include "chrome/renderer/web_ui_bindings.h"
100 #include "chrome/renderer/webgraphicscontext3d_command_buffer_impl.h" 101 #include "chrome/renderer/webgraphicscontext3d_command_buffer_impl.h"
101 #include "chrome/renderer/webplugin_delegate_pepper.h" 102 #include "chrome/renderer/webplugin_delegate_pepper.h"
102 #include "chrome/renderer/webplugin_delegate_proxy.h" 103 #include "chrome/renderer/webplugin_delegate_proxy.h"
103 #include "chrome/renderer/websharedworker_proxy.h" 104 #include "chrome/renderer/websharedworker_proxy.h"
104 #include "chrome/renderer/webworker_proxy.h" 105 #include "chrome/renderer/webworker_proxy.h"
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 } 608 }
608 609
609 notification_provider_ = new NotificationProvider(this); 610 notification_provider_ = new NotificationProvider(this);
610 611
611 devtools_agent_ = new DevToolsAgent(this); 612 devtools_agent_ = new DevToolsAgent(this);
612 PasswordAutoFillManager* password_autofill_manager = 613 PasswordAutoFillManager* password_autofill_manager =
613 new PasswordAutoFillManager(this); 614 new PasswordAutoFillManager(this);
614 AutoFillAgent* autofill_agent = new AutoFillAgent(this, 615 AutoFillAgent* autofill_agent = new AutoFillAgent(this,
615 password_autofill_manager); 616 password_autofill_manager);
616 617
618 #if defined(OS_MACOSX)
619 // Create the message filter for the TextInputClient.
620 TextInputClientObserver* input_client = new TextInputClientObserver(this);
621 input_client->render_view(); // Avoid unused variable warning.
622 #endif // defined(OS_MACOSX)
623
617 webwidget_ = WebView::create(this, devtools_agent_, autofill_agent); 624 webwidget_ = WebView::create(this, devtools_agent_, autofill_agent);
618 g_view_map.Get().insert(std::make_pair(webview(), this)); 625 g_view_map.Get().insert(std::make_pair(webview(), this));
619 webkit_preferences_.Apply(webview()); 626 webkit_preferences_.Apply(webview());
620 webview()->initializeMainFrame(this); 627 webview()->initializeMainFrame(this);
621 if (!frame_name.empty()) 628 if (!frame_name.empty())
622 webview()->mainFrame()->setName(frame_name); 629 webview()->mainFrame()->setName(frame_name);
623 630
624 OnSetRendererPrefs(renderer_prefs); 631 OnSetRendererPrefs(renderer_prefs);
625 632
626 render_thread_->AddRoute(routing_id_, this); 633 render_thread_->AddRoute(routing_id_, this);
(...skipping 1573 matching lines...) Expand 10 before | Expand all | Expand 10 after
2200 void RenderView::didChangeSelection(bool is_empty_selection) { 2207 void RenderView::didChangeSelection(bool is_empty_selection) {
2201 #if defined(OS_POSIX) 2208 #if defined(OS_POSIX)
2202 if (!handling_input_event_) 2209 if (!handling_input_event_)
2203 return; 2210 return;
2204 // TODO(estade): investigate incremental updates to the selection so that we 2211 // TODO(estade): investigate incremental updates to the selection so that we
2205 // don't send the entire selection over IPC every time. 2212 // don't send the entire selection over IPC every time.
2206 if (!is_empty_selection) { 2213 if (!is_empty_selection) {
2207 // Sometimes we get repeated didChangeSelection calls from webkit when 2214 // Sometimes we get repeated didChangeSelection calls from webkit when
2208 // the selection hasn't actually changed. We don't want to report these 2215 // the selection hasn't actually changed. We don't want to report these
2209 // because it will cause us to continually claim the X clipboard. 2216 // because it will cause us to continually claim the X clipboard.
2210 const std::string& this_selection = 2217 WebFrame* frame = webview()->focusedFrame();
2211 webview()->focusedFrame()->selectionAsText().utf8(); 2218 const std::string& this_selection = frame->selectionAsText().utf8();
2212 if (this_selection == last_selection_) 2219 if (this_selection == last_selection_)
2213 return; 2220 return;
2214 2221
2222 WebRange range = frame->selectionRange();
2215 Send(new ViewHostMsg_SelectionChanged(routing_id_, 2223 Send(new ViewHostMsg_SelectionChanged(routing_id_,
2216 this_selection)); 2224 this_selection, range.startOffset(), range.endOffset()));
2217 last_selection_ = this_selection; 2225 last_selection_ = this_selection;
2218 } else { 2226 } else {
2219 last_selection_.clear(); 2227 last_selection_.clear();
2220 Send(new ViewHostMsg_SelectionChanged(routing_id_, 2228 WebRange range = webwidget_->caretOrSelectionRange();
2221 last_selection_)); 2229 if (!range.isNull()) {
2230 Send(new ViewHostMsg_SelectionChanged(routing_id_,
2231 last_selection_, range.startOffset(), range.endOffset()));
2232 } else {
2233 Send(new ViewHostMsg_SelectionChanged(routing_id_,
2234 last_selection_, 0, 0));
2235 }
2222 } 2236 }
2223 #endif // defined(OS_POSIX) 2237 #endif // defined(OS_POSIX)
2224 } 2238 }
2225 2239
2226 void RenderView::didExecuteCommand(const WebString& command_name) { 2240 void RenderView::didExecuteCommand(const WebString& command_name) {
2227 const std::string& name = UTF16ToUTF8(command_name); 2241 const std::string& name = UTF16ToUTF8(command_name);
2228 if (StartsWithASCII(name, "Move", true) || 2242 if (StartsWithASCII(name, "Move", true) ||
2229 StartsWithASCII(name, "Insert", true) || 2243 StartsWithASCII(name, "Insert", true) ||
2230 StartsWithASCII(name, "Delete", true)) 2244 StartsWithASCII(name, "Delete", true))
2231 return; 2245 return;
(...skipping 3445 matching lines...) Expand 10 before | Expand all | Expand 10 after
5677 } 5691 }
5678 } 5692 }
5679 5693
5680 void RenderView::OnContextMenuClosed( 5694 void RenderView::OnContextMenuClosed(
5681 const webkit_glue::CustomContextMenuContext& custom_context) { 5695 const webkit_glue::CustomContextMenuContext& custom_context) {
5682 if (custom_context.is_pepper_menu) 5696 if (custom_context.is_pepper_menu)
5683 pepper_delegate_.OnContextMenuClosed(custom_context); 5697 pepper_delegate_.OnContextMenuClosed(custom_context);
5684 else 5698 else
5685 context_menu_node_.reset(); 5699 context_menu_node_.reset();
5686 } 5700 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698