OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 937 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
938 if (command_line.HasSwitch(switches::kDomAutomationController)) | 938 if (command_line.HasSwitch(switches::kDomAutomationController)) |
939 enabled_bindings_ |= BindingsPolicy::DOM_AUTOMATION; | 939 enabled_bindings_ |= BindingsPolicy::DOM_AUTOMATION; |
940 if (command_line.HasSwitch(switches::kEnableAccessibility)) | 940 if (command_line.HasSwitch(switches::kEnableAccessibility)) |
941 WebAccessibilityCache::enableAccessibility(); | 941 WebAccessibilityCache::enableAccessibility(); |
942 | 942 |
943 audio_message_filter_ = new AudioMessageFilter(routing_id_); | 943 audio_message_filter_ = new AudioMessageFilter(routing_id_); |
944 render_thread_->AddFilter(audio_message_filter_); | 944 render_thread_->AddFilter(audio_message_filter_); |
945 } | 945 } |
946 | 946 |
947 void RenderView::OnMessageReceived(const IPC::Message& message) { | 947 bool RenderView::OnMessageReceived(const IPC::Message& message) { |
948 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; | 948 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; |
949 if (main_frame) | 949 if (main_frame) |
950 child_process_logging::SetActiveURL(main_frame->url()); | 950 child_process_logging::SetActiveURL(main_frame->url()); |
951 | 951 |
952 // If this is developer tools renderer intercept tools messages first. | 952 // If this is developer tools renderer intercept tools messages first. |
953 if (devtools_client_.get() && devtools_client_->OnMessageReceived(message)) | 953 if (devtools_client_.get() && devtools_client_->OnMessageReceived(message)) |
954 return; | 954 return true; |
955 if (devtools_agent_.get() && devtools_agent_->OnMessageReceived(message)) | 955 if (devtools_agent_.get() && devtools_agent_->OnMessageReceived(message)) |
956 return; | 956 return true; |
957 if (notification_provider_->OnMessageReceived(message)) | 957 if (notification_provider_->OnMessageReceived(message)) |
958 return; | 958 return true; |
959 if (geolocation_dispatcher_.get() && | 959 if (geolocation_dispatcher_.get() && |
960 geolocation_dispatcher_->OnMessageReceived(message)) { | 960 geolocation_dispatcher_->OnMessageReceived(message)) { |
961 return; | 961 return true; |
962 } | 962 } |
963 if (speech_input_dispatcher_.get() && | 963 if (speech_input_dispatcher_.get() && |
964 speech_input_dispatcher_->OnMessageReceived(message)) { | 964 speech_input_dispatcher_->OnMessageReceived(message)) { |
965 return; | 965 return true; |
966 } | 966 } |
967 if (device_orientation_dispatcher_.get() && | 967 if (device_orientation_dispatcher_.get() && |
968 device_orientation_dispatcher_->OnMessageReceived(message)) { | 968 device_orientation_dispatcher_->OnMessageReceived(message)) { |
969 return; | 969 return true; |
970 } | 970 } |
971 | 971 |
| 972 bool handled = true; |
972 IPC_BEGIN_MESSAGE_MAP(RenderView, message) | 973 IPC_BEGIN_MESSAGE_MAP(RenderView, message) |
973 IPC_MESSAGE_HANDLER(ViewMsg_CaptureThumbnail, OnCaptureThumbnail) | 974 IPC_MESSAGE_HANDLER(ViewMsg_CaptureThumbnail, OnCaptureThumbnail) |
974 IPC_MESSAGE_HANDLER(ViewMsg_CaptureSnapshot, OnCaptureSnapshot) | 975 IPC_MESSAGE_HANDLER(ViewMsg_CaptureSnapshot, OnCaptureSnapshot) |
975 IPC_MESSAGE_HANDLER(ViewMsg_PrintPages, OnPrintPages) | 976 IPC_MESSAGE_HANDLER(ViewMsg_PrintPages, OnPrintPages) |
976 IPC_MESSAGE_HANDLER(ViewMsg_PrintingDone, OnPrintingDone) | 977 IPC_MESSAGE_HANDLER(ViewMsg_PrintingDone, OnPrintingDone) |
977 IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate) | 978 IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate) |
978 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop) | 979 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop) |
979 IPC_MESSAGE_HANDLER(ViewMsg_ReloadFrame, OnReloadFrame) | 980 IPC_MESSAGE_HANDLER(ViewMsg_ReloadFrame, OnReloadFrame) |
980 IPC_MESSAGE_HANDLER(ViewMsg_Undo, OnUndo) | 981 IPC_MESSAGE_HANDLER(ViewMsg_Undo, OnUndo) |
981 IPC_MESSAGE_HANDLER(ViewMsg_Redo, OnRedo) | 982 IPC_MESSAGE_HANDLER(ViewMsg_Redo, OnRedo) |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 OnAccessibilityDoDefaultAction) | 1096 OnAccessibilityDoDefaultAction) |
1096 IPC_MESSAGE_HANDLER(ViewMsg_AccessibilityNotifications_ACK, | 1097 IPC_MESSAGE_HANDLER(ViewMsg_AccessibilityNotifications_ACK, |
1097 OnAccessibilityNotificationsAck) | 1098 OnAccessibilityNotificationsAck) |
1098 IPC_MESSAGE_HANDLER(ViewMsg_AsyncOpenFile_ACK, OnAsyncFileOpened) | 1099 IPC_MESSAGE_HANDLER(ViewMsg_AsyncOpenFile_ACK, OnAsyncFileOpened) |
1099 #if defined(OS_MACOSX) | 1100 #if defined(OS_MACOSX) |
1100 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) | 1101 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) |
1101 #endif | 1102 #endif |
1102 IPC_MESSAGE_HANDLER(ViewMsg_PrintPreview, OnPrintPreview) | 1103 IPC_MESSAGE_HANDLER(ViewMsg_PrintPreview, OnPrintPreview) |
1103 | 1104 |
1104 // Have the super handle all other messages. | 1105 // Have the super handle all other messages. |
1105 IPC_MESSAGE_UNHANDLED(RenderWidget::OnMessageReceived(message)) | 1106 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) |
1106 IPC_END_MESSAGE_MAP() | 1107 IPC_END_MESSAGE_MAP() |
| 1108 return handled; |
1107 } | 1109 } |
1108 | 1110 |
1109 void RenderView::OnCaptureThumbnail() { | 1111 void RenderView::OnCaptureThumbnail() { |
1110 WebFrame* main_frame = webview()->mainFrame(); | 1112 WebFrame* main_frame = webview()->mainFrame(); |
1111 if (!main_frame) | 1113 if (!main_frame) |
1112 return; | 1114 return; |
1113 | 1115 |
1114 // get the URL for this page | 1116 // get the URL for this page |
1115 GURL url(main_frame->url()); | 1117 GURL url(main_frame->url()); |
1116 if (url.is_empty()) | 1118 if (url.is_empty()) |
(...skipping 4638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5755 external_popup_menu_.reset(); | 5757 external_popup_menu_.reset(); |
5756 } | 5758 } |
5757 #endif | 5759 #endif |
5758 | 5760 |
5759 void RenderView::AddErrorToRootConsole(const string16& message) { | 5761 void RenderView::AddErrorToRootConsole(const string16& message) { |
5760 if (webview() && webview()->mainFrame()) { | 5762 if (webview() && webview()->mainFrame()) { |
5761 webview()->mainFrame()->addMessageToConsole( | 5763 webview()->mainFrame()->addMessageToConsole( |
5762 WebConsoleMessage(WebConsoleMessage::LevelError, message)); | 5764 WebConsoleMessage(WebConsoleMessage::LevelError, message)); |
5763 } | 5765 } |
5764 } | 5766 } |
OLD | NEW |