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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
500 for (uint32_t i = 0 ; i < length ; ++i) { | 500 for (uint32_t i = 0 ; i < length ; ++i) { |
501 list->Set(i, ConvertV8Value(array->Get(i))); | 501 list->Set(i, ConvertV8Value(array->Get(i))); |
502 } | 502 } |
503 return list.release(); | 503 return list.release(); |
504 } | 504 } |
505 return Value::CreateNullValue(); | 505 return Value::CreateNullValue(); |
506 } | 506 } |
507 | 507 |
508 /////////////////////////////////////////////////////////////////////////////// | 508 /////////////////////////////////////////////////////////////////////////////// |
509 | 509 |
510 RenderView::Observer::Observer() : render_view_(NULL), routing_id_(0) { | |
511 } | |
512 | |
513 RenderView::Observer::~Observer() { | |
514 if (render_view_) | |
515 render_view_->RemoveObserver(this); | |
516 } | |
517 | |
518 void RenderView::Observer::OnDestruct() { | |
519 delete this; | |
520 } | |
521 | |
522 bool RenderView::Observer::OnMessageReceived(const IPC::Message& message) { | |
523 return false; | |
524 } | |
525 | |
526 bool RenderView::Observer::Send(IPC::Message* message) { | |
527 if (render_view_) | |
528 return render_view_->Send(message); | |
529 | |
530 delete message; | |
531 return false; | |
532 } | |
533 | |
534 void RenderView::Observer::SetRenderView(RenderView* render_view) { | |
535 render_view_ = render_view; | |
536 if (render_view_) | |
537 routing_id_ = render_view_->routing_id(); | |
538 } | |
539 | |
510 int32 RenderView::next_page_id_ = 1; | 540 int32 RenderView::next_page_id_ = 1; |
511 | 541 |
512 struct RenderView::PendingFileChooser { | 542 struct RenderView::PendingFileChooser { |
513 PendingFileChooser(const ViewHostMsg_RunFileChooser_Params& p, | 543 PendingFileChooser(const ViewHostMsg_RunFileChooser_Params& p, |
514 WebFileChooserCompletion* c) | 544 WebFileChooserCompletion* c) |
515 : params(p), | 545 : params(p), |
516 completion(c) { | 546 completion(c) { |
517 } | 547 } |
518 ViewHostMsg_RunFileChooser_Params params; | 548 ViewHostMsg_RunFileChooser_Params params; |
519 WebFileChooserCompletion* completion; // MAY BE NULL to skip callback. | 549 WebFileChooserCompletion* completion; // MAY BE NULL to skip callback. |
(...skipping 21 matching lines...) Expand all Loading... | |
541 #if defined(OS_MACOSX) | 571 #if defined(OS_MACOSX) |
542 has_document_tag_(false), | 572 has_document_tag_(false), |
543 #endif | 573 #endif |
544 document_tag_(0), | 574 document_tag_(0), |
545 target_url_status_(TARGET_NONE), | 575 target_url_status_(TARGET_NONE), |
546 spelling_panel_visible_(false), | 576 spelling_panel_visible_(false), |
547 view_type_(ViewType::INVALID), | 577 view_type_(ViewType::INVALID), |
548 browser_window_id_(-1), | 578 browser_window_id_(-1), |
549 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)), | 579 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)), |
550 ALLOW_THIS_IN_INITIALIZER_LIST(page_info_method_factory_(this)), | 580 ALLOW_THIS_IN_INITIALIZER_LIST(page_info_method_factory_(this)), |
551 ALLOW_THIS_IN_INITIALIZER_LIST(autofill_method_factory_(this)), | |
552 ALLOW_THIS_IN_INITIALIZER_LIST(accessibility_method_factory_(this)), | 581 ALLOW_THIS_IN_INITIALIZER_LIST(accessibility_method_factory_(this)), |
553 ALLOW_THIS_IN_INITIALIZER_LIST(translate_helper_(this)), | 582 ALLOW_THIS_IN_INITIALIZER_LIST(translate_helper_(this)), |
554 ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)), | 583 ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)), |
584 devtools_agent_(NULL), | |
585 devtools_client_(NULL), | |
555 ALLOW_THIS_IN_INITIALIZER_LIST( | 586 ALLOW_THIS_IN_INITIALIZER_LIST( |
556 notification_provider_(new NotificationProvider(this))), | 587 notification_provider_(new NotificationProvider())), |
588 geolocation_dispatcher_(NULL), | |
589 speech_input_dispatcher_(NULL), | |
590 device_orientation_dispatcher_(NULL), | |
557 accessibility_ack_pending_(false), | 591 accessibility_ack_pending_(false), |
558 pending_app_icon_requests_(0), | 592 pending_app_icon_requests_(0), |
559 session_storage_namespace_id_(session_storage_namespace_id), | 593 session_storage_namespace_id_(session_storage_namespace_id), |
560 decrement_shared_popup_at_destruction_(false), | 594 decrement_shared_popup_at_destruction_(false), |
561 custom_menu_listener_(NULL) { | 595 custom_menu_listener_(NULL) { |
562 #if defined(OS_MACOSX) | 596 #if defined(OS_MACOSX) |
563 // On Mac, the select popups are rendered by the browser. | 597 // On Mac, the select popups are rendered by the browser. |
564 // Note that we don't do this in RenderMain otherwise this would not be called | 598 // Note that we don't do this in RenderMain otherwise this would not be called |
565 // in single-process mode. | 599 // in single-process mode. |
566 WebKit::WebView::setUseExternalPopupMenus(true); | 600 WebKit::WebView::setUseExternalPopupMenus(true); |
567 #endif | 601 #endif |
568 password_autocomplete_manager_.reset(new PasswordAutocompleteManager(this)); | 602 |
569 autofill_helper_.reset(new AutoFillHelper(this)); | |
570 page_click_tracker_.reset(new PageClickTracker(this)); | |
571 // Note that the order of insertion of the listeners is important. | |
572 // The password_autocomplete_manager_ takes the first shot at processing the | |
573 // notification and can stop the propagation. | |
574 page_click_tracker_->AddListener(password_autocomplete_manager_.get()); | |
575 page_click_tracker_->AddListener(autofill_helper_.get()); | |
576 ClearBlockedContentSettings(); | 603 ClearBlockedContentSettings(); |
577 if (CommandLine::ForCurrentProcess()->HasSwitch( | 604 if (CommandLine::ForCurrentProcess()->HasSwitch( |
578 switches::kEnableClientSidePhishingDetection)) { | 605 switches::kEnableClientSidePhishingDetection)) { |
579 phishing_delegate_.reset( | 606 phishing_delegate_.reset( |
580 new safe_browsing::PhishingClassifierDelegate(this, NULL)); | 607 new safe_browsing::PhishingClassifierDelegate(this, NULL)); |
581 RenderThread* thread = RenderThread::current(); | 608 RenderThread* thread = RenderThread::current(); |
582 if (thread && thread->phishing_scorer()) { | 609 if (thread && thread->phishing_scorer()) { |
583 phishing_delegate_->SetPhishingScorer(thread->phishing_scorer()); | 610 phishing_delegate_->SetPhishingScorer(thread->phishing_scorer()); |
584 } | 611 } |
585 } | 612 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
617 // Tell the PhishingClassifierDelegate that the view is going away. | 644 // Tell the PhishingClassifierDelegate that the view is going away. |
618 if (phishing_delegate_.get()) | 645 if (phishing_delegate_.get()) |
619 phishing_delegate_->CancelPendingClassification(); | 646 phishing_delegate_->CancelPendingClassification(); |
620 | 647 |
621 #ifndef NDEBUG | 648 #ifndef NDEBUG |
622 // Make sure we are no longer referenced by the ViewMap. | 649 // Make sure we are no longer referenced by the ViewMap. |
623 ViewMap* views = g_view_map.Pointer(); | 650 ViewMap* views = g_view_map.Pointer(); |
624 for (ViewMap::iterator it = views->begin(); it != views->end(); ++it) | 651 for (ViewMap::iterator it = views->begin(); it != views->end(); ++it) |
625 DCHECK_NE(this, it->second) << "Failed to call Close?"; | 652 DCHECK_NE(this, it->second) << "Failed to call Close?"; |
626 #endif | 653 #endif |
654 | |
655 for (size_t i = 0; i < observers_.size(); ++i) { | |
656 observers_[i]->SetRenderView(NULL); | |
657 observers_[i]->OnDestruct(); | |
658 } | |
627 } | 659 } |
628 | 660 |
629 /*static*/ | 661 /*static*/ |
630 void RenderView::ForEach(RenderViewVisitor* visitor) { | 662 void RenderView::ForEach(RenderViewVisitor* visitor) { |
631 ViewMap* views = g_view_map.Pointer(); | 663 ViewMap* views = g_view_map.Pointer(); |
632 for (ViewMap::iterator it = views->begin(); it != views->end(); ++it) { | 664 for (ViewMap::iterator it = views->begin(); it != views->end(); ++it) { |
633 if (!visitor->Visit(it->second)) | 665 if (!visitor->Visit(it->second)) |
634 return; | 666 return; |
635 } | 667 } |
636 } | 668 } |
(...skipping 30 matching lines...) Expand all Loading... | |
667 | 699 |
668 // static | 700 // static |
669 void RenderView::SetNextPageID(int32 next_page_id) { | 701 void RenderView::SetNextPageID(int32 next_page_id) { |
670 // This method should only be called during process startup, and the given | 702 // This method should only be called during process startup, and the given |
671 // page id had better not exceed our current next page id! | 703 // page id had better not exceed our current next page id! |
672 DCHECK_EQ(next_page_id_, 1); | 704 DCHECK_EQ(next_page_id_, 1); |
673 DCHECK(next_page_id >= next_page_id_); | 705 DCHECK(next_page_id >= next_page_id_); |
674 next_page_id_ = next_page_id; | 706 next_page_id_ = next_page_id; |
675 } | 707 } |
676 | 708 |
709 void RenderView::AddObserver(Observer* observer) { | |
710 observers_.push_back(observer); | |
711 observer->SetRenderView(this); | |
712 } | |
713 | |
714 void RenderView::RemoveObserver(Observer* observer) { | |
715 observer->SetRenderView(NULL); | |
716 for (size_t i = 0; i < observers_.size(); ++i) { | |
717 if (observers_[i] == observer) | |
718 observers_.erase(observers_.begin() + i); | |
719 } | |
720 } | |
721 | |
677 bool RenderView::RendererAccessibilityNotification::ShouldIncludeChildren() { | 722 bool RenderView::RendererAccessibilityNotification::ShouldIncludeChildren() { |
678 typedef ViewHostMsg_AccessibilityNotification_Params params; | 723 typedef ViewHostMsg_AccessibilityNotification_Params params; |
679 if (type == params::NOTIFICATION_TYPE_CHILDREN_CHANGED || | 724 if (type == params::NOTIFICATION_TYPE_CHILDREN_CHANGED || |
680 type == params::NOTIFICATION_TYPE_LOAD_COMPLETE) { | 725 type == params::NOTIFICATION_TYPE_LOAD_COMPLETE) { |
681 return true; | 726 return true; |
682 } | 727 } |
683 return false; | 728 return false; |
684 } | 729 } |
685 | 730 |
686 WebKit::WebView* RenderView::webview() const { | 731 WebKit::WebView* RenderView::webview() const { |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
895 } | 940 } |
896 | 941 |
897 void RenderView::Init(gfx::NativeViewId parent_hwnd, | 942 void RenderView::Init(gfx::NativeViewId parent_hwnd, |
898 int32 opener_id, | 943 int32 opener_id, |
899 const RendererPreferences& renderer_prefs, | 944 const RendererPreferences& renderer_prefs, |
900 SharedRenderViewCounter* counter, | 945 SharedRenderViewCounter* counter, |
901 int32 routing_id, | 946 int32 routing_id, |
902 const string16& frame_name) { | 947 const string16& frame_name) { |
903 DCHECK(!webview()); | 948 DCHECK(!webview()); |
904 | 949 |
950 routing_id_ = routing_id; | |
905 if (opener_id != MSG_ROUTING_NONE) | 951 if (opener_id != MSG_ROUTING_NONE) |
906 opener_id_ = opener_id; | 952 opener_id_ = opener_id; |
907 | 953 |
908 if (counter) { | 954 if (counter) { |
909 shared_popup_counter_ = counter; | 955 shared_popup_counter_ = counter; |
910 shared_popup_counter_->data++; | 956 shared_popup_counter_->data++; |
911 decrement_shared_popup_at_destruction_ = true; | 957 decrement_shared_popup_at_destruction_ = true; |
912 } else { | 958 } else { |
913 shared_popup_counter_ = new SharedRenderViewCounter(0); | 959 shared_popup_counter_ = new SharedRenderViewCounter(0); |
914 decrement_shared_popup_at_destruction_ = false; | 960 decrement_shared_popup_at_destruction_ = false; |
915 } | 961 } |
916 | 962 |
917 devtools_agent_.reset(new DevToolsAgent(routing_id, this)); | 963 devtools_agent_ = new DevToolsAgent(routing_id); |
964 PasswordAutocompleteManager* password_autocomplete_manager = | |
965 new PasswordAutocompleteManager(); | |
966 AutoFillHelper* autofill_helper = new AutoFillHelper( | |
967 password_autocomplete_manager); | |
Ilya Sherman
2011/01/13 02:18:30
nit: Might be nice to have a quick comment mention
jam
2011/01/13 02:53:43
There's a comment beside the Observer interface, I
Ilya Sherman
2011/01/13 18:34:50
That comment is really visible when looking at the
jam
2011/01/13 18:40:53
My main issue with documenting stuff multiple time
Ilya Sherman
2011/01/13 22:34:51
It's not reasonable to expect everyone reading thi
| |
918 | 968 |
919 // TODO(jam): remove this once WebKit is rolled | 969 webwidget_ = WebView::create(this, devtools_agent_, autofill_helper); |
920 #if defined(WEBKIT_HAS_WEB_AUTO_FILL_CLIENT) | |
921 webwidget_ = WebView::create(this, devtools_agent_.get(), this); | |
922 #else | |
923 webwidget_ = WebView::create(this, devtools_agent_.get()); | |
924 #endif | |
925 g_view_map.Get().insert(std::make_pair(webview(), this)); | 970 g_view_map.Get().insert(std::make_pair(webview(), this)); |
926 webkit_preferences_.Apply(webview()); | 971 webkit_preferences_.Apply(webview()); |
927 webview()->initializeMainFrame(this); | 972 webview()->initializeMainFrame(this); |
928 if (!frame_name.empty()) | 973 if (!frame_name.empty()) |
929 webview()->mainFrame()->setName(frame_name); | 974 webview()->mainFrame()->setName(frame_name); |
930 | 975 |
931 OnSetRendererPrefs(renderer_prefs); | 976 OnSetRendererPrefs(renderer_prefs); |
932 | 977 |
933 routing_id_ = routing_id; | |
934 render_thread_->AddRoute(routing_id_, this); | 978 render_thread_->AddRoute(routing_id_, this); |
935 // Take a reference on behalf of the RenderThread. This will be balanced | 979 // Take a reference on behalf of the RenderThread. This will be balanced |
936 // when we receive ViewMsg_Close. | 980 // when we receive ViewMsg_Close. |
937 AddRef(); | 981 AddRef(); |
938 | 982 |
939 // If this is a popup, we must wait for the CreatingNew_ACK message before | 983 // If this is a popup, we must wait for the CreatingNew_ACK message before |
940 // completing initialization. Otherwise, we can finish it now. | 984 // completing initialization. Otherwise, we can finish it now. |
941 if (opener_id == MSG_ROUTING_NONE) { | 985 if (opener_id == MSG_ROUTING_NONE) { |
942 did_show_ = true; | 986 did_show_ = true; |
943 CompleteInit(parent_hwnd); | 987 CompleteInit(parent_hwnd); |
944 } | 988 } |
945 | 989 |
946 host_window_ = parent_hwnd; | 990 host_window_ = parent_hwnd; |
947 | 991 |
948 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 992 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
949 if (command_line.HasSwitch(switches::kDomAutomationController)) | 993 if (command_line.HasSwitch(switches::kDomAutomationController)) |
950 enabled_bindings_ |= BindingsPolicy::DOM_AUTOMATION; | 994 enabled_bindings_ |= BindingsPolicy::DOM_AUTOMATION; |
951 if (command_line.HasSwitch(switches::kEnableAccessibility)) | 995 if (command_line.HasSwitch(switches::kEnableAccessibility)) |
952 WebAccessibilityCache::enableAccessibility(); | 996 WebAccessibilityCache::enableAccessibility(); |
953 | 997 |
954 audio_message_filter_ = new AudioMessageFilter(routing_id_); | 998 audio_message_filter_ = new AudioMessageFilter(routing_id_); |
955 render_thread_->AddFilter(audio_message_filter_); | 999 render_thread_->AddFilter(audio_message_filter_); |
1000 | |
1001 PageClickTracker* page_click_tracker = new PageClickTracker(); | |
1002 // Note that the order of insertion of the listeners is important. | |
1003 // The password_autocomplete_manager takes the first shot at processing the | |
1004 // notification and can stop the propagation. | |
1005 page_click_tracker->AddListener(password_autocomplete_manager); | |
1006 page_click_tracker->AddListener(autofill_helper); | |
1007 | |
1008 AddObserver(autofill_helper); | |
1009 AddObserver(password_autocomplete_manager); | |
1010 AddObserver(page_click_tracker); | |
1011 | |
1012 AddObserver(notification_provider_); | |
1013 AddObserver(devtools_agent_); | |
956 } | 1014 } |
957 | 1015 |
958 bool RenderView::OnMessageReceived(const IPC::Message& message) { | 1016 bool RenderView::OnMessageReceived(const IPC::Message& message) { |
959 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; | 1017 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; |
960 if (main_frame) | 1018 if (main_frame) |
961 child_process_logging::SetActiveURL(main_frame->url()); | 1019 child_process_logging::SetActiveURL(main_frame->url()); |
962 | 1020 |
963 // If this is developer tools renderer intercept tools messages first. | 1021 for (size_t i = 0; i < observers_.size(); ++i) { |
964 if (devtools_client_.get() && devtools_client_->OnMessageReceived(message)) | 1022 if (observers_[i]->OnMessageReceived(message)) |
965 return true; | 1023 return true; |
966 if (devtools_agent_.get() && devtools_agent_->OnMessageReceived(message)) | |
967 return true; | |
968 if (notification_provider_->OnMessageReceived(message)) | |
969 return true; | |
970 if (geolocation_dispatcher_.get() && | |
971 geolocation_dispatcher_->OnMessageReceived(message)) { | |
972 return true; | |
973 } | |
974 if (speech_input_dispatcher_.get() && | |
975 speech_input_dispatcher_->OnMessageReceived(message)) { | |
976 return true; | |
977 } | |
978 if (device_orientation_dispatcher_.get() && | |
979 device_orientation_dispatcher_->OnMessageReceived(message)) { | |
980 return true; | |
981 } | 1024 } |
982 | 1025 |
983 bool handled = true; | 1026 bool handled = true; |
984 IPC_BEGIN_MESSAGE_MAP(RenderView, message) | 1027 IPC_BEGIN_MESSAGE_MAP(RenderView, message) |
985 IPC_MESSAGE_HANDLER(ViewMsg_CaptureThumbnail, OnCaptureThumbnail) | 1028 IPC_MESSAGE_HANDLER(ViewMsg_CaptureThumbnail, OnCaptureThumbnail) |
986 IPC_MESSAGE_HANDLER(ViewMsg_CaptureSnapshot, OnCaptureSnapshot) | 1029 IPC_MESSAGE_HANDLER(ViewMsg_CaptureSnapshot, OnCaptureSnapshot) |
987 IPC_MESSAGE_HANDLER(ViewMsg_PrintPages, OnPrintPages) | 1030 IPC_MESSAGE_HANDLER(ViewMsg_PrintPages, OnPrintPages) |
988 IPC_MESSAGE_HANDLER(ViewMsg_PrintingDone, OnPrintingDone) | 1031 IPC_MESSAGE_HANDLER(ViewMsg_PrintingDone, OnPrintingDone) |
989 IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate) | 1032 IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate) |
990 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop) | 1033 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop) |
(...skipping 26 matching lines...) Expand all Loading... | |
1017 OnSetZoomLevelForLoadingURL) | 1060 OnSetZoomLevelForLoadingURL) |
1018 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) | 1061 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) |
1019 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, | 1062 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, |
1020 OnResetPageEncodingToDefault) | 1063 OnResetPageEncodingToDefault) |
1021 IPC_MESSAGE_HANDLER(ViewMsg_SetupDevToolsClient, OnSetupDevToolsClient) | 1064 IPC_MESSAGE_HANDLER(ViewMsg_SetupDevToolsClient, OnSetupDevToolsClient) |
1022 IPC_MESSAGE_HANDLER(ViewMsg_DownloadFavIcon, OnDownloadFavIcon) | 1065 IPC_MESSAGE_HANDLER(ViewMsg_DownloadFavIcon, OnDownloadFavIcon) |
1023 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) | 1066 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) |
1024 IPC_MESSAGE_HANDLER(ViewMsg_CSSInsertRequest, OnCSSInsertRequest) | 1067 IPC_MESSAGE_HANDLER(ViewMsg_CSSInsertRequest, OnCSSInsertRequest) |
1025 IPC_MESSAGE_HANDLER(ViewMsg_AddMessageToConsole, OnAddMessageToConsole) | 1068 IPC_MESSAGE_HANDLER(ViewMsg_AddMessageToConsole, OnAddMessageToConsole) |
1026 IPC_MESSAGE_HANDLER(ViewMsg_ReservePageIDRange, OnReservePageIDRange) | 1069 IPC_MESSAGE_HANDLER(ViewMsg_ReservePageIDRange, OnReservePageIDRange) |
1027 IPC_MESSAGE_HANDLER(ViewMsg_FillPasswordForm, OnFillPasswordForm) | |
1028 IPC_MESSAGE_HANDLER(ViewMsg_DragTargetDragEnter, OnDragTargetDragEnter) | 1070 IPC_MESSAGE_HANDLER(ViewMsg_DragTargetDragEnter, OnDragTargetDragEnter) |
1029 IPC_MESSAGE_HANDLER(ViewMsg_DragTargetDragOver, OnDragTargetDragOver) | 1071 IPC_MESSAGE_HANDLER(ViewMsg_DragTargetDragOver, OnDragTargetDragOver) |
1030 IPC_MESSAGE_HANDLER(ViewMsg_DragTargetDragLeave, OnDragTargetDragLeave) | 1072 IPC_MESSAGE_HANDLER(ViewMsg_DragTargetDragLeave, OnDragTargetDragLeave) |
1031 IPC_MESSAGE_HANDLER(ViewMsg_DragTargetDrop, OnDragTargetDrop) | 1073 IPC_MESSAGE_HANDLER(ViewMsg_DragTargetDrop, OnDragTargetDrop) |
1032 IPC_MESSAGE_HANDLER(ViewMsg_AllowBindings, OnAllowBindings) | 1074 IPC_MESSAGE_HANDLER(ViewMsg_AllowBindings, OnAllowBindings) |
1033 IPC_MESSAGE_HANDLER(ViewMsg_SetDOMUIProperty, OnSetDOMUIProperty) | 1075 IPC_MESSAGE_HANDLER(ViewMsg_SetDOMUIProperty, OnSetDOMUIProperty) |
1034 IPC_MESSAGE_HANDLER(ViewMsg_DragSourceEndedOrMoved, | 1076 IPC_MESSAGE_HANDLER(ViewMsg_DragSourceEndedOrMoved, |
1035 OnDragSourceEndedOrMoved) | 1077 OnDragSourceEndedOrMoved) |
1036 IPC_MESSAGE_HANDLER(ViewMsg_DragSourceSystemDragEnded, | 1078 IPC_MESSAGE_HANDLER(ViewMsg_DragSourceSystemDragEnded, |
1037 OnDragSourceSystemDragEnded) | 1079 OnDragSourceSystemDragEnded) |
(...skipping 13 matching lines...) Expand all Loading... | |
1051 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, | 1093 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, |
1052 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) | 1094 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) |
1053 IPC_MESSAGE_HANDLER(ViewMsg_GetApplicationInfo, OnGetApplicationInfo) | 1095 IPC_MESSAGE_HANDLER(ViewMsg_GetApplicationInfo, OnGetApplicationInfo) |
1054 IPC_MESSAGE_HANDLER(ViewMsg_ShouldClose, OnShouldClose) | 1096 IPC_MESSAGE_HANDLER(ViewMsg_ShouldClose, OnShouldClose) |
1055 IPC_MESSAGE_HANDLER(ViewMsg_ClosePage, OnClosePage) | 1097 IPC_MESSAGE_HANDLER(ViewMsg_ClosePage, OnClosePage) |
1056 IPC_MESSAGE_HANDLER(ViewMsg_ThemeChanged, OnThemeChanged) | 1098 IPC_MESSAGE_HANDLER(ViewMsg_ThemeChanged, OnThemeChanged) |
1057 IPC_MESSAGE_HANDLER(ViewMsg_HandleMessageFromExternalHost, | 1099 IPC_MESSAGE_HANDLER(ViewMsg_HandleMessageFromExternalHost, |
1058 OnHandleMessageFromExternalHost) | 1100 OnHandleMessageFromExternalHost) |
1059 IPC_MESSAGE_HANDLER(ViewMsg_DisassociateFromPopupCount, | 1101 IPC_MESSAGE_HANDLER(ViewMsg_DisassociateFromPopupCount, |
1060 OnDisassociateFromPopupCount) | 1102 OnDisassociateFromPopupCount) |
1061 IPC_MESSAGE_HANDLER(ViewMsg_AutoFillSuggestionsReturned, | |
1062 OnAutoFillSuggestionsReturned) | |
1063 IPC_MESSAGE_HANDLER(ViewMsg_AutoFillFormDataFilled, | |
1064 OnAutoFillFormDataFilled) | |
1065 IPC_MESSAGE_HANDLER(ViewMsg_AllowScriptToClose, | 1103 IPC_MESSAGE_HANDLER(ViewMsg_AllowScriptToClose, |
1066 OnAllowScriptToClose) | 1104 OnAllowScriptToClose) |
1067 IPC_MESSAGE_HANDLER(ViewMsg_MoveOrResizeStarted, OnMoveOrResizeStarted) | 1105 IPC_MESSAGE_HANDLER(ViewMsg_MoveOrResizeStarted, OnMoveOrResizeStarted) |
1068 IPC_MESSAGE_HANDLER(ViewMsg_ExtensionResponse, OnExtensionResponse) | 1106 IPC_MESSAGE_HANDLER(ViewMsg_ExtensionResponse, OnExtensionResponse) |
1069 IPC_MESSAGE_HANDLER(ViewMsg_ExtensionMessageInvoke, | 1107 IPC_MESSAGE_HANDLER(ViewMsg_ExtensionMessageInvoke, |
1070 OnExtensionMessageInvoke) | 1108 OnExtensionMessageInvoke) |
1071 IPC_MESSAGE_HANDLER(ViewMsg_ClearFocusedNode, OnClearFocusedNode) | 1109 IPC_MESSAGE_HANDLER(ViewMsg_ClearFocusedNode, OnClearFocusedNode) |
1072 IPC_MESSAGE_HANDLER(ViewMsg_SetBackground, OnSetBackground) | 1110 IPC_MESSAGE_HANDLER(ViewMsg_SetBackground, OnSetBackground) |
1073 IPC_MESSAGE_HANDLER(ViewMsg_EnablePreferredSizeChangedMode, | 1111 IPC_MESSAGE_HANDLER(ViewMsg_EnablePreferredSizeChangedMode, |
1074 OnEnablePreferredSizeChangedMode) | 1112 OnEnablePreferredSizeChangedMode) |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1376 return true; | 1414 return true; |
1377 } | 1415 } |
1378 | 1416 |
1379 void RenderView::OnNavigate(const ViewMsg_Navigate_Params& params) { | 1417 void RenderView::OnNavigate(const ViewMsg_Navigate_Params& params) { |
1380 if (!webview()) | 1418 if (!webview()) |
1381 return; | 1419 return; |
1382 | 1420 |
1383 history_list_offset_ = params.current_history_list_offset; | 1421 history_list_offset_ = params.current_history_list_offset; |
1384 history_list_length_ = params.current_history_list_length; | 1422 history_list_length_ = params.current_history_list_length; |
1385 | 1423 |
1386 if (devtools_agent_.get()) | |
1387 devtools_agent_->OnNavigate(); | |
1388 | |
1389 if (notification_provider_.get()) | |
1390 notification_provider_->OnNavigate(); | |
1391 | |
1392 child_process_logging::SetActiveURL(params.url); | 1424 child_process_logging::SetActiveURL(params.url); |
1393 | 1425 |
1394 AboutHandler::MaybeHandle(params.url); | 1426 AboutHandler::MaybeHandle(params.url); |
1395 | 1427 |
1396 bool is_reload = | 1428 bool is_reload = |
1397 params.navigation_type == ViewMsg_Navigate_Params::RELOAD || | 1429 params.navigation_type == ViewMsg_Navigate_Params::RELOAD || |
1398 params.navigation_type == ViewMsg_Navigate_Params::RELOAD_IGNORING_CACHE; | 1430 params.navigation_type == ViewMsg_Navigate_Params::RELOAD_IGNORING_CACHE; |
1399 | 1431 |
1400 WebFrame* main_frame = webview()->mainFrame(); | 1432 WebFrame* main_frame = webview()->mainFrame(); |
1401 if (is_reload && main_frame->currentHistoryItem().isNull()) { | 1433 if (is_reload && main_frame->currentHistoryItem().isNull()) { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1502 void RenderView::OnExecuteEditCommand(const std::string& name, | 1534 void RenderView::OnExecuteEditCommand(const std::string& name, |
1503 const std::string& value) { | 1535 const std::string& value) { |
1504 if (!webview() || !webview()->focusedFrame()) | 1536 if (!webview() || !webview()->focusedFrame()) |
1505 return; | 1537 return; |
1506 | 1538 |
1507 webview()->focusedFrame()->executeCommand( | 1539 webview()->focusedFrame()->executeCommand( |
1508 WebString::fromUTF8(name), WebString::fromUTF8(value)); | 1540 WebString::fromUTF8(name), WebString::fromUTF8(value)); |
1509 } | 1541 } |
1510 | 1542 |
1511 void RenderView::OnSetupDevToolsClient() { | 1543 void RenderView::OnSetupDevToolsClient() { |
1512 DCHECK(!devtools_client_.get()); | 1544 DCHECK(!devtools_client_); |
1513 devtools_client_.reset(new DevToolsClient(this)); | 1545 devtools_client_ = new DevToolsClient(webview()); |
1546 AddObserver(devtools_client_); | |
1514 } | 1547 } |
1515 | 1548 |
1516 void RenderView::OnUpdateTargetURLAck() { | 1549 void RenderView::OnUpdateTargetURLAck() { |
1517 // Check if there is a targeturl waiting to be sent. | 1550 // Check if there is a targeturl waiting to be sent. |
1518 if (target_url_status_ == TARGET_PENDING) { | 1551 if (target_url_status_ == TARGET_PENDING) { |
1519 Send(new ViewHostMsg_UpdateTargetURL(routing_id_, page_id_, | 1552 Send(new ViewHostMsg_UpdateTargetURL(routing_id_, page_id_, |
1520 pending_target_url_)); | 1553 pending_target_url_)); |
1521 } | 1554 } |
1522 | 1555 |
1523 target_url_status_ = TARGET_NONE; | 1556 target_url_status_ = TARGET_NONE; |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1980 } | 2013 } |
1981 | 2014 |
1982 void RenderView::AddGURLSearchProvider( | 2015 void RenderView::AddGURLSearchProvider( |
1983 const GURL& osd_url, | 2016 const GURL& osd_url, |
1984 const ViewHostMsg_PageHasOSDD_Type& provider_type) { | 2017 const ViewHostMsg_PageHasOSDD_Type& provider_type) { |
1985 if (!osd_url.is_empty()) | 2018 if (!osd_url.is_empty()) |
1986 Send(new ViewHostMsg_PageHasOSDD(routing_id_, page_id_, osd_url, | 2019 Send(new ViewHostMsg_PageHasOSDD(routing_id_, page_id_, osd_url, |
1987 provider_type)); | 2020 provider_type)); |
1988 } | 2021 } |
1989 | 2022 |
1990 void RenderView::OnAutoFillSuggestionsReturned( | |
1991 int query_id, | |
1992 const std::vector<string16>& values, | |
1993 const std::vector<string16>& labels, | |
1994 const std::vector<string16>& icons, | |
1995 const std::vector<int>& unique_ids) { | |
1996 autofill_helper_->SuggestionsReceived( | |
1997 query_id, values, labels, icons, unique_ids); | |
1998 } | |
1999 | |
2000 void RenderView::OnAutoFillFormDataFilled(int query_id, | |
2001 const webkit_glue::FormData& form) { | |
2002 autofill_helper_->FormDataFilled(query_id, form); | |
2003 } | |
2004 | |
2005 void RenderView::OnAllowScriptToClose(bool script_can_close) { | 2023 void RenderView::OnAllowScriptToClose(bool script_can_close) { |
2006 script_can_close_ = script_can_close; | 2024 script_can_close_ = script_can_close; |
2007 } | 2025 } |
2008 | 2026 |
2009 uint32 RenderView::GetCPBrowsingContext() { | 2027 uint32 RenderView::GetCPBrowsingContext() { |
2010 uint32 context = 0; | 2028 uint32 context = 0; |
2011 Send(new ViewHostMsg_GetCPBrowsingContext(&context)); | 2029 Send(new ViewHostMsg_GetCPBrowsingContext(&context)); |
2012 return context; | 2030 return context; |
2013 } | 2031 } |
2014 | 2032 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2184 DCHECK(frame); | 2202 DCHECK(frame); |
2185 if (CommandLine::ForCurrentProcess()->HasSwitch( | 2203 if (CommandLine::ForCurrentProcess()->HasSwitch( |
2186 switches::kEnablePrintPreview)) { | 2204 switches::kEnablePrintPreview)) { |
2187 Print(frame, true, true); | 2205 Print(frame, true, true); |
2188 } else { | 2206 } else { |
2189 Print(frame, true, false); | 2207 Print(frame, true, false); |
2190 } | 2208 } |
2191 } | 2209 } |
2192 | 2210 |
2193 WebKit::WebNotificationPresenter* RenderView::notificationPresenter() { | 2211 WebKit::WebNotificationPresenter* RenderView::notificationPresenter() { |
2194 return notification_provider_.get(); | 2212 return notification_provider_; |
2195 } | 2213 } |
2196 | 2214 |
2197 void RenderView::didStartLoading() { | 2215 void RenderView::didStartLoading() { |
2198 if (is_loading_) { | 2216 if (is_loading_) { |
2199 DLOG(WARNING) << "didStartLoading called while loading"; | 2217 DLOG(WARNING) << "didStartLoading called while loading"; |
2200 return; | 2218 return; |
2201 } | 2219 } |
2202 | 2220 |
2203 is_loading_ = true; | 2221 is_loading_ = true; |
2204 // Clear the pointer so that we can assign it only when there is an unknown | 2222 // Clear the pointer so that we can assign it only when there is an unknown |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2289 | 2307 |
2290 void RenderView::didExecuteCommand(const WebString& command_name) { | 2308 void RenderView::didExecuteCommand(const WebString& command_name) { |
2291 const std::string& name = UTF16ToUTF8(command_name); | 2309 const std::string& name = UTF16ToUTF8(command_name); |
2292 if (StartsWithASCII(name, "Move", true) || | 2310 if (StartsWithASCII(name, "Move", true) || |
2293 StartsWithASCII(name, "Insert", true) || | 2311 StartsWithASCII(name, "Insert", true) || |
2294 StartsWithASCII(name, "Delete", true)) | 2312 StartsWithASCII(name, "Delete", true)) |
2295 return; | 2313 return; |
2296 UserMetricsRecordAction(name); | 2314 UserMetricsRecordAction(name); |
2297 } | 2315 } |
2298 | 2316 |
2299 void RenderView::textFieldDidEndEditing( | |
2300 const WebKit::WebInputElement& element) { | |
2301 password_autocomplete_manager_->TextFieldDidEndEditing(element); | |
2302 } | |
2303 | |
2304 void RenderView::textFieldDidChange(const WebKit::WebInputElement& element) { | |
2305 // We post a task for doing the AutoFill as the caret position is not set | |
2306 // properly at this point (http://bugs.webkit.org/show_bug.cgi?id=16976) and | |
2307 // it is needed to trigger autofill. | |
2308 autofill_method_factory_.RevokeAll(); | |
2309 MessageLoop::current()->PostTask( | |
2310 FROM_HERE, | |
2311 autofill_method_factory_.NewRunnableMethod( | |
2312 &RenderView::TextFieldDidChangeImpl, element)); | |
2313 } | |
2314 | |
2315 void RenderView::TextFieldDidChangeImpl( | |
2316 const WebKit::WebInputElement& element) { | |
2317 if (password_autocomplete_manager_->TextDidChangeInTextField(element)) | |
2318 return; | |
2319 autofill_helper_->TextDidChangeInTextField(element); | |
2320 } | |
2321 | |
2322 void RenderView::SendPendingAccessibilityNotifications() { | 2317 void RenderView::SendPendingAccessibilityNotifications() { |
2323 if (!accessibility_.get()) | 2318 if (!accessibility_.get()) |
2324 return; | 2319 return; |
2325 | 2320 |
2326 if (pending_accessibility_notifications_.empty()) | 2321 if (pending_accessibility_notifications_.empty()) |
2327 return; | 2322 return; |
2328 | 2323 |
2329 // Send all pending accessibility notifications. | 2324 // Send all pending accessibility notifications. |
2330 std::vector<ViewHostMsg_AccessibilityNotification_Params> notifications; | 2325 std::vector<ViewHostMsg_AccessibilityNotification_Params> notifications; |
2331 for (size_t i = 0; i < pending_accessibility_notifications_.size(); i++) { | 2326 for (size_t i = 0; i < pending_accessibility_notifications_.size(); i++) { |
2332 RendererAccessibilityNotification& notification = | 2327 RendererAccessibilityNotification& notification = |
2333 pending_accessibility_notifications_[i]; | 2328 pending_accessibility_notifications_[i]; |
2334 WebAccessibilityObject obj = accessibility_->getObjectById(notification.id); | 2329 WebAccessibilityObject obj = accessibility_->getObjectById(notification.id); |
2335 if (!obj.isValid()) | 2330 if (!obj.isValid()) |
2336 continue; | 2331 continue; |
2337 | 2332 |
2338 ViewHostMsg_AccessibilityNotification_Params param; | 2333 ViewHostMsg_AccessibilityNotification_Params param; |
2339 param.notification_type = pending_accessibility_notifications_[i].type; | 2334 param.notification_type = pending_accessibility_notifications_[i].type; |
2340 param.acc_obj = WebAccessibility( | 2335 param.acc_obj = WebAccessibility( |
2341 obj, accessibility_.get(), notification.ShouldIncludeChildren()); | 2336 obj, accessibility_.get(), notification.ShouldIncludeChildren()); |
2342 notifications.push_back(param); | 2337 notifications.push_back(param); |
2343 } | 2338 } |
2344 pending_accessibility_notifications_.clear(); | 2339 pending_accessibility_notifications_.clear(); |
2345 Send(new ViewHostMsg_AccessibilityNotifications(routing_id_, notifications)); | 2340 Send(new ViewHostMsg_AccessibilityNotifications(routing_id_, notifications)); |
2346 accessibility_ack_pending_ = true; | 2341 accessibility_ack_pending_ = true; |
2347 } | 2342 } |
2348 | 2343 |
2349 void RenderView::textFieldDidReceiveKeyDown( | |
2350 const WebKit::WebInputElement& element, | |
2351 const WebKit::WebKeyboardEvent& event) { | |
2352 password_autocomplete_manager_->TextFieldHandlingKeyDown(element, event); | |
2353 autofill_helper_->KeyDownInTextField(element, event); | |
2354 } | |
2355 | |
2356 bool RenderView::handleCurrentKeyboardEvent() { | 2344 bool RenderView::handleCurrentKeyboardEvent() { |
2357 if (edit_commands_.empty()) | 2345 if (edit_commands_.empty()) |
2358 return false; | 2346 return false; |
2359 | 2347 |
2360 WebFrame* frame = webview()->focusedFrame(); | 2348 WebFrame* frame = webview()->focusedFrame(); |
2361 if (!frame) | 2349 if (!frame) |
2362 return false; | 2350 return false; |
2363 | 2351 |
2364 EditCommands::iterator it = edit_commands_.begin(); | 2352 EditCommands::iterator it = edit_commands_.begin(); |
2365 EditCommands::iterator end = edit_commands_.end(); | 2353 EditCommands::iterator end = edit_commands_.end(); |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2638 return history_list_length_ - historyBackListCount() - 1; | 2626 return history_list_length_ - historyBackListCount() - 1; |
2639 } | 2627 } |
2640 | 2628 |
2641 void RenderView::didUpdateInspectorSetting(const WebString& key, | 2629 void RenderView::didUpdateInspectorSetting(const WebString& key, |
2642 const WebString& value) { | 2630 const WebString& value) { |
2643 Send(new ViewHostMsg_UpdateInspectorSetting(routing_id_, | 2631 Send(new ViewHostMsg_UpdateInspectorSetting(routing_id_, |
2644 key.utf8(), | 2632 key.utf8(), |
2645 value.utf8())); | 2633 value.utf8())); |
2646 } | 2634 } |
2647 | 2635 |
2648 void RenderView::didAcceptAutoFillSuggestion(const WebKit::WebNode& node, | |
2649 const WebKit::WebString& value, | |
2650 const WebKit::WebString& label, | |
2651 int unique_id, | |
2652 unsigned index) { | |
2653 autofill_helper_->DidAcceptAutoFillSuggestion(node, value, unique_id, index); | |
2654 } | |
2655 | |
2656 void RenderView::didSelectAutoFillSuggestion(const WebKit::WebNode& node, | |
2657 const WebKit::WebString& value, | |
2658 const WebKit::WebString& label, | |
2659 int unique_id) { | |
2660 autofill_helper_->DidSelectAutoFillSuggestion(node, unique_id); | |
2661 } | |
2662 | |
2663 void RenderView::didClearAutoFillSelection(const WebKit::WebNode& node) { | |
2664 autofill_helper_->DidClearAutoFillSelection(node); | |
2665 } | |
2666 | |
2667 void RenderView::didAcceptAutocompleteSuggestion( | |
2668 const WebKit::WebInputElement& user_element) { | |
2669 bool result = password_autocomplete_manager_->FillPassword(user_element); | |
2670 // Since this user name was selected from a suggestion list, we should always | |
2671 // have password for it. | |
2672 DCHECK(result); | |
2673 } | |
2674 | |
2675 void RenderView::removeAutocompleteSuggestion(const WebKit::WebString& name, | |
2676 const WebKit::WebString& value) { | |
2677 autofill_helper_->RemoveAutocompleteSuggestion(name, value); | |
2678 } | |
2679 | |
2680 void RenderView::removeAutofillSuggestions(const WebString& name, | |
2681 const WebString& value) { | |
2682 removeAutocompleteSuggestion(name, value); | |
2683 } | |
2684 | |
2685 // WebKit::WebWidgetClient ---------------------------------------------------- | 2636 // WebKit::WebWidgetClient ---------------------------------------------------- |
2686 | 2637 |
2687 void RenderView::didFocus() { | 2638 void RenderView::didFocus() { |
2688 // TODO(jcivelli): when https://bugs.webkit.org/show_bug.cgi?id=33389 is fixed | 2639 // TODO(jcivelli): when https://bugs.webkit.org/show_bug.cgi?id=33389 is fixed |
2689 // we won't have to test for user gesture anymore and we can | 2640 // we won't have to test for user gesture anymore and we can |
2690 // move that code back to render_widget.cc | 2641 // move that code back to render_widget.cc |
2691 if (webview() && webview()->mainFrame() && | 2642 if (webview() && webview()->mainFrame() && |
2692 webview()->mainFrame()->isProcessingUserGesture()) { | 2643 webview()->mainFrame()->isProcessingUserGesture()) { |
2693 Send(new ViewHostMsg_Focus(routing_id_)); | 2644 Send(new ViewHostMsg_Focus(routing_id_)); |
2694 } | 2645 } |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2930 return new RendererWebApplicationCacheHostImpl( | 2881 return new RendererWebApplicationCacheHostImpl( |
2931 FromWebView(frame->view()), client, | 2882 FromWebView(frame->view()), client, |
2932 RenderThread::current()->appcache_dispatcher()->backend_proxy()); | 2883 RenderThread::current()->appcache_dispatcher()->backend_proxy()); |
2933 } | 2884 } |
2934 | 2885 |
2935 WebCookieJar* RenderView::cookieJar(WebFrame* frame) { | 2886 WebCookieJar* RenderView::cookieJar(WebFrame* frame) { |
2936 return &cookie_jar_; | 2887 return &cookie_jar_; |
2937 } | 2888 } |
2938 | 2889 |
2939 void RenderView::frameDetached(WebFrame* frame) { | 2890 void RenderView::frameDetached(WebFrame* frame) { |
2940 autofill_helper_->FrameDetached(frame); | 2891 for (size_t i = 0; i < observers_.size(); ++i) |
2941 page_click_tracker_->StopTrackingFrame(frame, true); | 2892 observers_[i]->FrameDetached(frame); |
2942 } | 2893 } |
2943 | 2894 |
2944 void RenderView::willClose(WebFrame* frame) { | 2895 void RenderView::willClose(WebFrame* frame) { |
2945 WebDataSource* ds = frame->dataSource(); | 2896 WebDataSource* ds = frame->dataSource(); |
2946 NavigationState* navigation_state = NavigationState::FromDataSource(ds); | 2897 NavigationState* navigation_state = NavigationState::FromDataSource(ds); |
2947 | 2898 |
2948 page_load_histograms_.Dump(frame); | 2899 page_load_histograms_.Dump(frame); |
2949 navigation_state->user_script_idle_scheduler()->Cancel(); | 2900 navigation_state->user_script_idle_scheduler()->Cancel(); |
2950 | 2901 |
2951 // TODO(jhawkins): Remove once frameDetached is called by WebKit. | 2902 for (size_t i = 0; i < observers_.size(); ++i) |
2952 // NOTE: taking this out results in lots of increased memory usage! This is | 2903 observers_[i]->FrameWillClose(frame); |
2953 // because frameDetached is NOT like wilLClose. The latter happens between | |
2954 // navigations, but the former only happens when the RenderView is going away. | |
2955 autofill_helper_->FrameWillClose(frame); | |
2956 } | 2904 } |
2957 | 2905 |
2958 bool RenderView::allowImages(WebFrame* frame, bool enabled_per_settings) { | 2906 bool RenderView::allowImages(WebFrame* frame, bool enabled_per_settings) { |
2959 if (enabled_per_settings && | 2907 if (enabled_per_settings && |
2960 AllowContentType(CONTENT_SETTINGS_TYPE_IMAGES)) | 2908 AllowContentType(CONTENT_SETTINGS_TYPE_IMAGES)) |
2961 return true; | 2909 return true; |
2962 | 2910 |
2963 if (IsWhitelistedForContentSettings(frame)) | 2911 if (IsWhitelistedForContentSettings(frame)) |
2964 return true; | 2912 return true; |
2965 | 2913 |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3539 } | 3487 } |
3540 | 3488 |
3541 void RenderView::didFinishDocumentLoad(WebFrame* frame) { | 3489 void RenderView::didFinishDocumentLoad(WebFrame* frame) { |
3542 WebDataSource* ds = frame->dataSource(); | 3490 WebDataSource* ds = frame->dataSource(); |
3543 NavigationState* navigation_state = NavigationState::FromDataSource(ds); | 3491 NavigationState* navigation_state = NavigationState::FromDataSource(ds); |
3544 DCHECK(navigation_state); | 3492 DCHECK(navigation_state); |
3545 navigation_state->set_finish_document_load_time(Time::Now()); | 3493 navigation_state->set_finish_document_load_time(Time::Now()); |
3546 | 3494 |
3547 Send(new ViewHostMsg_DocumentLoadedInFrame(routing_id_, frame->identifier())); | 3495 Send(new ViewHostMsg_DocumentLoadedInFrame(routing_id_, frame->identifier())); |
3548 | 3496 |
3549 page_click_tracker_->StartTrackingFrame(frame); | 3497 for (size_t i = 0; i < observers_.size(); ++i) |
3550 // The document has now been fully loaded. Scan for forms to be sent up to | 3498 observers_[i]->DidFinishDocumentLoad(frame); |
3551 // the browser. | |
3552 autofill_helper_->FrameContentsAvailable(frame); | |
3553 password_autocomplete_manager_->SendPasswordForms(frame, false); | |
3554 | 3499 |
3555 // Check whether we have new encoding name. | 3500 // Check whether we have new encoding name. |
3556 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); | 3501 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); |
3557 | 3502 |
3558 if (RenderThread::current()) { // Will be NULL during unit tests. | 3503 if (RenderThread::current()) { // Will be NULL during unit tests. |
3559 RenderThread::current()->user_script_slave()->InjectScripts( | 3504 RenderThread::current()->user_script_slave()->InjectScripts( |
3560 frame, UserScript::DOCUMENT_END); | 3505 frame, UserScript::DOCUMENT_END); |
3561 } | 3506 } |
3562 | 3507 |
3563 // InjectScripts() can end up creating a new NavigationState if it triggers a | 3508 // InjectScripts() can end up creating a new NavigationState if it triggers a |
(...skipping 30 matching lines...) Expand all Loading... | |
3594 // Ignore | 3539 // Ignore |
3595 } | 3540 } |
3596 | 3541 |
3597 void RenderView::didFinishLoad(WebFrame* frame) { | 3542 void RenderView::didFinishLoad(WebFrame* frame) { |
3598 WebDataSource* ds = frame->dataSource(); | 3543 WebDataSource* ds = frame->dataSource(); |
3599 NavigationState* navigation_state = NavigationState::FromDataSource(ds); | 3544 NavigationState* navigation_state = NavigationState::FromDataSource(ds); |
3600 DCHECK(navigation_state); | 3545 DCHECK(navigation_state); |
3601 navigation_state->set_finish_load_time(Time::Now()); | 3546 navigation_state->set_finish_load_time(Time::Now()); |
3602 navigation_state->user_script_idle_scheduler()->DidFinishLoad(); | 3547 navigation_state->user_script_idle_scheduler()->DidFinishLoad(); |
3603 | 3548 |
3604 // Let the password manager know which password forms are actually visible. | 3549 for (size_t i = 0; i < observers_.size(); ++i) |
3605 password_autocomplete_manager_->SendPasswordForms(frame, true); | 3550 observers_[i]->DidFinishLoad(frame); |
3606 | 3551 |
3607 Send(new ViewHostMsg_DidFinishLoad(routing_id_, frame->identifier())); | 3552 Send(new ViewHostMsg_DidFinishLoad(routing_id_, frame->identifier())); |
3608 } | 3553 } |
3609 | 3554 |
3610 void RenderView::didNavigateWithinPage( | 3555 void RenderView::didNavigateWithinPage( |
3611 WebFrame* frame, bool is_new_navigation) { | 3556 WebFrame* frame, bool is_new_navigation) { |
3612 // Determine if the UserScriptIdleScheduler already ran scripts on this page, | 3557 // Determine if the UserScriptIdleScheduler already ran scripts on this page, |
3613 // since a new one gets created by didCreateDataSource. | 3558 // since a new one gets created by didCreateDataSource. |
3614 NavigationState* state = NavigationState::FromDataSource(frame->dataSource()); | 3559 NavigationState* state = NavigationState::FromDataSource(frame->dataSource()); |
3615 bool idle_scheduler_ran = state->user_script_idle_scheduler()->has_run(); | 3560 bool idle_scheduler_ran = state->user_script_idle_scheduler()->has_run(); |
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4709 webview()->dragSourceEndedAt(client_point, screen_point, op); | 4654 webview()->dragSourceEndedAt(client_point, screen_point, op); |
4710 } else { | 4655 } else { |
4711 webview()->dragSourceMovedTo(client_point, screen_point, op); | 4656 webview()->dragSourceMovedTo(client_point, screen_point, op); |
4712 } | 4657 } |
4713 } | 4658 } |
4714 | 4659 |
4715 void RenderView::OnDragSourceSystemDragEnded() { | 4660 void RenderView::OnDragSourceSystemDragEnded() { |
4716 webview()->dragSourceSystemDragEnded(); | 4661 webview()->dragSourceSystemDragEnded(); |
4717 } | 4662 } |
4718 | 4663 |
4719 void RenderView::OnFillPasswordForm( | |
4720 const webkit_glue::PasswordFormFillData& form_data) { | |
4721 password_autocomplete_manager_->ReceivedPasswordFormFillData(webview(), | |
4722 form_data); | |
4723 } | |
4724 | |
4725 void RenderView::OnDragTargetDragEnter(const WebDropData& drop_data, | 4664 void RenderView::OnDragTargetDragEnter(const WebDropData& drop_data, |
4726 const gfx::Point& client_point, | 4665 const gfx::Point& client_point, |
4727 const gfx::Point& screen_point, | 4666 const gfx::Point& screen_point, |
4728 WebDragOperationsMask ops) { | 4667 WebDragOperationsMask ops) { |
4729 WebDragOperation operation = webview()->dragTargetDragEnter( | 4668 WebDragOperation operation = webview()->dragTargetDragEnter( |
4730 drop_data.ToDragData(), | 4669 drop_data.ToDragData(), |
4731 drop_data.identity, | 4670 drop_data.identity, |
4732 client_point, | 4671 client_point, |
4733 screen_point, | 4672 screen_point, |
4734 ops); | 4673 ops); |
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5486 // We need to grab a pointer to the doomed WebView before we destroy it. | 5425 // We need to grab a pointer to the doomed WebView before we destroy it. |
5487 WebView* doomed = webview(); | 5426 WebView* doomed = webview(); |
5488 RenderWidget::Close(); | 5427 RenderWidget::Close(); |
5489 g_view_map.Get().erase(doomed); | 5428 g_view_map.Get().erase(doomed); |
5490 } | 5429 } |
5491 | 5430 |
5492 void RenderView::DidHandleKeyEvent() { | 5431 void RenderView::DidHandleKeyEvent() { |
5493 edit_commands_.clear(); | 5432 edit_commands_.clear(); |
5494 } | 5433 } |
5495 | 5434 |
5496 void RenderView::DidHandleMouseEvent(const WebKit::WebMouseEvent& event) { | |
5497 page_click_tracker_->DidHandleMouseEvent(event); | |
5498 } | |
5499 | |
5500 #if defined(OS_MACOSX) | 5435 #if defined(OS_MACOSX) |
5501 void RenderView::OnWasHidden() { | 5436 void RenderView::OnWasHidden() { |
5502 RenderWidget::OnWasHidden(); | 5437 RenderWidget::OnWasHidden(); |
5503 | 5438 |
5504 // Inform plugins that their container is no longer visible. | 5439 // Inform plugins that their container is no longer visible. |
5505 std::set<WebPluginDelegateProxy*>::iterator plugin_it; | 5440 std::set<WebPluginDelegateProxy*>::iterator plugin_it; |
5506 for (plugin_it = plugin_delegates_.begin(); | 5441 for (plugin_it = plugin_delegates_.begin(); |
5507 plugin_it != plugin_delegates_.end(); ++plugin_it) { | 5442 plugin_it != plugin_delegates_.end(); ++plugin_it) { |
5508 (*plugin_it)->SetContainerVisibility(false); | 5443 (*plugin_it)->SetContainerVisibility(false); |
5509 } | 5444 } |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5645 Send(new ViewHostMsg_RunFileChooser(routing_id_, params)); | 5580 Send(new ViewHostMsg_RunFileChooser(routing_id_, params)); |
5646 } | 5581 } |
5647 return true; | 5582 return true; |
5648 } | 5583 } |
5649 | 5584 |
5650 void RenderView::OnPageTranslated() { | 5585 void RenderView::OnPageTranslated() { |
5651 WebFrame* frame = webview()->mainFrame(); | 5586 WebFrame* frame = webview()->mainFrame(); |
5652 if (!frame) | 5587 if (!frame) |
5653 return; | 5588 return; |
5654 | 5589 |
5655 // The page is translated, so try to extract the form data again. | 5590 for (size_t i = 0; i < observers_.size(); ++i) |
5656 autofill_helper_->FrameContentsAvailable(frame); | 5591 observers_[i]->FrameTranslated(frame); |
5657 } | 5592 } |
5658 | 5593 |
5659 WebKit::WebGeolocationClient* RenderView::geolocationClient() { | 5594 WebKit::WebGeolocationClient* RenderView::geolocationClient() { |
5660 if (!geolocation_dispatcher_.get()) | 5595 if (!geolocation_dispatcher_) { |
5661 geolocation_dispatcher_.reset(new GeolocationDispatcher(this)); | 5596 geolocation_dispatcher_ = new GeolocationDispatcher(); |
5662 return geolocation_dispatcher_.get(); | 5597 AddObserver(geolocation_dispatcher_); |
5598 } | |
5599 return geolocation_dispatcher_; | |
5663 } | 5600 } |
5664 | 5601 |
5665 WebKit::WebSpeechInputController* RenderView::speechInputController( | 5602 WebKit::WebSpeechInputController* RenderView::speechInputController( |
5666 WebKit::WebSpeechInputListener* listener) { | 5603 WebKit::WebSpeechInputListener* listener) { |
5667 if (!speech_input_dispatcher_.get()) | 5604 if (!speech_input_dispatcher_) { |
5668 speech_input_dispatcher_.reset(new SpeechInputDispatcher(this, listener)); | 5605 speech_input_dispatcher_ = new SpeechInputDispatcher(listener); |
5669 return speech_input_dispatcher_.get(); | 5606 AddObserver(speech_input_dispatcher_); |
5607 } | |
5608 return speech_input_dispatcher_; | |
5670 } | 5609 } |
5671 | 5610 |
5672 WebKit::WebDeviceOrientationClient* RenderView::deviceOrientationClient() { | 5611 WebKit::WebDeviceOrientationClient* RenderView::deviceOrientationClient() { |
5673 if (!device_orientation_dispatcher_.get()) | 5612 if (!device_orientation_dispatcher_) { |
5674 device_orientation_dispatcher_.reset(new DeviceOrientationDispatcher(this)); | 5613 device_orientation_dispatcher_ = new DeviceOrientationDispatcher(); |
5675 return device_orientation_dispatcher_.get(); | 5614 AddObserver(device_orientation_dispatcher_); |
5615 } | |
5616 return device_orientation_dispatcher_; | |
5676 } | 5617 } |
5677 | 5618 |
5678 void RenderView::zoomLimitsChanged(double minimum_level, double maximum_level) { | 5619 void RenderView::zoomLimitsChanged(double minimum_level, double maximum_level) { |
5679 // For now, don't remember plugin zoom values. We don't want to mix them with | 5620 // For now, don't remember plugin zoom values. We don't want to mix them with |
5680 // normal web content (i.e. a fixed layout plugin would usually want them | 5621 // normal web content (i.e. a fixed layout plugin would usually want them |
5681 // different). | 5622 // different). |
5682 bool remember = !webview()->mainFrame()->document().isPluginDocument(); | 5623 bool remember = !webview()->mainFrame()->document().isPluginDocument(); |
5683 | 5624 |
5684 int minimum_percent = static_cast<int>( | 5625 int minimum_percent = static_cast<int>( |
5685 WebView::zoomLevelToZoomFactor(minimum_level) * 100); | 5626 WebView::zoomLevelToZoomFactor(minimum_level) * 100); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5792 } | 5733 } |
5793 #endif | 5734 #endif |
5794 | 5735 |
5795 void RenderView::OnJavaScriptStressTestControl(int cmd, int param) { | 5736 void RenderView::OnJavaScriptStressTestControl(int cmd, int param) { |
5796 if (cmd == kJavaScriptStressTestSetStressRunType) { | 5737 if (cmd == kJavaScriptStressTestSetStressRunType) { |
5797 v8::Testing::SetStressRunType(static_cast<v8::Testing::StressType>(param)); | 5738 v8::Testing::SetStressRunType(static_cast<v8::Testing::StressType>(param)); |
5798 } else if (cmd == kJavaScriptStressTestPrepareStressRun) { | 5739 } else if (cmd == kJavaScriptStressTestPrepareStressRun) { |
5799 v8::Testing::PrepareStressRun(param); | 5740 v8::Testing::PrepareStressRun(param); |
5800 } | 5741 } |
5801 } | 5742 } |
OLD | NEW |