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 "content/renderer/render_view.h" | 5 #include "content/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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 #include "chrome/renderer/spellchecker/spellcheck.h" | 65 #include "chrome/renderer/spellchecker/spellcheck.h" |
66 #include "chrome/renderer/spellchecker/spellcheck_provider.h" | 66 #include "chrome/renderer/spellchecker/spellcheck_provider.h" |
67 #include "chrome/renderer/translate_helper.h" | 67 #include "chrome/renderer/translate_helper.h" |
68 #include "chrome/renderer/user_script_idle_scheduler.h" | 68 #include "chrome/renderer/user_script_idle_scheduler.h" |
69 #include "chrome/renderer/user_script_slave.h" | 69 #include "chrome/renderer/user_script_slave.h" |
70 #include "chrome/renderer/visitedlink_slave.h" | 70 #include "chrome/renderer/visitedlink_slave.h" |
71 #include "content/common/appcache/appcache_dispatcher.h" | 71 #include "content/common/appcache/appcache_dispatcher.h" |
72 #include "content/common/clipboard_messages.h" | 72 #include "content/common/clipboard_messages.h" |
73 #include "content/common/content_constants.h" | 73 #include "content/common/content_constants.h" |
74 #include "content/common/database_messages.h" | 74 #include "content/common/database_messages.h" |
| 75 #include "content/common/drag_messages.h" |
75 #include "content/common/file_system/file_system_dispatcher.h" | 76 #include "content/common/file_system/file_system_dispatcher.h" |
76 #include "content/common/file_system/webfilesystem_callback_dispatcher.h" | 77 #include "content/common/file_system/webfilesystem_callback_dispatcher.h" |
77 #include "content/common/notification_service.h" | 78 #include "content/common/notification_service.h" |
78 #include "content/common/page_zoom.h" | 79 #include "content/common/page_zoom.h" |
79 #include "content/common/pepper_messages.h" | 80 #include "content/common/pepper_messages.h" |
80 #include "content/common/renderer_preferences.h" | 81 #include "content/common/renderer_preferences.h" |
81 #include "content/common/view_messages.h" | 82 #include "content/common/view_messages.h" |
82 #include "content/renderer/audio_message_filter.h" | 83 #include "content/renderer/audio_message_filter.h" |
83 #include "content/renderer/content_renderer_client.h" | 84 #include "content/renderer/content_renderer_client.h" |
84 #include "content/renderer/device_orientation_dispatcher.h" | 85 #include "content/renderer/device_orientation_dispatcher.h" |
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, | 996 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, |
996 OnSetZoomLevelForLoadingURL) | 997 OnSetZoomLevelForLoadingURL) |
997 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) | 998 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) |
998 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, | 999 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, |
999 OnResetPageEncodingToDefault) | 1000 OnResetPageEncodingToDefault) |
1000 IPC_MESSAGE_HANDLER(ViewMsg_SetupDevToolsClient, OnSetupDevToolsClient) | 1001 IPC_MESSAGE_HANDLER(ViewMsg_SetupDevToolsClient, OnSetupDevToolsClient) |
1001 IPC_MESSAGE_HANDLER(ViewMsg_DownloadFavicon, OnDownloadFavicon) | 1002 IPC_MESSAGE_HANDLER(ViewMsg_DownloadFavicon, OnDownloadFavicon) |
1002 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) | 1003 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) |
1003 IPC_MESSAGE_HANDLER(ViewMsg_CSSInsertRequest, OnCSSInsertRequest) | 1004 IPC_MESSAGE_HANDLER(ViewMsg_CSSInsertRequest, OnCSSInsertRequest) |
1004 IPC_MESSAGE_HANDLER(ViewMsg_ReservePageIDRange, OnReservePageIDRange) | 1005 IPC_MESSAGE_HANDLER(ViewMsg_ReservePageIDRange, OnReservePageIDRange) |
1005 IPC_MESSAGE_HANDLER(ViewMsg_DragTargetDragEnter, OnDragTargetDragEnter) | 1006 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) |
1006 IPC_MESSAGE_HANDLER(ViewMsg_DragTargetDragOver, OnDragTargetDragOver) | 1007 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) |
1007 IPC_MESSAGE_HANDLER(ViewMsg_DragTargetDragLeave, OnDragTargetDragLeave) | 1008 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) |
1008 IPC_MESSAGE_HANDLER(ViewMsg_DragTargetDrop, OnDragTargetDrop) | 1009 IPC_MESSAGE_HANDLER(DragMsg_TargetDrop, OnDragTargetDrop) |
| 1010 IPC_MESSAGE_HANDLER(DragMsg_SourceEndedOrMoved, OnDragSourceEndedOrMoved) |
| 1011 IPC_MESSAGE_HANDLER(DragMsg_SourceSystemDragEnded, |
| 1012 OnDragSourceSystemDragEnded) |
1009 IPC_MESSAGE_HANDLER(ViewMsg_AllowBindings, OnAllowBindings) | 1013 IPC_MESSAGE_HANDLER(ViewMsg_AllowBindings, OnAllowBindings) |
1010 IPC_MESSAGE_HANDLER(ViewMsg_SetWebUIProperty, OnSetWebUIProperty) | 1014 IPC_MESSAGE_HANDLER(ViewMsg_SetWebUIProperty, OnSetWebUIProperty) |
1011 IPC_MESSAGE_HANDLER(ViewMsg_DragSourceEndedOrMoved, | |
1012 OnDragSourceEndedOrMoved) | |
1013 IPC_MESSAGE_HANDLER(ViewMsg_DragSourceSystemDragEnded, | |
1014 OnDragSourceSystemDragEnded) | |
1015 IPC_MESSAGE_HANDLER(ViewMsg_SetInitialFocus, OnSetInitialFocus) | 1015 IPC_MESSAGE_HANDLER(ViewMsg_SetInitialFocus, OnSetInitialFocus) |
1016 IPC_MESSAGE_HANDLER(ViewMsg_ScrollFocusedEditableNodeIntoView, | 1016 IPC_MESSAGE_HANDLER(ViewMsg_ScrollFocusedEditableNodeIntoView, |
1017 OnScrollFocusedEditableNodeIntoView) | 1017 OnScrollFocusedEditableNodeIntoView) |
1018 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTargetURL_ACK, OnUpdateTargetURLAck) | 1018 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTargetURL_ACK, OnUpdateTargetURLAck) |
1019 IPC_MESSAGE_HANDLER(ViewMsg_UpdateWebPreferences, OnUpdateWebPreferences) | 1019 IPC_MESSAGE_HANDLER(ViewMsg_UpdateWebPreferences, OnUpdateWebPreferences) |
1020 IPC_MESSAGE_HANDLER(ViewMsg_SetAltErrorPageURL, OnSetAltErrorPageURL) | 1020 IPC_MESSAGE_HANDLER(ViewMsg_SetAltErrorPageURL, OnSetAltErrorPageURL) |
1021 IPC_MESSAGE_HANDLER(ViewMsg_InstallMissingPlugin, OnInstallMissingPlugin) | 1021 IPC_MESSAGE_HANDLER(ViewMsg_InstallMissingPlugin, OnInstallMissingPlugin) |
1022 IPC_MESSAGE_HANDLER(ViewMsg_DisplayPrerenderedPage, | 1022 IPC_MESSAGE_HANDLER(ViewMsg_DisplayPrerenderedPage, |
1023 OnDisplayPrerenderedPage) | 1023 OnDisplayPrerenderedPage) |
1024 IPC_MESSAGE_HANDLER(ViewMsg_RunFileChooserResponse, OnFileChooserResponse) | 1024 IPC_MESSAGE_HANDLER(ViewMsg_RunFileChooserResponse, OnFileChooserResponse) |
(...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2480 void RenderView::startDragging(const WebDragData& data, | 2480 void RenderView::startDragging(const WebDragData& data, |
2481 WebDragOperationsMask mask, | 2481 WebDragOperationsMask mask, |
2482 const WebImage& image, | 2482 const WebImage& image, |
2483 const WebPoint& imageOffset) { | 2483 const WebPoint& imageOffset) { |
2484 #if WEBKIT_USING_SKIA | 2484 #if WEBKIT_USING_SKIA |
2485 SkBitmap bitmap(image.getSkBitmap()); | 2485 SkBitmap bitmap(image.getSkBitmap()); |
2486 #elif WEBKIT_USING_CG | 2486 #elif WEBKIT_USING_CG |
2487 SkBitmap bitmap = gfx::CGImageToSkBitmap(image.getCGImageRef()); | 2487 SkBitmap bitmap = gfx::CGImageToSkBitmap(image.getCGImageRef()); |
2488 #endif | 2488 #endif |
2489 | 2489 |
2490 Send(new ViewHostMsg_StartDragging(routing_id_, | 2490 Send(new DragHostMsg_StartDragging(routing_id_, |
2491 WebDropData(data), | 2491 WebDropData(data), |
2492 mask, | 2492 mask, |
2493 bitmap, | 2493 bitmap, |
2494 imageOffset)); | 2494 imageOffset)); |
2495 } | 2495 } |
2496 | 2496 |
2497 bool RenderView::acceptsLoadDrops() { | 2497 bool RenderView::acceptsLoadDrops() { |
2498 return renderer_preferences_.can_accept_load_drops; | 2498 return renderer_preferences_.can_accept_load_drops; |
2499 } | 2499 } |
2500 | 2500 |
(...skipping 1860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4361 void RenderView::OnSetWebUIProperty(const std::string& name, | 4361 void RenderView::OnSetWebUIProperty(const std::string& name, |
4362 const std::string& value) { | 4362 const std::string& value) { |
4363 DCHECK(BindingsPolicy::is_web_ui_enabled(enabled_bindings_)); | 4363 DCHECK(BindingsPolicy::is_web_ui_enabled(enabled_bindings_)); |
4364 GetWebUIBindings()->SetProperty(name, value); | 4364 GetWebUIBindings()->SetProperty(name, value); |
4365 } | 4365 } |
4366 | 4366 |
4367 void RenderView::OnReservePageIDRange(int size_of_range) { | 4367 void RenderView::OnReservePageIDRange(int size_of_range) { |
4368 next_page_id_ += size_of_range + 1; | 4368 next_page_id_ += size_of_range + 1; |
4369 } | 4369 } |
4370 | 4370 |
4371 void RenderView::OnDragSourceEndedOrMoved(const gfx::Point& client_point, | |
4372 const gfx::Point& screen_point, | |
4373 bool ended, | |
4374 WebDragOperation op) { | |
4375 if (ended) { | |
4376 webview()->dragSourceEndedAt(client_point, screen_point, op); | |
4377 } else { | |
4378 webview()->dragSourceMovedTo(client_point, screen_point, op); | |
4379 } | |
4380 } | |
4381 | |
4382 void RenderView::OnDragSourceSystemDragEnded() { | |
4383 webview()->dragSourceSystemDragEnded(); | |
4384 } | |
4385 | |
4386 void RenderView::OnDragTargetDragEnter(const WebDropData& drop_data, | 4371 void RenderView::OnDragTargetDragEnter(const WebDropData& drop_data, |
4387 const gfx::Point& client_point, | 4372 const gfx::Point& client_point, |
4388 const gfx::Point& screen_point, | 4373 const gfx::Point& screen_point, |
4389 WebDragOperationsMask ops) { | 4374 WebDragOperationsMask ops) { |
4390 WebDragOperation operation = webview()->dragTargetDragEnter( | 4375 WebDragOperation operation = webview()->dragTargetDragEnter( |
4391 drop_data.ToDragData(), | 4376 drop_data.ToDragData(), |
4392 0, // drag identity, unused | 4377 0, // drag identity, unused |
4393 client_point, | 4378 client_point, |
4394 screen_point, | 4379 screen_point, |
4395 ops); | 4380 ops); |
4396 | 4381 |
4397 Send(new ViewHostMsg_UpdateDragCursor(routing_id_, operation)); | 4382 Send(new DragHostMsg_UpdateDragCursor(routing_id_, operation)); |
4398 } | 4383 } |
4399 | 4384 |
4400 void RenderView::OnDragTargetDragOver(const gfx::Point& client_point, | 4385 void RenderView::OnDragTargetDragOver(const gfx::Point& client_point, |
4401 const gfx::Point& screen_point, | 4386 const gfx::Point& screen_point, |
4402 WebDragOperationsMask ops) { | 4387 WebDragOperationsMask ops) { |
4403 WebDragOperation operation = webview()->dragTargetDragOver( | 4388 WebDragOperation operation = webview()->dragTargetDragOver( |
4404 client_point, | 4389 client_point, |
4405 screen_point, | 4390 screen_point, |
4406 ops); | 4391 ops); |
4407 | 4392 |
4408 Send(new ViewHostMsg_UpdateDragCursor(routing_id_, operation)); | 4393 Send(new DragHostMsg_UpdateDragCursor(routing_id_, operation)); |
4409 } | 4394 } |
4410 | 4395 |
4411 void RenderView::OnDragTargetDragLeave() { | 4396 void RenderView::OnDragTargetDragLeave() { |
4412 webview()->dragTargetDragLeave(); | 4397 webview()->dragTargetDragLeave(); |
4413 } | 4398 } |
4414 | 4399 |
4415 void RenderView::OnDragTargetDrop(const gfx::Point& client_point, | 4400 void RenderView::OnDragTargetDrop(const gfx::Point& client_point, |
4416 const gfx::Point& screen_point) { | 4401 const gfx::Point& screen_point) { |
4417 webview()->dragTargetDrop(client_point, screen_point); | 4402 webview()->dragTargetDrop(client_point, screen_point); |
4418 } | 4403 } |
4419 | 4404 |
| 4405 void RenderView::OnDragSourceEndedOrMoved(const gfx::Point& client_point, |
| 4406 const gfx::Point& screen_point, |
| 4407 bool ended, |
| 4408 WebDragOperation op) { |
| 4409 if (ended) { |
| 4410 webview()->dragSourceEndedAt(client_point, screen_point, op); |
| 4411 } else { |
| 4412 webview()->dragSourceMovedTo(client_point, screen_point, op); |
| 4413 } |
| 4414 } |
| 4415 |
| 4416 void RenderView::OnDragSourceSystemDragEnded() { |
| 4417 webview()->dragSourceSystemDragEnded(); |
| 4418 } |
| 4419 |
4420 void RenderView::OnUpdateWebPreferences(const WebPreferences& prefs) { | 4420 void RenderView::OnUpdateWebPreferences(const WebPreferences& prefs) { |
4421 webkit_preferences_ = prefs; | 4421 webkit_preferences_ = prefs; |
4422 webkit_preferences_.Apply(webview()); | 4422 webkit_preferences_.Apply(webview()); |
4423 } | 4423 } |
4424 | 4424 |
4425 void RenderView::OnSetAltErrorPageURL(const GURL& url) { | 4425 void RenderView::OnSetAltErrorPageURL(const GURL& url) { |
4426 alternate_error_page_url_ = url; | 4426 alternate_error_page_url_ = url; |
4427 } | 4427 } |
4428 | 4428 |
4429 void RenderView::OnCustomContextMenuAction( | 4429 void RenderView::OnCustomContextMenuAction( |
(...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5394 const webkit_glue::CustomContextMenuContext& custom_context) { | 5394 const webkit_glue::CustomContextMenuContext& custom_context) { |
5395 if (custom_context.is_pepper_menu) | 5395 if (custom_context.is_pepper_menu) |
5396 pepper_delegate_.OnContextMenuClosed(custom_context); | 5396 pepper_delegate_.OnContextMenuClosed(custom_context); |
5397 else | 5397 else |
5398 context_menu_node_.reset(); | 5398 context_menu_node_.reset(); |
5399 } | 5399 } |
5400 | 5400 |
5401 void RenderView::OnNetworkStateChanged(bool online) { | 5401 void RenderView::OnNetworkStateChanged(bool online) { |
5402 WebNetworkStateNotifier::setOnLine(online); | 5402 WebNetworkStateNotifier::setOnLine(online); |
5403 } | 5403 } |
OLD | NEW |