| 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/browser/renderer_host/render_view_host.h" | 5 #include "content/browser/renderer_host/render_view_host.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "chrome/common/url_constants.h" | 32 #include "chrome/common/url_constants.h" |
| 33 #include "chrome/common/web_apps.h" | 33 #include "chrome/common/web_apps.h" |
| 34 #include "content/browser/child_process_security_policy.h" | 34 #include "content/browser/child_process_security_policy.h" |
| 35 #include "content/browser/cross_site_request_manager.h" | 35 #include "content/browser/cross_site_request_manager.h" |
| 36 #include "content/browser/in_process_webkit/session_storage_namespace.h" | 36 #include "content/browser/in_process_webkit/session_storage_namespace.h" |
| 37 #include "content/browser/renderer_host/render_process_host.h" | 37 #include "content/browser/renderer_host/render_process_host.h" |
| 38 #include "content/browser/renderer_host/render_view_host_delegate.h" | 38 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| 39 #include "content/browser/renderer_host/render_widget_host.h" | 39 #include "content/browser/renderer_host/render_widget_host.h" |
| 40 #include "content/browser/renderer_host/render_widget_host_view.h" | 40 #include "content/browser/renderer_host/render_widget_host_view.h" |
| 41 #include "content/browser/site_instance.h" | 41 #include "content/browser/site_instance.h" |
| 42 #include "content/common/drag_messages.h" |
| 42 #include "content/common/native_web_keyboard_event.h" | 43 #include "content/common/native_web_keyboard_event.h" |
| 43 #include "content/common/notification_details.h" | 44 #include "content/common/notification_details.h" |
| 44 #include "content/common/notification_service.h" | 45 #include "content/common/notification_service.h" |
| 45 #include "content/common/notification_type.h" | 46 #include "content/common/notification_type.h" |
| 46 #include "content/common/result_codes.h" | 47 #include "content/common/result_codes.h" |
| 47 #include "content/common/view_messages.h" | 48 #include "content/common/view_messages.h" |
| 48 #include "net/base/net_util.h" | 49 #include "net/base/net_util.h" |
| 49 #include "third_party/skia/include/core/SkBitmap.h" | 50 #include "third_party/skia/include/core/SkBitmap.h" |
| 50 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h" | 51 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h" |
| 51 #include "ui/gfx/native_widget_types.h" | 52 #include "ui/gfx/native_widget_types.h" |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 ChildProcessSecurityPolicy* policy = | 442 ChildProcessSecurityPolicy* policy = |
| 442 ChildProcessSecurityPolicy::GetInstance(); | 443 ChildProcessSecurityPolicy::GetInstance(); |
| 443 policy->GrantRequestURL(process()->id(), drop_data.url); | 444 policy->GrantRequestURL(process()->id(), drop_data.url); |
| 444 for (std::vector<string16>::const_iterator iter(drop_data.filenames.begin()); | 445 for (std::vector<string16>::const_iterator iter(drop_data.filenames.begin()); |
| 445 iter != drop_data.filenames.end(); ++iter) { | 446 iter != drop_data.filenames.end(); ++iter) { |
| 446 FilePath path = FilePath::FromWStringHack(UTF16ToWideHack(*iter)); | 447 FilePath path = FilePath::FromWStringHack(UTF16ToWideHack(*iter)); |
| 447 policy->GrantRequestURL(process()->id(), | 448 policy->GrantRequestURL(process()->id(), |
| 448 net::FilePathToFileURL(path)); | 449 net::FilePathToFileURL(path)); |
| 449 policy->GrantReadFile(process()->id(), path); | 450 policy->GrantReadFile(process()->id(), path); |
| 450 } | 451 } |
| 451 Send(new ViewMsg_DragTargetDragEnter(routing_id(), drop_data, client_pt, | 452 Send(new DragMsg_TargetDragEnter(routing_id(), drop_data, client_pt, |
| 452 screen_pt, operations_allowed)); | 453 screen_pt, operations_allowed)); |
| 453 } | 454 } |
| 454 | 455 |
| 455 void RenderViewHost::DragTargetDragOver( | 456 void RenderViewHost::DragTargetDragOver( |
| 456 const gfx::Point& client_pt, const gfx::Point& screen_pt, | 457 const gfx::Point& client_pt, const gfx::Point& screen_pt, |
| 457 WebDragOperationsMask operations_allowed) { | 458 WebDragOperationsMask operations_allowed) { |
| 458 Send(new ViewMsg_DragTargetDragOver(routing_id(), client_pt, screen_pt, | 459 Send(new DragMsg_TargetDragOver(routing_id(), client_pt, screen_pt, |
| 459 operations_allowed)); | 460 operations_allowed)); |
| 460 } | 461 } |
| 461 | 462 |
| 462 void RenderViewHost::DragTargetDragLeave() { | 463 void RenderViewHost::DragTargetDragLeave() { |
| 463 Send(new ViewMsg_DragTargetDragLeave(routing_id())); | 464 Send(new DragMsg_TargetDragLeave(routing_id())); |
| 464 } | 465 } |
| 465 | 466 |
| 466 void RenderViewHost::DragTargetDrop( | 467 void RenderViewHost::DragTargetDrop( |
| 467 const gfx::Point& client_pt, const gfx::Point& screen_pt) { | 468 const gfx::Point& client_pt, const gfx::Point& screen_pt) { |
| 468 Send(new ViewMsg_DragTargetDrop(routing_id(), client_pt, screen_pt)); | 469 Send(new DragMsg_TargetDrop(routing_id(), client_pt, screen_pt)); |
| 469 } | 470 } |
| 470 | 471 |
| 471 void RenderViewHost::ReservePageIDRange(int size) { | 472 void RenderViewHost::ReservePageIDRange(int size) { |
| 472 Send(new ViewMsg_ReservePageIDRange(routing_id(), size)); | 473 Send(new ViewMsg_ReservePageIDRange(routing_id(), size)); |
| 473 } | 474 } |
| 474 | 475 |
| 475 void RenderViewHost::ExecuteJavascriptInWebFrame( | 476 void RenderViewHost::ExecuteJavascriptInWebFrame( |
| 476 const string16& frame_xpath, | 477 const string16& frame_xpath, |
| 477 const string16& jscript) { | 478 const string16& jscript) { |
| 478 Send(new ViewMsg_ScriptEvalRequest(routing_id(), frame_xpath, jscript, | 479 Send(new ViewMsg_ScriptEvalRequest(routing_id(), frame_xpath, jscript, |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 delegate_->RendererUnresponsive(this, is_waiting); | 581 delegate_->RendererUnresponsive(this, is_waiting); |
| 581 } | 582 } |
| 582 | 583 |
| 583 void RenderViewHost::CopyImageAt(int x, int y) { | 584 void RenderViewHost::CopyImageAt(int x, int y) { |
| 584 Send(new ViewMsg_CopyImageAt(routing_id(), x, y)); | 585 Send(new ViewMsg_CopyImageAt(routing_id(), x, y)); |
| 585 } | 586 } |
| 586 | 587 |
| 587 void RenderViewHost::DragSourceEndedAt( | 588 void RenderViewHost::DragSourceEndedAt( |
| 588 int client_x, int client_y, int screen_x, int screen_y, | 589 int client_x, int client_y, int screen_x, int screen_y, |
| 589 WebDragOperation operation) { | 590 WebDragOperation operation) { |
| 590 Send(new ViewMsg_DragSourceEndedOrMoved( | 591 Send(new DragMsg_SourceEndedOrMoved( |
| 591 routing_id(), | 592 routing_id(), |
| 592 gfx::Point(client_x, client_y), | 593 gfx::Point(client_x, client_y), |
| 593 gfx::Point(screen_x, screen_y), | 594 gfx::Point(screen_x, screen_y), |
| 594 true, operation)); | 595 true, operation)); |
| 595 } | 596 } |
| 596 | 597 |
| 597 void RenderViewHost::DragSourceMovedTo( | 598 void RenderViewHost::DragSourceMovedTo( |
| 598 int client_x, int client_y, int screen_x, int screen_y) { | 599 int client_x, int client_y, int screen_x, int screen_y) { |
| 599 Send(new ViewMsg_DragSourceEndedOrMoved( | 600 Send(new DragMsg_SourceEndedOrMoved( |
| 600 routing_id(), | 601 routing_id(), |
| 601 gfx::Point(client_x, client_y), | 602 gfx::Point(client_x, client_y), |
| 602 gfx::Point(screen_x, screen_y), | 603 gfx::Point(screen_x, screen_y), |
| 603 false, WebDragOperationNone)); | 604 false, WebDragOperationNone)); |
| 604 } | 605 } |
| 605 | 606 |
| 606 void RenderViewHost::DragSourceSystemDragEnded() { | 607 void RenderViewHost::DragSourceSystemDragEnded() { |
| 607 Send(new ViewMsg_DragSourceSystemDragEnded(routing_id())); | 608 Send(new DragMsg_SourceSystemDragEnded(routing_id())); |
| 608 } | 609 } |
| 609 | 610 |
| 610 void RenderViewHost::AllowBindings(int bindings_flags) { | 611 void RenderViewHost::AllowBindings(int bindings_flags) { |
| 611 DCHECK(!renderer_initialized_); | 612 DCHECK(!renderer_initialized_); |
| 612 enabled_bindings_ |= bindings_flags; | 613 enabled_bindings_ |= bindings_flags; |
| 613 } | 614 } |
| 614 | 615 |
| 615 void RenderViewHost::SetWebUIProperty(const std::string& name, | 616 void RenderViewHost::SetWebUIProperty(const std::string& name, |
| 616 const std::string& value) { | 617 const std::string& value) { |
| 617 DCHECK(BindingsPolicy::is_web_ui_enabled(enabled_bindings_)); | 618 DCHECK(BindingsPolicy::is_web_ui_enabled(enabled_bindings_)); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 IPC_MESSAGE_HANDLER(ViewHostMsg_DomOperationResponse, | 747 IPC_MESSAGE_HANDLER(ViewHostMsg_DomOperationResponse, |
| 747 OnMsgDomOperationResponse) | 748 OnMsgDomOperationResponse) |
| 748 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnMsgWebUISend) | 749 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnMsgWebUISend) |
| 749 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardMessageToExternalHost, | 750 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardMessageToExternalHost, |
| 750 OnMsgForwardMessageToExternalHost) | 751 OnMsgForwardMessageToExternalHost) |
| 751 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText) | 752 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText) |
| 752 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunJavaScriptMessage, | 753 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunJavaScriptMessage, |
| 753 OnMsgRunJavaScriptMessage) | 754 OnMsgRunJavaScriptMessage) |
| 754 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunBeforeUnloadConfirm, | 755 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunBeforeUnloadConfirm, |
| 755 OnMsgRunBeforeUnloadConfirm) | 756 OnMsgRunBeforeUnloadConfirm) |
| 756 IPC_MESSAGE_HANDLER(ViewHostMsg_StartDragging, OnMsgStartDragging) | 757 IPC_MESSAGE_HANDLER(DragHostMsg_StartDragging, OnMsgStartDragging) |
| 757 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateDragCursor, OnUpdateDragCursor) | 758 IPC_MESSAGE_HANDLER(DragHostMsg_UpdateDragCursor, OnUpdateDragCursor) |
| 758 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) | 759 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) |
| 759 IPC_MESSAGE_HANDLER(ViewHostMsg_AddMessageToConsole, OnAddMessageToConsole) | 760 IPC_MESSAGE_HANDLER(ViewHostMsg_AddMessageToConsole, OnAddMessageToConsole) |
| 760 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardToDevToolsAgent, | 761 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardToDevToolsAgent, |
| 761 OnForwardToDevToolsAgent) | 762 OnForwardToDevToolsAgent) |
| 762 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardToDevToolsClient, | 763 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardToDevToolsClient, |
| 763 OnForwardToDevToolsClient) | 764 OnForwardToDevToolsClient) |
| 764 IPC_MESSAGE_HANDLER(ViewHostMsg_ActivateDevToolsWindow, | 765 IPC_MESSAGE_HANDLER(ViewHostMsg_ActivateDevToolsWindow, |
| 765 OnActivateDevToolsWindow) | 766 OnActivateDevToolsWindow) |
| 766 IPC_MESSAGE_HANDLER(ViewHostMsg_CloseDevToolsWindow, | 767 IPC_MESSAGE_HANDLER(ViewHostMsg_CloseDevToolsWindow, |
| 767 OnCloseDevToolsWindow) | 768 OnCloseDevToolsWindow) |
| (...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1674 LOG(DFATAL) << "Invalid checked state " << checked_state; | 1675 LOG(DFATAL) << "Invalid checked state " << checked_state; |
| 1675 return; | 1676 return; |
| 1676 } | 1677 } |
| 1677 | 1678 |
| 1678 CommandState state; | 1679 CommandState state; |
| 1679 state.is_enabled = is_enabled; | 1680 state.is_enabled = is_enabled; |
| 1680 state.checked_state = | 1681 state.checked_state = |
| 1681 static_cast<RenderViewCommandCheckedState>(checked_state); | 1682 static_cast<RenderViewCommandCheckedState>(checked_state); |
| 1682 command_states_[static_cast<RenderViewCommand>(command)] = state; | 1683 command_states_[static_cast<RenderViewCommand>(command)] = state; |
| 1683 } | 1684 } |
| OLD | NEW |