| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/browser/renderer_host/render_view_host.h" | 5 #include "chrome/browser/renderer_host/render_view_host.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #if defined(OS_WIN) | 42 #if defined(OS_WIN) |
| 43 // TODO(port): accessibility not yet implemented. See http://crbug.com/8288. | 43 // TODO(port): accessibility not yet implemented. See http://crbug.com/8288. |
| 44 #include "chrome/browser/browser_accessibility_manager.h" | 44 #include "chrome/browser/browser_accessibility_manager.h" |
| 45 // TODO(port): The compact language detection library works only for Windows. | 45 // TODO(port): The compact language detection library works only for Windows. |
| 46 #include "third_party/cld/bar/toolbar/cld/i18n/encodings/compact_lang_det/win/cl
d_unicodetext.h" | 46 #include "third_party/cld/bar/toolbar/cld/i18n/encodings/compact_lang_det/win/cl
d_unicodetext.h" |
| 47 #endif | 47 #endif |
| 48 | 48 |
| 49 using base::TimeDelta; | 49 using base::TimeDelta; |
| 50 using webkit_glue::PasswordFormDomManager; | 50 using webkit_glue::PasswordFormDomManager; |
| 51 using WebKit::WebConsoleMessage; | 51 using WebKit::WebConsoleMessage; |
| 52 using WebKit::WebDragOperation; |
| 53 using WebKit::WebDragOperationNone; |
| 54 using WebKit::WebDragOperationsMask; |
| 52 using WebKit::WebFindOptions; | 55 using WebKit::WebFindOptions; |
| 53 using WebKit::WebInputEvent; | 56 using WebKit::WebInputEvent; |
| 54 using WebKit::WebTextDirection; | 57 using WebKit::WebTextDirection; |
| 55 | 58 |
| 56 namespace { | 59 namespace { |
| 57 | 60 |
| 58 void FilterURL(ChildProcessSecurityPolicy* policy, int renderer_id, GURL* url) { | 61 void FilterURL(ChildProcessSecurityPolicy* policy, int renderer_id, GURL* url) { |
| 59 if (!url->is_valid()) | 62 if (!url->is_valid()) |
| 60 return; // We don't need to block invalid URLs. | 63 return; // We don't need to block invalid URLs. |
| 61 | 64 |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 } | 456 } |
| 454 | 457 |
| 455 void RenderViewHost::FillPasswordForm( | 458 void RenderViewHost::FillPasswordForm( |
| 456 const PasswordFormDomManager::FillData& form_data) { | 459 const PasswordFormDomManager::FillData& form_data) { |
| 457 Send(new ViewMsg_FillPasswordForm(routing_id(), form_data)); | 460 Send(new ViewMsg_FillPasswordForm(routing_id(), form_data)); |
| 458 } | 461 } |
| 459 | 462 |
| 460 void RenderViewHost::DragTargetDragEnter( | 463 void RenderViewHost::DragTargetDragEnter( |
| 461 const WebDropData& drop_data, | 464 const WebDropData& drop_data, |
| 462 const gfx::Point& client_pt, | 465 const gfx::Point& client_pt, |
| 463 const gfx::Point& screen_pt) { | 466 const gfx::Point& screen_pt, |
| 467 WebDragOperationsMask operations_allowed) { |
| 464 // Grant the renderer the ability to load the drop_data. | 468 // Grant the renderer the ability to load the drop_data. |
| 465 ChildProcessSecurityPolicy* policy = | 469 ChildProcessSecurityPolicy* policy = |
| 466 ChildProcessSecurityPolicy::GetInstance(); | 470 ChildProcessSecurityPolicy::GetInstance(); |
| 467 policy->GrantRequestURL(process()->id(), drop_data.url); | 471 policy->GrantRequestURL(process()->id(), drop_data.url); |
| 468 for (std::vector<string16>::const_iterator iter(drop_data.filenames.begin()); | 472 for (std::vector<string16>::const_iterator iter(drop_data.filenames.begin()); |
| 469 iter != drop_data.filenames.end(); ++iter) { | 473 iter != drop_data.filenames.end(); ++iter) { |
| 470 FilePath path = FilePath::FromWStringHack(UTF16ToWideHack(*iter)); | 474 FilePath path = FilePath::FromWStringHack(UTF16ToWideHack(*iter)); |
| 471 policy->GrantRequestURL(process()->id(), | 475 policy->GrantRequestURL(process()->id(), |
| 472 net::FilePathToFileURL(path)); | 476 net::FilePathToFileURL(path)); |
| 473 policy->GrantUploadFile(process()->id(), path); | 477 policy->GrantUploadFile(process()->id(), path); |
| 474 } | 478 } |
| 475 Send(new ViewMsg_DragTargetDragEnter(routing_id(), drop_data, client_pt, | 479 Send(new ViewMsg_DragTargetDragEnter(routing_id(), drop_data, client_pt, |
| 476 screen_pt)); | 480 screen_pt, operations_allowed)); |
| 477 } | 481 } |
| 478 | 482 |
| 479 void RenderViewHost::DragTargetDragOver( | 483 void RenderViewHost::DragTargetDragOver( |
| 480 const gfx::Point& client_pt, const gfx::Point& screen_pt) { | 484 const gfx::Point& client_pt, const gfx::Point& screen_pt, |
| 481 Send(new ViewMsg_DragTargetDragOver(routing_id(), client_pt, screen_pt)); | 485 WebDragOperationsMask operations_allowed) { |
| 486 Send(new ViewMsg_DragTargetDragOver(routing_id(), client_pt, screen_pt, |
| 487 operations_allowed)); |
| 482 } | 488 } |
| 483 | 489 |
| 484 void RenderViewHost::DragTargetDragLeave() { | 490 void RenderViewHost::DragTargetDragLeave() { |
| 485 Send(new ViewMsg_DragTargetDragLeave(routing_id())); | 491 Send(new ViewMsg_DragTargetDragLeave(routing_id())); |
| 486 } | 492 } |
| 487 | 493 |
| 488 void RenderViewHost::DragTargetDrop( | 494 void RenderViewHost::DragTargetDrop( |
| 489 const gfx::Point& client_pt, const gfx::Point& screen_pt) { | 495 const gfx::Point& client_pt, const gfx::Point& screen_pt) { |
| 490 Send(new ViewMsg_DragTargetDrop(routing_id(), client_pt, screen_pt)); | 496 Send(new ViewMsg_DragTargetDrop(routing_id(), client_pt, screen_pt)); |
| 491 } | 497 } |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 ResetModalDialogEvent(); | 607 ResetModalDialogEvent(); |
| 602 | 608 |
| 603 ViewHostMsg_ShowModalHTMLDialog::WriteReplyParams(reply_msg, json_retval); | 609 ViewHostMsg_ShowModalHTMLDialog::WriteReplyParams(reply_msg, json_retval); |
| 604 Send(reply_msg); | 610 Send(reply_msg); |
| 605 } | 611 } |
| 606 | 612 |
| 607 void RenderViewHost::CopyImageAt(int x, int y) { | 613 void RenderViewHost::CopyImageAt(int x, int y) { |
| 608 Send(new ViewMsg_CopyImageAt(routing_id(), x, y)); | 614 Send(new ViewMsg_CopyImageAt(routing_id(), x, y)); |
| 609 } | 615 } |
| 610 | 616 |
| 611 void RenderViewHost::DragSourceCancelledAt( | 617 void RenderViewHost::DragSourceEndedAt( |
| 612 int client_x, int client_y, int screen_x, int screen_y) { | 618 int client_x, int client_y, int screen_x, int screen_y, |
| 619 WebDragOperation operation) { |
| 613 Send(new ViewMsg_DragSourceEndedOrMoved( | 620 Send(new ViewMsg_DragSourceEndedOrMoved( |
| 614 routing_id(), | 621 routing_id(), |
| 615 gfx::Point(client_x, client_y), | 622 gfx::Point(client_x, client_y), |
| 616 gfx::Point(screen_x, screen_y), | 623 gfx::Point(screen_x, screen_y), |
| 617 true, true)); | 624 true, operation)); |
| 618 } | |
| 619 | |
| 620 void RenderViewHost::DragSourceEndedAt( | |
| 621 int client_x, int client_y, int screen_x, int screen_y) { | |
| 622 Send(new ViewMsg_DragSourceEndedOrMoved( | |
| 623 routing_id(), | |
| 624 gfx::Point(client_x, client_y), | |
| 625 gfx::Point(screen_x, screen_y), | |
| 626 true, false)); | |
| 627 } | 625 } |
| 628 | 626 |
| 629 void RenderViewHost::DragSourceMovedTo( | 627 void RenderViewHost::DragSourceMovedTo( |
| 630 int client_x, int client_y, int screen_x, int screen_y) { | 628 int client_x, int client_y, int screen_x, int screen_y) { |
| 631 Send(new ViewMsg_DragSourceEndedOrMoved( | 629 Send(new ViewMsg_DragSourceEndedOrMoved( |
| 632 routing_id(), | 630 routing_id(), |
| 633 gfx::Point(client_x, client_y), | 631 gfx::Point(client_x, client_y), |
| 634 gfx::Point(screen_x, screen_y), | 632 gfx::Point(screen_x, screen_y), |
| 635 false, false)); | 633 false, WebDragOperationNone)); |
| 636 } | 634 } |
| 637 | 635 |
| 638 void RenderViewHost::DragSourceSystemDragEnded() { | 636 void RenderViewHost::DragSourceSystemDragEnded() { |
| 639 Send(new ViewMsg_DragSourceSystemDragEnded(routing_id())); | 637 Send(new ViewMsg_DragSourceSystemDragEnded(routing_id())); |
| 640 } | 638 } |
| 641 | 639 |
| 642 void RenderViewHost::AllowBindings(int bindings_flags) { | 640 void RenderViewHost::AllowBindings(int bindings_flags) { |
| 643 DCHECK(!renderer_initialized_); | 641 DCHECK(!renderer_initialized_); |
| 644 enabled_bindings_ |= bindings_flags; | 642 enabled_bindings_ |= bindings_flags; |
| 645 } | 643 } |
| (...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1324 | 1322 |
| 1325 void RenderViewHost::OnMsgAutofillFormSubmitted( | 1323 void RenderViewHost::OnMsgAutofillFormSubmitted( |
| 1326 const webkit_glue::AutofillForm& form) { | 1324 const webkit_glue::AutofillForm& form) { |
| 1327 RenderViewHostDelegate::Autofill* autofill_delegate = | 1325 RenderViewHostDelegate::Autofill* autofill_delegate = |
| 1328 delegate_->GetAutofillDelegate(); | 1326 delegate_->GetAutofillDelegate(); |
| 1329 if (autofill_delegate) | 1327 if (autofill_delegate) |
| 1330 autofill_delegate->AutofillFormSubmitted(form); | 1328 autofill_delegate->AutofillFormSubmitted(form); |
| 1331 } | 1329 } |
| 1332 | 1330 |
| 1333 void RenderViewHost::OnMsgStartDragging( | 1331 void RenderViewHost::OnMsgStartDragging( |
| 1334 const WebDropData& drop_data) { | 1332 const WebDropData& drop_data, |
| 1333 WebDragOperationsMask drag_operations_mask) { |
| 1335 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); | 1334 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); |
| 1336 if (view) | 1335 if (view) |
| 1337 view->StartDragging(drop_data); | 1336 view->StartDragging(drop_data, drag_operations_mask); |
| 1338 } | 1337 } |
| 1339 | 1338 |
| 1340 void RenderViewHost::OnUpdateDragCursor(bool is_drop_target) { | 1339 void RenderViewHost::OnUpdateDragCursor(WebDragOperation current_op) { |
| 1341 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); | 1340 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); |
| 1342 if (view) | 1341 if (view) |
| 1343 view->UpdateDragCursor(is_drop_target); | 1342 view->UpdateDragCursor(current_op); |
| 1344 } | 1343 } |
| 1345 | 1344 |
| 1346 void RenderViewHost::OnTakeFocus(bool reverse) { | 1345 void RenderViewHost::OnTakeFocus(bool reverse) { |
| 1347 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); | 1346 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); |
| 1348 if (view) | 1347 if (view) |
| 1349 view->TakeFocus(reverse); | 1348 view->TakeFocus(reverse); |
| 1350 } | 1349 } |
| 1351 | 1350 |
| 1352 void RenderViewHost::OnMsgPageHasOSDD(int32 page_id, const GURL& doc_url, | 1351 void RenderViewHost::OnMsgPageHasOSDD(int32 page_id, const GURL& doc_url, |
| 1353 bool autodetected) { | 1352 bool autodetected) { |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1650 } | 1649 } |
| 1651 | 1650 |
| 1652 void RenderViewHost::ResetModalDialogEvent() { | 1651 void RenderViewHost::ResetModalDialogEvent() { |
| 1653 if (--modal_dialog_count_ == 0) | 1652 if (--modal_dialog_count_ == 0) |
| 1654 modal_dialog_event_->Reset(); | 1653 modal_dialog_event_->Reset(); |
| 1655 } | 1654 } |
| 1656 | 1655 |
| 1657 void RenderViewHost::UpdateBrowserWindowId(int window_id) { | 1656 void RenderViewHost::UpdateBrowserWindowId(int window_id) { |
| 1658 Send(new ViewMsg_UpdateBrowserWindowId(routing_id(), window_id)); | 1657 Send(new ViewMsg_UpdateBrowserWindowId(routing_id(), window_id)); |
| 1659 } | 1658 } |
| OLD | NEW |