| OLD | NEW |
| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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_provider.h" | 94 #include "chrome/renderer/spellchecker/spellcheck_provider.h" |
| 95 #include "chrome/renderer/spellchecker/spellcheck.h" | 95 #include "chrome/renderer/spellchecker/spellcheck.h" |
| 96 #include "chrome/renderer/text_input_client_observer.h" |
| 96 #include "chrome/renderer/translate_helper.h" | 97 #include "chrome/renderer/translate_helper.h" |
| 97 #include "chrome/renderer/user_script_idle_scheduler.h" | 98 #include "chrome/renderer/user_script_idle_scheduler.h" |
| 98 #include "chrome/renderer/user_script_slave.h" | 99 #include "chrome/renderer/user_script_slave.h" |
| 99 #include "chrome/renderer/visitedlink_slave.h" | 100 #include "chrome/renderer/visitedlink_slave.h" |
| 100 #include "chrome/renderer/web_ui_bindings.h" | 101 #include "chrome/renderer/web_ui_bindings.h" |
| 101 #include "chrome/renderer/webgraphicscontext3d_command_buffer_impl.h" | 102 #include "chrome/renderer/webgraphicscontext3d_command_buffer_impl.h" |
| 102 #include "chrome/renderer/webplugin_delegate_pepper.h" | 103 #include "chrome/renderer/webplugin_delegate_pepper.h" |
| 103 #include "chrome/renderer/webplugin_delegate_proxy.h" | 104 #include "chrome/renderer/webplugin_delegate_proxy.h" |
| 104 #include "chrome/renderer/websharedworker_proxy.h" | 105 #include "chrome/renderer/websharedworker_proxy.h" |
| 105 #include "chrome/renderer/webworker_proxy.h" | 106 #include "chrome/renderer/webworker_proxy.h" |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 } | 614 } |
| 614 | 615 |
| 615 notification_provider_ = new NotificationProvider(this); | 616 notification_provider_ = new NotificationProvider(this); |
| 616 | 617 |
| 617 devtools_agent_ = new DevToolsAgent(this); | 618 devtools_agent_ = new DevToolsAgent(this); |
| 618 PasswordAutoFillManager* password_autofill_manager = | 619 PasswordAutoFillManager* password_autofill_manager = |
| 619 new PasswordAutoFillManager(this); | 620 new PasswordAutoFillManager(this); |
| 620 AutoFillAgent* autofill_agent = new AutoFillAgent(this, | 621 AutoFillAgent* autofill_agent = new AutoFillAgent(this, |
| 621 password_autofill_manager); | 622 password_autofill_manager); |
| 622 | 623 |
| 624 #if defined(OS_MACOSX) |
| 625 // Create the message filter for the TextInputClient. |
| 626 TextInputClientObserver* input_client = new TextInputClientObserver(this); |
| 627 input_client->render_view(); // Avoid unused variable warning. |
| 628 #endif // defined(OS_MACOSX) |
| 629 |
| 623 webwidget_ = WebView::create(this, devtools_agent_, autofill_agent); | 630 webwidget_ = WebView::create(this, devtools_agent_, autofill_agent); |
| 624 g_view_map.Get().insert(std::make_pair(webview(), this)); | 631 g_view_map.Get().insert(std::make_pair(webview(), this)); |
| 625 webkit_preferences_.Apply(webview()); | 632 webkit_preferences_.Apply(webview()); |
| 626 webview()->initializeMainFrame(this); | 633 webview()->initializeMainFrame(this); |
| 627 if (!frame_name.empty()) | 634 if (!frame_name.empty()) |
| 628 webview()->mainFrame()->setName(frame_name); | 635 webview()->mainFrame()->setName(frame_name); |
| 629 webview()->settings()->setMinimumTimerInterval( | 636 webview()->settings()->setMinimumTimerInterval( |
| 630 is_hidden() ? webkit_glue::kBackgroundTabTimerInterval : | 637 is_hidden() ? webkit_glue::kBackgroundTabTimerInterval : |
| 631 webkit_glue::kForegroundTabTimerInterval); | 638 webkit_glue::kForegroundTabTimerInterval); |
| 632 | 639 |
| (...skipping 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2215 void RenderView::didChangeSelection(bool is_empty_selection) { | 2222 void RenderView::didChangeSelection(bool is_empty_selection) { |
| 2216 #if defined(OS_POSIX) | 2223 #if defined(OS_POSIX) |
| 2217 if (!handling_input_event_) | 2224 if (!handling_input_event_) |
| 2218 return; | 2225 return; |
| 2219 // TODO(estade): investigate incremental updates to the selection so that we | 2226 // TODO(estade): investigate incremental updates to the selection so that we |
| 2220 // don't send the entire selection over IPC every time. | 2227 // don't send the entire selection over IPC every time. |
| 2221 if (!is_empty_selection) { | 2228 if (!is_empty_selection) { |
| 2222 // Sometimes we get repeated didChangeSelection calls from webkit when | 2229 // Sometimes we get repeated didChangeSelection calls from webkit when |
| 2223 // the selection hasn't actually changed. We don't want to report these | 2230 // the selection hasn't actually changed. We don't want to report these |
| 2224 // because it will cause us to continually claim the X clipboard. | 2231 // because it will cause us to continually claim the X clipboard. |
| 2225 const std::string& this_selection = | 2232 WebFrame* frame = webview()->focusedFrame(); |
| 2226 webview()->focusedFrame()->selectionAsText().utf8(); | 2233 const std::string& this_selection = frame->selectionAsText().utf8(); |
| 2227 if (this_selection == last_selection_) | 2234 if (this_selection == last_selection_) |
| 2228 return; | 2235 return; |
| 2229 | 2236 |
| 2237 WebRange range = frame->selectionRange(); |
| 2230 Send(new ViewHostMsg_SelectionChanged(routing_id_, | 2238 Send(new ViewHostMsg_SelectionChanged(routing_id_, |
| 2231 this_selection)); | 2239 this_selection, range.startOffset(), range.endOffset())); |
| 2232 last_selection_ = this_selection; | 2240 last_selection_ = this_selection; |
| 2233 } else { | 2241 } else { |
| 2234 last_selection_.clear(); | 2242 last_selection_.clear(); |
| 2235 Send(new ViewHostMsg_SelectionChanged(routing_id_, | 2243 WebRange range = webwidget_->caretOrSelectionRange(); |
| 2236 last_selection_)); | 2244 if (!range.isNull()) { |
| 2245 Send(new ViewHostMsg_SelectionChanged(routing_id_, |
| 2246 last_selection_, range.startOffset(), range.endOffset())); |
| 2247 } else { |
| 2248 Send(new ViewHostMsg_SelectionChanged(routing_id_, |
| 2249 last_selection_, 0, 0)); |
| 2250 } |
| 2237 } | 2251 } |
| 2238 #endif // defined(OS_POSIX) | 2252 #endif // defined(OS_POSIX) |
| 2239 } | 2253 } |
| 2240 | 2254 |
| 2241 void RenderView::didExecuteCommand(const WebString& command_name) { | 2255 void RenderView::didExecuteCommand(const WebString& command_name) { |
| 2242 const std::string& name = UTF16ToUTF8(command_name); | 2256 const std::string& name = UTF16ToUTF8(command_name); |
| 2243 if (StartsWithASCII(name, "Move", true) || | 2257 if (StartsWithASCII(name, "Move", true) || |
| 2244 StartsWithASCII(name, "Insert", true) || | 2258 StartsWithASCII(name, "Insert", true) || |
| 2245 StartsWithASCII(name, "Delete", true)) | 2259 StartsWithASCII(name, "Delete", true)) |
| 2246 return; | 2260 return; |
| (...skipping 3444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5691 } | 5705 } |
| 5692 } | 5706 } |
| 5693 | 5707 |
| 5694 void RenderView::OnContextMenuClosed( | 5708 void RenderView::OnContextMenuClosed( |
| 5695 const webkit_glue::CustomContextMenuContext& custom_context) { | 5709 const webkit_glue::CustomContextMenuContext& custom_context) { |
| 5696 if (custom_context.is_pepper_menu) | 5710 if (custom_context.is_pepper_menu) |
| 5697 pepper_delegate_.OnContextMenuClosed(custom_context); | 5711 pepper_delegate_.OnContextMenuClosed(custom_context); |
| 5698 else | 5712 else |
| 5699 context_menu_node_.reset(); | 5713 context_menu_node_.reset(); |
| 5700 } | 5714 } |
| OLD | NEW |