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(RenderView* render_view) | |
511 : render_view_(render_view), routing_id_(render_view->routing_id()) { | |
512 render_view_->AddObserver(this); | |
513 } | |
514 | |
515 RenderView::Observer::~Observer() { | |
516 if (render_view_) | |
517 render_view_->RemoveObserver(this); | |
518 } | |
519 | |
520 void RenderView::Observer::OnDestruct() { | |
521 delete this; | |
522 } | |
523 | |
524 bool RenderView::Observer::OnMessageReceived(const IPC::Message& message) { | |
525 return false; | |
526 } | |
527 | |
528 bool RenderView::Observer::Send(IPC::Message* message) { | |
529 if (render_view_) | |
530 return render_view_->Send(message); | |
531 | |
532 delete message; | |
533 return false; | |
534 } | |
535 | |
510 int32 RenderView::next_page_id_ = 1; | 536 int32 RenderView::next_page_id_ = 1; |
511 | 537 |
512 struct RenderView::PendingFileChooser { | 538 struct RenderView::PendingFileChooser { |
513 PendingFileChooser(const ViewHostMsg_RunFileChooser_Params& p, | 539 PendingFileChooser(const ViewHostMsg_RunFileChooser_Params& p, |
514 WebFileChooserCompletion* c) | 540 WebFileChooserCompletion* c) |
515 : params(p), | 541 : params(p), |
516 completion(c) { | 542 completion(c) { |
517 } | 543 } |
518 ViewHostMsg_RunFileChooser_Params params; | 544 ViewHostMsg_RunFileChooser_Params params; |
519 WebFileChooserCompletion* completion; // MAY BE NULL to skip callback. | 545 WebFileChooserCompletion* completion; // MAY BE NULL to skip callback. |
520 }; | 546 }; |
521 | 547 |
522 RenderView::RenderView(RenderThreadBase* render_thread, | 548 RenderView::RenderView(RenderThreadBase* render_thread, |
523 const WebPreferences& webkit_preferences, | 549 gfx::NativeViewId parent_hwnd, |
524 int64 session_storage_namespace_id) | 550 int32 opener_id, |
551 const RendererPreferences& renderer_prefs, | |
552 const WebPreferences& webkit_prefs, | |
553 SharedRenderViewCounter* counter, | |
554 int32 routing_id, | |
555 int64 session_storage_namespace_id, | |
556 const string16& frame_name) | |
525 : RenderWidget(render_thread, WebKit::WebPopupTypeNone), | 557 : RenderWidget(render_thread, WebKit::WebPopupTypeNone), |
526 webkit_preferences_(webkit_preferences), | 558 webkit_preferences_(webkit_prefs), |
527 send_content_state_immediately_(false), | 559 send_content_state_immediately_(false), |
528 enabled_bindings_(0), | 560 enabled_bindings_(0), |
529 send_preferred_size_changes_(false), | 561 send_preferred_size_changes_(false), |
530 script_can_close_(true), | 562 script_can_close_(true), |
531 is_loading_(false), | 563 is_loading_(false), |
532 navigation_gesture_(NavigationGestureUnknown), | 564 navigation_gesture_(NavigationGestureUnknown), |
533 opened_by_user_gesture_(true), | 565 opened_by_user_gesture_(true), |
534 opener_suppressed_(false), | 566 opener_suppressed_(false), |
535 page_id_(-1), | 567 page_id_(-1), |
536 last_page_id_sent_to_browser_(-1), | 568 last_page_id_sent_to_browser_(-1), |
537 last_indexed_page_id_(-1), | 569 last_indexed_page_id_(-1), |
538 history_list_offset_(-1), | 570 history_list_offset_(-1), |
539 history_list_length_(0), | 571 history_list_length_(0), |
540 has_unload_listener_(false), | 572 has_unload_listener_(false), |
541 #if defined(OS_MACOSX) | 573 #if defined(OS_MACOSX) |
542 has_document_tag_(false), | 574 has_document_tag_(false), |
543 #endif | 575 #endif |
544 document_tag_(0), | 576 document_tag_(0), |
545 target_url_status_(TARGET_NONE), | 577 target_url_status_(TARGET_NONE), |
546 spelling_panel_visible_(false), | 578 spelling_panel_visible_(false), |
547 view_type_(ViewType::INVALID), | 579 view_type_(ViewType::INVALID), |
548 browser_window_id_(-1), | 580 browser_window_id_(-1), |
549 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)), | 581 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)), |
550 ALLOW_THIS_IN_INITIALIZER_LIST(page_info_method_factory_(this)), | 582 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)), | 583 ALLOW_THIS_IN_INITIALIZER_LIST(accessibility_method_factory_(this)), |
553 ALLOW_THIS_IN_INITIALIZER_LIST(translate_helper_(this)), | 584 ALLOW_THIS_IN_INITIALIZER_LIST(translate_helper_(this)), |
554 ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)), | 585 ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)), |
555 ALLOW_THIS_IN_INITIALIZER_LIST( | 586 devtools_client_(NULL), |
556 notification_provider_(new NotificationProvider(this))), | 587 geolocation_dispatcher_(NULL), |
588 speech_input_dispatcher_(NULL), | |
589 device_orientation_dispatcher_(NULL), | |
557 accessibility_ack_pending_(false), | 590 accessibility_ack_pending_(false), |
558 pending_app_icon_requests_(0), | 591 pending_app_icon_requests_(0), |
559 session_storage_namespace_id_(session_storage_namespace_id), | 592 session_storage_namespace_id_(session_storage_namespace_id), |
560 decrement_shared_popup_at_destruction_(false), | |
561 custom_menu_listener_(NULL) { | 593 custom_menu_listener_(NULL) { |
562 #if defined(OS_MACOSX) | 594 #if defined(OS_MACOSX) |
563 // On Mac, the select popups are rendered by the browser. | 595 // 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 | 596 // Note that we don't do this in RenderMain otherwise this would not be called |
565 // in single-process mode. | 597 // in single-process mode. |
566 WebKit::WebView::setUseExternalPopupMenus(true); | 598 WebKit::WebView::setUseExternalPopupMenus(true); |
567 #endif | 599 #endif |
568 password_autocomplete_manager_.reset(new PasswordAutocompleteManager(this)); | 600 |
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(); | 601 ClearBlockedContentSettings(); |
577 if (CommandLine::ForCurrentProcess()->HasSwitch( | 602 if (CommandLine::ForCurrentProcess()->HasSwitch( |
578 switches::kEnableClientSidePhishingDetection)) { | 603 switches::kEnableClientSidePhishingDetection)) { |
579 phishing_delegate_.reset( | 604 phishing_delegate_.reset( |
580 new safe_browsing::PhishingClassifierDelegate(this, NULL)); | 605 new safe_browsing::PhishingClassifierDelegate(this, NULL)); |
581 RenderThread* thread = RenderThread::current(); | 606 RenderThread* thread = RenderThread::current(); |
582 if (thread && thread->phishing_scorer()) { | 607 if (thread && thread->phishing_scorer()) { |
583 phishing_delegate_->SetPhishingScorer(thread->phishing_scorer()); | 608 phishing_delegate_->SetPhishingScorer(thread->phishing_scorer()); |
584 } | 609 } |
585 } | 610 } |
611 | |
612 routing_id_ = routing_id; | |
613 if (opener_id != MSG_ROUTING_NONE) | |
614 opener_id_ = opener_id; | |
615 | |
616 if (counter) { | |
617 shared_popup_counter_ = counter; | |
618 shared_popup_counter_->data++; | |
619 decrement_shared_popup_at_destruction_ = true; | |
620 } else { | |
621 shared_popup_counter_ = new SharedRenderViewCounter(0); | |
622 decrement_shared_popup_at_destruction_ = false; | |
623 } | |
624 | |
625 notification_provider_ = new NotificationProvider(this); | |
626 | |
627 devtools_agent_ = new DevToolsAgent(this); | |
628 PasswordAutocompleteManager* password_autocomplete_manager = | |
629 new PasswordAutocompleteManager(this); | |
630 AutoFillHelper* autofill_helper = new AutoFillHelper( | |
631 this, password_autocomplete_manager); | |
632 | |
633 webwidget_ = WebView::create(this, devtools_agent_, autofill_helper); | |
634 g_view_map.Get().insert(std::make_pair(webview(), this)); | |
635 webkit_preferences_.Apply(webview()); | |
636 webview()->initializeMainFrame(this); | |
637 if (!frame_name.empty()) | |
638 webview()->mainFrame()->setName(frame_name); | |
639 | |
640 OnSetRendererPrefs(renderer_prefs); | |
641 | |
642 render_thread_->AddRoute(routing_id_, this); | |
643 // Take a reference on behalf of the RenderThread. This will be balanced | |
644 // when we receive ViewMsg_Close. | |
645 AddRef(); | |
646 | |
647 // If this is a popup, we must wait for the CreatingNew_ACK message before | |
648 // completing initialization. Otherwise, we can finish it now. | |
649 if (opener_id == MSG_ROUTING_NONE) { | |
650 did_show_ = true; | |
651 CompleteInit(parent_hwnd); | |
652 } | |
653 | |
654 host_window_ = parent_hwnd; | |
655 | |
656 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | |
657 if (command_line.HasSwitch(switches::kDomAutomationController)) | |
658 enabled_bindings_ |= BindingsPolicy::DOM_AUTOMATION; | |
659 if (command_line.HasSwitch(switches::kEnableAccessibility)) | |
660 WebAccessibilityCache::enableAccessibility(); | |
661 | |
662 audio_message_filter_ = new AudioMessageFilter(routing_id_); | |
663 render_thread_->AddFilter(audio_message_filter_); | |
664 | |
665 PageClickTracker* page_click_tracker = new PageClickTracker(this); | |
666 // Note that the order of insertion of the listeners is important. | |
667 // The password_autocomplete_manager takes the first shot at processing the | |
668 // notification and can stop the propagation. | |
669 page_click_tracker->AddListener(password_autocomplete_manager); | |
670 page_click_tracker->AddListener(autofill_helper); | |
586 } | 671 } |
587 | 672 |
588 RenderView::~RenderView() { | 673 RenderView::~RenderView() { |
589 if (decrement_shared_popup_at_destruction_) | 674 if (decrement_shared_popup_at_destruction_) |
590 shared_popup_counter_->data--; | 675 shared_popup_counter_->data--; |
591 | 676 |
592 // If file chooser is still waiting for answer, dispatch empty answer. | 677 // If file chooser is still waiting for answer, dispatch empty answer. |
593 while (!file_chooser_completions_.empty()) { | 678 while (!file_chooser_completions_.empty()) { |
594 if (file_chooser_completions_.front()->completion) { | 679 if (file_chooser_completions_.front()->completion) { |
595 file_chooser_completions_.front()->completion->didChooseFile( | 680 file_chooser_completions_.front()->completion->didChooseFile( |
(...skipping 21 matching lines...) Expand all Loading... | |
617 // Tell the PhishingClassifierDelegate that the view is going away. | 702 // Tell the PhishingClassifierDelegate that the view is going away. |
618 if (phishing_delegate_.get()) | 703 if (phishing_delegate_.get()) |
619 phishing_delegate_->CancelPendingClassification(); | 704 phishing_delegate_->CancelPendingClassification(); |
620 | 705 |
621 #ifndef NDEBUG | 706 #ifndef NDEBUG |
622 // Make sure we are no longer referenced by the ViewMap. | 707 // Make sure we are no longer referenced by the ViewMap. |
623 ViewMap* views = g_view_map.Pointer(); | 708 ViewMap* views = g_view_map.Pointer(); |
624 for (ViewMap::iterator it = views->begin(); it != views->end(); ++it) | 709 for (ViewMap::iterator it = views->begin(); it != views->end(); ++it) |
625 DCHECK_NE(this, it->second) << "Failed to call Close?"; | 710 DCHECK_NE(this, it->second) << "Failed to call Close?"; |
626 #endif | 711 #endif |
712 | |
713 for (size_t i = 0; i < observers_.size(); ++i) { | |
714 observers_[i]->set_render_view(NULL); | |
715 observers_[i]->OnDestruct(); | |
716 } | |
627 } | 717 } |
628 | 718 |
629 /*static*/ | 719 /*static*/ |
630 void RenderView::ForEach(RenderViewVisitor* visitor) { | 720 void RenderView::ForEach(RenderViewVisitor* visitor) { |
631 ViewMap* views = g_view_map.Pointer(); | 721 ViewMap* views = g_view_map.Pointer(); |
632 for (ViewMap::iterator it = views->begin(); it != views->end(); ++it) { | 722 for (ViewMap::iterator it = views->begin(); it != views->end(); ++it) { |
633 if (!visitor->Visit(it->second)) | 723 if (!visitor->Visit(it->second)) |
634 return; | 724 return; |
635 } | 725 } |
636 } | 726 } |
(...skipping 10 matching lines...) Expand all Loading... | |
647 RenderThreadBase* render_thread, | 737 RenderThreadBase* render_thread, |
648 gfx::NativeViewId parent_hwnd, | 738 gfx::NativeViewId parent_hwnd, |
649 int32 opener_id, | 739 int32 opener_id, |
650 const RendererPreferences& renderer_prefs, | 740 const RendererPreferences& renderer_prefs, |
651 const WebPreferences& webkit_prefs, | 741 const WebPreferences& webkit_prefs, |
652 SharedRenderViewCounter* counter, | 742 SharedRenderViewCounter* counter, |
653 int32 routing_id, | 743 int32 routing_id, |
654 int64 session_storage_namespace_id, | 744 int64 session_storage_namespace_id, |
655 const string16& frame_name) { | 745 const string16& frame_name) { |
656 DCHECK(routing_id != MSG_ROUTING_NONE); | 746 DCHECK(routing_id != MSG_ROUTING_NONE); |
657 scoped_refptr<RenderView> view(new RenderView(render_thread, webkit_prefs, | 747 return new RenderView( |
658 session_storage_namespace_id)); | 748 render_thread, |
659 view->Init(parent_hwnd, | 749 parent_hwnd, |
660 opener_id, | 750 opener_id, |
661 renderer_prefs, | 751 renderer_prefs, |
662 counter, | 752 webkit_prefs, |
663 routing_id, | 753 counter, |
664 frame_name); // adds reference | 754 routing_id, |
665 return view; | 755 session_storage_namespace_id, |
756 frame_name); // adds reference | |
666 } | 757 } |
667 | 758 |
668 // static | 759 // static |
669 void RenderView::SetNextPageID(int32 next_page_id) { | 760 void RenderView::SetNextPageID(int32 next_page_id) { |
670 // This method should only be called during process startup, and the given | 761 // This method should only be called during process startup, and the given |
671 // page id had better not exceed our current next page id! | 762 // page id had better not exceed our current next page id! |
672 DCHECK_EQ(next_page_id_, 1); | 763 DCHECK_EQ(next_page_id_, 1); |
673 DCHECK(next_page_id >= next_page_id_); | 764 DCHECK(next_page_id >= next_page_id_); |
674 next_page_id_ = next_page_id; | 765 next_page_id_ = next_page_id; |
675 } | 766 } |
676 | 767 |
768 void RenderView::AddObserver(Observer* observer) { | |
769 observers_.push_back(observer); | |
770 } | |
771 | |
772 void RenderView::RemoveObserver(Observer* observer) { | |
773 observer->set_render_view(NULL); | |
774 for (size_t i = 0; i < observers_.size(); ++i) { | |
775 if (observers_[i] == observer) | |
776 observers_.erase(observers_.begin() + i); | |
777 } | |
778 } | |
779 | |
677 bool RenderView::RendererAccessibilityNotification::ShouldIncludeChildren() { | 780 bool RenderView::RendererAccessibilityNotification::ShouldIncludeChildren() { |
678 typedef ViewHostMsg_AccessibilityNotification_Params params; | 781 typedef ViewHostMsg_AccessibilityNotification_Params params; |
679 if (type == params::NOTIFICATION_TYPE_CHILDREN_CHANGED || | 782 if (type == params::NOTIFICATION_TYPE_CHILDREN_CHANGED || |
680 type == params::NOTIFICATION_TYPE_LOAD_COMPLETE) { | 783 type == params::NOTIFICATION_TYPE_LOAD_COMPLETE) { |
681 return true; | 784 return true; |
682 } | 785 } |
683 return false; | 786 return false; |
684 } | 787 } |
685 | 788 |
686 WebKit::WebView* RenderView::webview() const { | 789 WebKit::WebView* RenderView::webview() const { |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
887 } | 990 } |
888 | 991 |
889 void RenderView::RegisterBlockedPlugin(BlockedPlugin* blocked_plugin) { | 992 void RenderView::RegisterBlockedPlugin(BlockedPlugin* blocked_plugin) { |
890 blocked_plugins_.insert(blocked_plugin); | 993 blocked_plugins_.insert(blocked_plugin); |
891 } | 994 } |
892 | 995 |
893 void RenderView::UnregisterBlockedPlugin(BlockedPlugin* blocked_plugin) { | 996 void RenderView::UnregisterBlockedPlugin(BlockedPlugin* blocked_plugin) { |
894 blocked_plugins_.erase(blocked_plugin); | 997 blocked_plugins_.erase(blocked_plugin); |
895 } | 998 } |
896 | 999 |
897 void RenderView::Init(gfx::NativeViewId parent_hwnd, | |
898 int32 opener_id, | |
899 const RendererPreferences& renderer_prefs, | |
900 SharedRenderViewCounter* counter, | |
901 int32 routing_id, | |
902 const string16& frame_name) { | |
903 DCHECK(!webview()); | |
904 | |
905 if (opener_id != MSG_ROUTING_NONE) | |
906 opener_id_ = opener_id; | |
907 | |
908 if (counter) { | |
909 shared_popup_counter_ = counter; | |
910 shared_popup_counter_->data++; | |
911 decrement_shared_popup_at_destruction_ = true; | |
912 } else { | |
913 shared_popup_counter_ = new SharedRenderViewCounter(0); | |
914 decrement_shared_popup_at_destruction_ = false; | |
915 } | |
916 | |
917 devtools_agent_.reset(new DevToolsAgent(routing_id, this)); | |
918 | |
919 // TODO(jam): remove this once WebKit is rolled | |
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)); | |
926 webkit_preferences_.Apply(webview()); | |
927 webview()->initializeMainFrame(this); | |
928 if (!frame_name.empty()) | |
929 webview()->mainFrame()->setName(frame_name); | |
930 | |
931 OnSetRendererPrefs(renderer_prefs); | |
932 | |
933 routing_id_ = routing_id; | |
934 render_thread_->AddRoute(routing_id_, this); | |
935 // Take a reference on behalf of the RenderThread. This will be balanced | |
936 // when we receive ViewMsg_Close. | |
937 AddRef(); | |
938 | |
939 // If this is a popup, we must wait for the CreatingNew_ACK message before | |
940 // completing initialization. Otherwise, we can finish it now. | |
941 if (opener_id == MSG_ROUTING_NONE) { | |
942 did_show_ = true; | |
943 CompleteInit(parent_hwnd); | |
944 } | |
945 | |
946 host_window_ = parent_hwnd; | |
947 | |
948 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | |
949 if (command_line.HasSwitch(switches::kDomAutomationController)) | |
950 enabled_bindings_ |= BindingsPolicy::DOM_AUTOMATION; | |
951 if (command_line.HasSwitch(switches::kEnableAccessibility)) | |
952 WebAccessibilityCache::enableAccessibility(); | |
953 | |
954 audio_message_filter_ = new AudioMessageFilter(routing_id_); | |
955 render_thread_->AddFilter(audio_message_filter_); | |
956 } | |
957 | |
958 bool RenderView::OnMessageReceived(const IPC::Message& message) { | 1000 bool RenderView::OnMessageReceived(const IPC::Message& message) { |
959 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; | 1001 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; |
960 if (main_frame) | 1002 if (main_frame) |
961 child_process_logging::SetActiveURL(main_frame->url()); | 1003 child_process_logging::SetActiveURL(main_frame->url()); |
962 | 1004 |
963 // If this is developer tools renderer intercept tools messages first. | 1005 for (size_t i = 0; i < observers_.size(); ++i) { |
brettw
2011/01/14 02:20:05
You should probably use base/observer_list and NOT
| |
964 if (devtools_client_.get() && devtools_client_->OnMessageReceived(message)) | 1006 if (observers_[i]->OnMessageReceived(message)) |
965 return true; | 1007 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 } | 1008 } |
982 | 1009 |
983 bool handled = true; | 1010 bool handled = true; |
984 IPC_BEGIN_MESSAGE_MAP(RenderView, message) | 1011 IPC_BEGIN_MESSAGE_MAP(RenderView, message) |
985 IPC_MESSAGE_HANDLER(ViewMsg_CaptureThumbnail, OnCaptureThumbnail) | 1012 IPC_MESSAGE_HANDLER(ViewMsg_CaptureThumbnail, OnCaptureThumbnail) |
986 IPC_MESSAGE_HANDLER(ViewMsg_CaptureSnapshot, OnCaptureSnapshot) | 1013 IPC_MESSAGE_HANDLER(ViewMsg_CaptureSnapshot, OnCaptureSnapshot) |
987 IPC_MESSAGE_HANDLER(ViewMsg_PrintPages, OnPrintPages) | 1014 IPC_MESSAGE_HANDLER(ViewMsg_PrintPages, OnPrintPages) |
988 IPC_MESSAGE_HANDLER(ViewMsg_PrintingDone, OnPrintingDone) | 1015 IPC_MESSAGE_HANDLER(ViewMsg_PrintingDone, OnPrintingDone) |
989 IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate) | 1016 IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate) |
990 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop) | 1017 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop) |
(...skipping 26 matching lines...) Expand all Loading... | |
1017 OnSetZoomLevelForLoadingURL) | 1044 OnSetZoomLevelForLoadingURL) |
1018 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) | 1045 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) |
1019 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, | 1046 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, |
1020 OnResetPageEncodingToDefault) | 1047 OnResetPageEncodingToDefault) |
1021 IPC_MESSAGE_HANDLER(ViewMsg_SetupDevToolsClient, OnSetupDevToolsClient) | 1048 IPC_MESSAGE_HANDLER(ViewMsg_SetupDevToolsClient, OnSetupDevToolsClient) |
1022 IPC_MESSAGE_HANDLER(ViewMsg_DownloadFavIcon, OnDownloadFavIcon) | 1049 IPC_MESSAGE_HANDLER(ViewMsg_DownloadFavIcon, OnDownloadFavIcon) |
1023 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) | 1050 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) |
1024 IPC_MESSAGE_HANDLER(ViewMsg_CSSInsertRequest, OnCSSInsertRequest) | 1051 IPC_MESSAGE_HANDLER(ViewMsg_CSSInsertRequest, OnCSSInsertRequest) |
1025 IPC_MESSAGE_HANDLER(ViewMsg_AddMessageToConsole, OnAddMessageToConsole) | 1052 IPC_MESSAGE_HANDLER(ViewMsg_AddMessageToConsole, OnAddMessageToConsole) |
1026 IPC_MESSAGE_HANDLER(ViewMsg_ReservePageIDRange, OnReservePageIDRange) | 1053 IPC_MESSAGE_HANDLER(ViewMsg_ReservePageIDRange, OnReservePageIDRange) |
1027 IPC_MESSAGE_HANDLER(ViewMsg_FillPasswordForm, OnFillPasswordForm) | |
1028 IPC_MESSAGE_HANDLER(ViewMsg_DragTargetDragEnter, OnDragTargetDragEnter) | 1054 IPC_MESSAGE_HANDLER(ViewMsg_DragTargetDragEnter, OnDragTargetDragEnter) |
1029 IPC_MESSAGE_HANDLER(ViewMsg_DragTargetDragOver, OnDragTargetDragOver) | 1055 IPC_MESSAGE_HANDLER(ViewMsg_DragTargetDragOver, OnDragTargetDragOver) |
1030 IPC_MESSAGE_HANDLER(ViewMsg_DragTargetDragLeave, OnDragTargetDragLeave) | 1056 IPC_MESSAGE_HANDLER(ViewMsg_DragTargetDragLeave, OnDragTargetDragLeave) |
1031 IPC_MESSAGE_HANDLER(ViewMsg_DragTargetDrop, OnDragTargetDrop) | 1057 IPC_MESSAGE_HANDLER(ViewMsg_DragTargetDrop, OnDragTargetDrop) |
1032 IPC_MESSAGE_HANDLER(ViewMsg_AllowBindings, OnAllowBindings) | 1058 IPC_MESSAGE_HANDLER(ViewMsg_AllowBindings, OnAllowBindings) |
1033 IPC_MESSAGE_HANDLER(ViewMsg_SetDOMUIProperty, OnSetDOMUIProperty) | 1059 IPC_MESSAGE_HANDLER(ViewMsg_SetDOMUIProperty, OnSetDOMUIProperty) |
1034 IPC_MESSAGE_HANDLER(ViewMsg_DragSourceEndedOrMoved, | 1060 IPC_MESSAGE_HANDLER(ViewMsg_DragSourceEndedOrMoved, |
1035 OnDragSourceEndedOrMoved) | 1061 OnDragSourceEndedOrMoved) |
1036 IPC_MESSAGE_HANDLER(ViewMsg_DragSourceSystemDragEnded, | 1062 IPC_MESSAGE_HANDLER(ViewMsg_DragSourceSystemDragEnded, |
1037 OnDragSourceSystemDragEnded) | 1063 OnDragSourceSystemDragEnded) |
(...skipping 13 matching lines...) Expand all Loading... | |
1051 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, | 1077 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, |
1052 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) | 1078 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) |
1053 IPC_MESSAGE_HANDLER(ViewMsg_GetApplicationInfo, OnGetApplicationInfo) | 1079 IPC_MESSAGE_HANDLER(ViewMsg_GetApplicationInfo, OnGetApplicationInfo) |
1054 IPC_MESSAGE_HANDLER(ViewMsg_ShouldClose, OnShouldClose) | 1080 IPC_MESSAGE_HANDLER(ViewMsg_ShouldClose, OnShouldClose) |
1055 IPC_MESSAGE_HANDLER(ViewMsg_ClosePage, OnClosePage) | 1081 IPC_MESSAGE_HANDLER(ViewMsg_ClosePage, OnClosePage) |
1056 IPC_MESSAGE_HANDLER(ViewMsg_ThemeChanged, OnThemeChanged) | 1082 IPC_MESSAGE_HANDLER(ViewMsg_ThemeChanged, OnThemeChanged) |
1057 IPC_MESSAGE_HANDLER(ViewMsg_HandleMessageFromExternalHost, | 1083 IPC_MESSAGE_HANDLER(ViewMsg_HandleMessageFromExternalHost, |
1058 OnHandleMessageFromExternalHost) | 1084 OnHandleMessageFromExternalHost) |
1059 IPC_MESSAGE_HANDLER(ViewMsg_DisassociateFromPopupCount, | 1085 IPC_MESSAGE_HANDLER(ViewMsg_DisassociateFromPopupCount, |
1060 OnDisassociateFromPopupCount) | 1086 OnDisassociateFromPopupCount) |
1061 IPC_MESSAGE_HANDLER(ViewMsg_AutoFillSuggestionsReturned, | |
1062 OnAutoFillSuggestionsReturned) | |
1063 IPC_MESSAGE_HANDLER(ViewMsg_AutoFillFormDataFilled, | |
1064 OnAutoFillFormDataFilled) | |
1065 IPC_MESSAGE_HANDLER(ViewMsg_AllowScriptToClose, | 1087 IPC_MESSAGE_HANDLER(ViewMsg_AllowScriptToClose, |
1066 OnAllowScriptToClose) | 1088 OnAllowScriptToClose) |
1067 IPC_MESSAGE_HANDLER(ViewMsg_MoveOrResizeStarted, OnMoveOrResizeStarted) | 1089 IPC_MESSAGE_HANDLER(ViewMsg_MoveOrResizeStarted, OnMoveOrResizeStarted) |
1068 IPC_MESSAGE_HANDLER(ViewMsg_ExtensionResponse, OnExtensionResponse) | 1090 IPC_MESSAGE_HANDLER(ViewMsg_ExtensionResponse, OnExtensionResponse) |
1069 IPC_MESSAGE_HANDLER(ViewMsg_ExtensionMessageInvoke, | 1091 IPC_MESSAGE_HANDLER(ViewMsg_ExtensionMessageInvoke, |
1070 OnExtensionMessageInvoke) | 1092 OnExtensionMessageInvoke) |
1071 IPC_MESSAGE_HANDLER(ViewMsg_ClearFocusedNode, OnClearFocusedNode) | 1093 IPC_MESSAGE_HANDLER(ViewMsg_ClearFocusedNode, OnClearFocusedNode) |
1072 IPC_MESSAGE_HANDLER(ViewMsg_SetBackground, OnSetBackground) | 1094 IPC_MESSAGE_HANDLER(ViewMsg_SetBackground, OnSetBackground) |
1073 IPC_MESSAGE_HANDLER(ViewMsg_EnablePreferredSizeChangedMode, | 1095 IPC_MESSAGE_HANDLER(ViewMsg_EnablePreferredSizeChangedMode, |
1074 OnEnablePreferredSizeChangedMode) | 1096 OnEnablePreferredSizeChangedMode) |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1376 return true; | 1398 return true; |
1377 } | 1399 } |
1378 | 1400 |
1379 void RenderView::OnNavigate(const ViewMsg_Navigate_Params& params) { | 1401 void RenderView::OnNavigate(const ViewMsg_Navigate_Params& params) { |
1380 if (!webview()) | 1402 if (!webview()) |
1381 return; | 1403 return; |
1382 | 1404 |
1383 history_list_offset_ = params.current_history_list_offset; | 1405 history_list_offset_ = params.current_history_list_offset; |
1384 history_list_length_ = params.current_history_list_length; | 1406 history_list_length_ = params.current_history_list_length; |
1385 | 1407 |
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); | 1408 child_process_logging::SetActiveURL(params.url); |
1393 | 1409 |
1394 AboutHandler::MaybeHandle(params.url); | 1410 AboutHandler::MaybeHandle(params.url); |
1395 | 1411 |
1396 bool is_reload = | 1412 bool is_reload = |
1397 params.navigation_type == ViewMsg_Navigate_Params::RELOAD || | 1413 params.navigation_type == ViewMsg_Navigate_Params::RELOAD || |
1398 params.navigation_type == ViewMsg_Navigate_Params::RELOAD_IGNORING_CACHE; | 1414 params.navigation_type == ViewMsg_Navigate_Params::RELOAD_IGNORING_CACHE; |
1399 | 1415 |
1400 WebFrame* main_frame = webview()->mainFrame(); | 1416 WebFrame* main_frame = webview()->mainFrame(); |
1401 if (is_reload && main_frame->currentHistoryItem().isNull()) { | 1417 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, | 1518 void RenderView::OnExecuteEditCommand(const std::string& name, |
1503 const std::string& value) { | 1519 const std::string& value) { |
1504 if (!webview() || !webview()->focusedFrame()) | 1520 if (!webview() || !webview()->focusedFrame()) |
1505 return; | 1521 return; |
1506 | 1522 |
1507 webview()->focusedFrame()->executeCommand( | 1523 webview()->focusedFrame()->executeCommand( |
1508 WebString::fromUTF8(name), WebString::fromUTF8(value)); | 1524 WebString::fromUTF8(name), WebString::fromUTF8(value)); |
1509 } | 1525 } |
1510 | 1526 |
1511 void RenderView::OnSetupDevToolsClient() { | 1527 void RenderView::OnSetupDevToolsClient() { |
1512 DCHECK(!devtools_client_.get()); | 1528 DCHECK(!devtools_client_); |
1513 devtools_client_.reset(new DevToolsClient(this)); | 1529 devtools_client_ = new DevToolsClient(this); |
1514 } | 1530 } |
1515 | 1531 |
1516 void RenderView::OnUpdateTargetURLAck() { | 1532 void RenderView::OnUpdateTargetURLAck() { |
1517 // Check if there is a targeturl waiting to be sent. | 1533 // Check if there is a targeturl waiting to be sent. |
1518 if (target_url_status_ == TARGET_PENDING) { | 1534 if (target_url_status_ == TARGET_PENDING) { |
1519 Send(new ViewHostMsg_UpdateTargetURL(routing_id_, page_id_, | 1535 Send(new ViewHostMsg_UpdateTargetURL(routing_id_, page_id_, |
1520 pending_target_url_)); | 1536 pending_target_url_)); |
1521 } | 1537 } |
1522 | 1538 |
1523 target_url_status_ = TARGET_NONE; | 1539 target_url_status_ = TARGET_NONE; |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1980 } | 1996 } |
1981 | 1997 |
1982 void RenderView::AddGURLSearchProvider( | 1998 void RenderView::AddGURLSearchProvider( |
1983 const GURL& osd_url, | 1999 const GURL& osd_url, |
1984 const ViewHostMsg_PageHasOSDD_Type& provider_type) { | 2000 const ViewHostMsg_PageHasOSDD_Type& provider_type) { |
1985 if (!osd_url.is_empty()) | 2001 if (!osd_url.is_empty()) |
1986 Send(new ViewHostMsg_PageHasOSDD(routing_id_, page_id_, osd_url, | 2002 Send(new ViewHostMsg_PageHasOSDD(routing_id_, page_id_, osd_url, |
1987 provider_type)); | 2003 provider_type)); |
1988 } | 2004 } |
1989 | 2005 |
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) { | 2006 void RenderView::OnAllowScriptToClose(bool script_can_close) { |
2006 script_can_close_ = script_can_close; | 2007 script_can_close_ = script_can_close; |
2007 } | 2008 } |
2008 | 2009 |
2009 uint32 RenderView::GetCPBrowsingContext() { | 2010 uint32 RenderView::GetCPBrowsingContext() { |
2010 uint32 context = 0; | 2011 uint32 context = 0; |
2011 Send(new ViewHostMsg_GetCPBrowsingContext(&context)); | 2012 Send(new ViewHostMsg_GetCPBrowsingContext(&context)); |
2012 return context; | 2013 return context; |
2013 } | 2014 } |
2014 | 2015 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2184 DCHECK(frame); | 2185 DCHECK(frame); |
2185 if (CommandLine::ForCurrentProcess()->HasSwitch( | 2186 if (CommandLine::ForCurrentProcess()->HasSwitch( |
2186 switches::kEnablePrintPreview)) { | 2187 switches::kEnablePrintPreview)) { |
2187 Print(frame, true, true); | 2188 Print(frame, true, true); |
2188 } else { | 2189 } else { |
2189 Print(frame, true, false); | 2190 Print(frame, true, false); |
2190 } | 2191 } |
2191 } | 2192 } |
2192 | 2193 |
2193 WebKit::WebNotificationPresenter* RenderView::notificationPresenter() { | 2194 WebKit::WebNotificationPresenter* RenderView::notificationPresenter() { |
2194 return notification_provider_.get(); | 2195 return notification_provider_; |
2195 } | 2196 } |
2196 | 2197 |
2197 void RenderView::didStartLoading() { | 2198 void RenderView::didStartLoading() { |
2198 if (is_loading_) { | 2199 if (is_loading_) { |
2199 DLOG(WARNING) << "didStartLoading called while loading"; | 2200 DLOG(WARNING) << "didStartLoading called while loading"; |
2200 return; | 2201 return; |
2201 } | 2202 } |
2202 | 2203 |
2203 is_loading_ = true; | 2204 is_loading_ = true; |
2204 // Clear the pointer so that we can assign it only when there is an unknown | 2205 // 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 | 2290 |
2290 void RenderView::didExecuteCommand(const WebString& command_name) { | 2291 void RenderView::didExecuteCommand(const WebString& command_name) { |
2291 const std::string& name = UTF16ToUTF8(command_name); | 2292 const std::string& name = UTF16ToUTF8(command_name); |
2292 if (StartsWithASCII(name, "Move", true) || | 2293 if (StartsWithASCII(name, "Move", true) || |
2293 StartsWithASCII(name, "Insert", true) || | 2294 StartsWithASCII(name, "Insert", true) || |
2294 StartsWithASCII(name, "Delete", true)) | 2295 StartsWithASCII(name, "Delete", true)) |
2295 return; | 2296 return; |
2296 UserMetricsRecordAction(name); | 2297 UserMetricsRecordAction(name); |
2297 } | 2298 } |
2298 | 2299 |
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() { | 2300 void RenderView::SendPendingAccessibilityNotifications() { |
2323 if (!accessibility_.get()) | 2301 if (!accessibility_.get()) |
2324 return; | 2302 return; |
2325 | 2303 |
2326 if (pending_accessibility_notifications_.empty()) | 2304 if (pending_accessibility_notifications_.empty()) |
2327 return; | 2305 return; |
2328 | 2306 |
2329 // Send all pending accessibility notifications. | 2307 // Send all pending accessibility notifications. |
2330 std::vector<ViewHostMsg_AccessibilityNotification_Params> notifications; | 2308 std::vector<ViewHostMsg_AccessibilityNotification_Params> notifications; |
2331 for (size_t i = 0; i < pending_accessibility_notifications_.size(); i++) { | 2309 for (size_t i = 0; i < pending_accessibility_notifications_.size(); i++) { |
2332 RendererAccessibilityNotification& notification = | 2310 RendererAccessibilityNotification& notification = |
2333 pending_accessibility_notifications_[i]; | 2311 pending_accessibility_notifications_[i]; |
2334 WebAccessibilityObject obj = accessibility_->getObjectById(notification.id); | 2312 WebAccessibilityObject obj = accessibility_->getObjectById(notification.id); |
2335 if (!obj.isValid()) | 2313 if (!obj.isValid()) |
2336 continue; | 2314 continue; |
2337 | 2315 |
2338 ViewHostMsg_AccessibilityNotification_Params param; | 2316 ViewHostMsg_AccessibilityNotification_Params param; |
2339 param.notification_type = pending_accessibility_notifications_[i].type; | 2317 param.notification_type = pending_accessibility_notifications_[i].type; |
2340 param.acc_obj = WebAccessibility( | 2318 param.acc_obj = WebAccessibility( |
2341 obj, accessibility_.get(), notification.ShouldIncludeChildren()); | 2319 obj, accessibility_.get(), notification.ShouldIncludeChildren()); |
2342 notifications.push_back(param); | 2320 notifications.push_back(param); |
2343 } | 2321 } |
2344 pending_accessibility_notifications_.clear(); | 2322 pending_accessibility_notifications_.clear(); |
2345 Send(new ViewHostMsg_AccessibilityNotifications(routing_id_, notifications)); | 2323 Send(new ViewHostMsg_AccessibilityNotifications(routing_id_, notifications)); |
2346 accessibility_ack_pending_ = true; | 2324 accessibility_ack_pending_ = true; |
2347 } | 2325 } |
2348 | 2326 |
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() { | 2327 bool RenderView::handleCurrentKeyboardEvent() { |
2357 if (edit_commands_.empty()) | 2328 if (edit_commands_.empty()) |
2358 return false; | 2329 return false; |
2359 | 2330 |
2360 WebFrame* frame = webview()->focusedFrame(); | 2331 WebFrame* frame = webview()->focusedFrame(); |
2361 if (!frame) | 2332 if (!frame) |
2362 return false; | 2333 return false; |
2363 | 2334 |
2364 EditCommands::iterator it = edit_commands_.begin(); | 2335 EditCommands::iterator it = edit_commands_.begin(); |
2365 EditCommands::iterator end = edit_commands_.end(); | 2336 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; | 2609 return history_list_length_ - historyBackListCount() - 1; |
2639 } | 2610 } |
2640 | 2611 |
2641 void RenderView::didUpdateInspectorSetting(const WebString& key, | 2612 void RenderView::didUpdateInspectorSetting(const WebString& key, |
2642 const WebString& value) { | 2613 const WebString& value) { |
2643 Send(new ViewHostMsg_UpdateInspectorSetting(routing_id_, | 2614 Send(new ViewHostMsg_UpdateInspectorSetting(routing_id_, |
2644 key.utf8(), | 2615 key.utf8(), |
2645 value.utf8())); | 2616 value.utf8())); |
2646 } | 2617 } |
2647 | 2618 |
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 ---------------------------------------------------- | 2619 // WebKit::WebWidgetClient ---------------------------------------------------- |
2686 | 2620 |
2687 void RenderView::didFocus() { | 2621 void RenderView::didFocus() { |
2688 // TODO(jcivelli): when https://bugs.webkit.org/show_bug.cgi?id=33389 is fixed | 2622 // 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 | 2623 // we won't have to test for user gesture anymore and we can |
2690 // move that code back to render_widget.cc | 2624 // move that code back to render_widget.cc |
2691 if (webview() && webview()->mainFrame() && | 2625 if (webview() && webview()->mainFrame() && |
2692 webview()->mainFrame()->isProcessingUserGesture()) { | 2626 webview()->mainFrame()->isProcessingUserGesture()) { |
2693 Send(new ViewHostMsg_Focus(routing_id_)); | 2627 Send(new ViewHostMsg_Focus(routing_id_)); |
2694 } | 2628 } |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2930 return new RendererWebApplicationCacheHostImpl( | 2864 return new RendererWebApplicationCacheHostImpl( |
2931 FromWebView(frame->view()), client, | 2865 FromWebView(frame->view()), client, |
2932 RenderThread::current()->appcache_dispatcher()->backend_proxy()); | 2866 RenderThread::current()->appcache_dispatcher()->backend_proxy()); |
2933 } | 2867 } |
2934 | 2868 |
2935 WebCookieJar* RenderView::cookieJar(WebFrame* frame) { | 2869 WebCookieJar* RenderView::cookieJar(WebFrame* frame) { |
2936 return &cookie_jar_; | 2870 return &cookie_jar_; |
2937 } | 2871 } |
2938 | 2872 |
2939 void RenderView::frameDetached(WebFrame* frame) { | 2873 void RenderView::frameDetached(WebFrame* frame) { |
2940 autofill_helper_->FrameDetached(frame); | 2874 for (size_t i = 0; i < observers_.size(); ++i) |
2941 page_click_tracker_->StopTrackingFrame(frame, true); | 2875 observers_[i]->FrameDetached(frame); |
2942 } | 2876 } |
2943 | 2877 |
2944 void RenderView::willClose(WebFrame* frame) { | 2878 void RenderView::willClose(WebFrame* frame) { |
2945 WebDataSource* ds = frame->dataSource(); | 2879 WebDataSource* ds = frame->dataSource(); |
2946 NavigationState* navigation_state = NavigationState::FromDataSource(ds); | 2880 NavigationState* navigation_state = NavigationState::FromDataSource(ds); |
2947 | 2881 |
2948 page_load_histograms_.Dump(frame); | 2882 page_load_histograms_.Dump(frame); |
2949 navigation_state->user_script_idle_scheduler()->Cancel(); | 2883 navigation_state->user_script_idle_scheduler()->Cancel(); |
2950 | 2884 |
2951 // TODO(jhawkins): Remove once frameDetached is called by WebKit. | 2885 for (size_t i = 0; i < observers_.size(); ++i) |
2952 // NOTE: taking this out results in lots of increased memory usage! This is | 2886 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 } | 2887 } |
2957 | 2888 |
2958 bool RenderView::allowImages(WebFrame* frame, bool enabled_per_settings) { | 2889 bool RenderView::allowImages(WebFrame* frame, bool enabled_per_settings) { |
2959 if (enabled_per_settings && | 2890 if (enabled_per_settings && |
2960 AllowContentType(CONTENT_SETTINGS_TYPE_IMAGES)) | 2891 AllowContentType(CONTENT_SETTINGS_TYPE_IMAGES)) |
2961 return true; | 2892 return true; |
2962 | 2893 |
2963 if (IsWhitelistedForContentSettings(frame)) | 2894 if (IsWhitelistedForContentSettings(frame)) |
2964 return true; | 2895 return true; |
2965 | 2896 |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3539 } | 3470 } |
3540 | 3471 |
3541 void RenderView::didFinishDocumentLoad(WebFrame* frame) { | 3472 void RenderView::didFinishDocumentLoad(WebFrame* frame) { |
3542 WebDataSource* ds = frame->dataSource(); | 3473 WebDataSource* ds = frame->dataSource(); |
3543 NavigationState* navigation_state = NavigationState::FromDataSource(ds); | 3474 NavigationState* navigation_state = NavigationState::FromDataSource(ds); |
3544 DCHECK(navigation_state); | 3475 DCHECK(navigation_state); |
3545 navigation_state->set_finish_document_load_time(Time::Now()); | 3476 navigation_state->set_finish_document_load_time(Time::Now()); |
3546 | 3477 |
3547 Send(new ViewHostMsg_DocumentLoadedInFrame(routing_id_, frame->identifier())); | 3478 Send(new ViewHostMsg_DocumentLoadedInFrame(routing_id_, frame->identifier())); |
3548 | 3479 |
3549 page_click_tracker_->StartTrackingFrame(frame); | 3480 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 | 3481 observers_[i]->DidFinishDocumentLoad(frame); |
3551 // the browser. | |
3552 autofill_helper_->FrameContentsAvailable(frame); | |
3553 password_autocomplete_manager_->SendPasswordForms(frame, false); | |
3554 | 3482 |
3555 // Check whether we have new encoding name. | 3483 // Check whether we have new encoding name. |
3556 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); | 3484 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); |
3557 | 3485 |
3558 if (RenderThread::current()) { // Will be NULL during unit tests. | 3486 if (RenderThread::current()) { // Will be NULL during unit tests. |
3559 RenderThread::current()->user_script_slave()->InjectScripts( | 3487 RenderThread::current()->user_script_slave()->InjectScripts( |
3560 frame, UserScript::DOCUMENT_END); | 3488 frame, UserScript::DOCUMENT_END); |
3561 } | 3489 } |
3562 | 3490 |
3563 // InjectScripts() can end up creating a new NavigationState if it triggers a | 3491 // InjectScripts() can end up creating a new NavigationState if it triggers a |
(...skipping 30 matching lines...) Expand all Loading... | |
3594 // Ignore | 3522 // Ignore |
3595 } | 3523 } |
3596 | 3524 |
3597 void RenderView::didFinishLoad(WebFrame* frame) { | 3525 void RenderView::didFinishLoad(WebFrame* frame) { |
3598 WebDataSource* ds = frame->dataSource(); | 3526 WebDataSource* ds = frame->dataSource(); |
3599 NavigationState* navigation_state = NavigationState::FromDataSource(ds); | 3527 NavigationState* navigation_state = NavigationState::FromDataSource(ds); |
3600 DCHECK(navigation_state); | 3528 DCHECK(navigation_state); |
3601 navigation_state->set_finish_load_time(Time::Now()); | 3529 navigation_state->set_finish_load_time(Time::Now()); |
3602 navigation_state->user_script_idle_scheduler()->DidFinishLoad(); | 3530 navigation_state->user_script_idle_scheduler()->DidFinishLoad(); |
3603 | 3531 |
3604 // Let the password manager know which password forms are actually visible. | 3532 for (size_t i = 0; i < observers_.size(); ++i) |
3605 password_autocomplete_manager_->SendPasswordForms(frame, true); | 3533 observers_[i]->DidFinishLoad(frame); |
3606 | 3534 |
3607 Send(new ViewHostMsg_DidFinishLoad(routing_id_, frame->identifier())); | 3535 Send(new ViewHostMsg_DidFinishLoad(routing_id_, frame->identifier())); |
3608 } | 3536 } |
3609 | 3537 |
3610 void RenderView::didNavigateWithinPage( | 3538 void RenderView::didNavigateWithinPage( |
3611 WebFrame* frame, bool is_new_navigation) { | 3539 WebFrame* frame, bool is_new_navigation) { |
3612 // Determine if the UserScriptIdleScheduler already ran scripts on this page, | 3540 // Determine if the UserScriptIdleScheduler already ran scripts on this page, |
3613 // since a new one gets created by didCreateDataSource. | 3541 // since a new one gets created by didCreateDataSource. |
3614 NavigationState* state = NavigationState::FromDataSource(frame->dataSource()); | 3542 NavigationState* state = NavigationState::FromDataSource(frame->dataSource()); |
3615 bool idle_scheduler_ran = state->user_script_idle_scheduler()->has_run(); | 3543 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); | 4637 webview()->dragSourceEndedAt(client_point, screen_point, op); |
4710 } else { | 4638 } else { |
4711 webview()->dragSourceMovedTo(client_point, screen_point, op); | 4639 webview()->dragSourceMovedTo(client_point, screen_point, op); |
4712 } | 4640 } |
4713 } | 4641 } |
4714 | 4642 |
4715 void RenderView::OnDragSourceSystemDragEnded() { | 4643 void RenderView::OnDragSourceSystemDragEnded() { |
4716 webview()->dragSourceSystemDragEnded(); | 4644 webview()->dragSourceSystemDragEnded(); |
4717 } | 4645 } |
4718 | 4646 |
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, | 4647 void RenderView::OnDragTargetDragEnter(const WebDropData& drop_data, |
4726 const gfx::Point& client_point, | 4648 const gfx::Point& client_point, |
4727 const gfx::Point& screen_point, | 4649 const gfx::Point& screen_point, |
4728 WebDragOperationsMask ops) { | 4650 WebDragOperationsMask ops) { |
4729 WebDragOperation operation = webview()->dragTargetDragEnter( | 4651 WebDragOperation operation = webview()->dragTargetDragEnter( |
4730 drop_data.ToDragData(), | 4652 drop_data.ToDragData(), |
4731 drop_data.identity, | 4653 drop_data.identity, |
4732 client_point, | 4654 client_point, |
4733 screen_point, | 4655 screen_point, |
4734 ops); | 4656 ops); |
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5487 WebView* doomed = webview(); | 5409 WebView* doomed = webview(); |
5488 RenderWidget::Close(); | 5410 RenderWidget::Close(); |
5489 g_view_map.Get().erase(doomed); | 5411 g_view_map.Get().erase(doomed); |
5490 } | 5412 } |
5491 | 5413 |
5492 void RenderView::DidHandleKeyEvent() { | 5414 void RenderView::DidHandleKeyEvent() { |
5493 edit_commands_.clear(); | 5415 edit_commands_.clear(); |
5494 } | 5416 } |
5495 | 5417 |
5496 void RenderView::DidHandleMouseEvent(const WebKit::WebMouseEvent& event) { | 5418 void RenderView::DidHandleMouseEvent(const WebKit::WebMouseEvent& event) { |
5497 page_click_tracker_->DidHandleMouseEvent(event); | 5419 for (size_t i = 0; i < observers_.size(); ++i) |
5420 observers_[i]->DidHandleMouseEvent(event); | |
5498 } | 5421 } |
5499 | 5422 |
5500 #if defined(OS_MACOSX) | 5423 #if defined(OS_MACOSX) |
5501 void RenderView::OnWasHidden() { | 5424 void RenderView::OnWasHidden() { |
5502 RenderWidget::OnWasHidden(); | 5425 RenderWidget::OnWasHidden(); |
5503 | 5426 |
5504 // Inform plugins that their container is no longer visible. | 5427 // Inform plugins that their container is no longer visible. |
5505 std::set<WebPluginDelegateProxy*>::iterator plugin_it; | 5428 std::set<WebPluginDelegateProxy*>::iterator plugin_it; |
5506 for (plugin_it = plugin_delegates_.begin(); | 5429 for (plugin_it = plugin_delegates_.begin(); |
5507 plugin_it != plugin_delegates_.end(); ++plugin_it) { | 5430 plugin_it != plugin_delegates_.end(); ++plugin_it) { |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5645 Send(new ViewHostMsg_RunFileChooser(routing_id_, params)); | 5568 Send(new ViewHostMsg_RunFileChooser(routing_id_, params)); |
5646 } | 5569 } |
5647 return true; | 5570 return true; |
5648 } | 5571 } |
5649 | 5572 |
5650 void RenderView::OnPageTranslated() { | 5573 void RenderView::OnPageTranslated() { |
5651 WebFrame* frame = webview()->mainFrame(); | 5574 WebFrame* frame = webview()->mainFrame(); |
5652 if (!frame) | 5575 if (!frame) |
5653 return; | 5576 return; |
5654 | 5577 |
5655 // The page is translated, so try to extract the form data again. | 5578 for (size_t i = 0; i < observers_.size(); ++i) |
5656 autofill_helper_->FrameContentsAvailable(frame); | 5579 observers_[i]->FrameTranslated(frame); |
5657 } | 5580 } |
5658 | 5581 |
5659 WebKit::WebGeolocationClient* RenderView::geolocationClient() { | 5582 WebKit::WebGeolocationClient* RenderView::geolocationClient() { |
5660 if (!geolocation_dispatcher_.get()) | 5583 if (!geolocation_dispatcher_) |
5661 geolocation_dispatcher_.reset(new GeolocationDispatcher(this)); | 5584 geolocation_dispatcher_ = new GeolocationDispatcher(this); |
5662 return geolocation_dispatcher_.get(); | 5585 return geolocation_dispatcher_; |
5663 } | 5586 } |
5664 | 5587 |
5665 WebKit::WebSpeechInputController* RenderView::speechInputController( | 5588 WebKit::WebSpeechInputController* RenderView::speechInputController( |
5666 WebKit::WebSpeechInputListener* listener) { | 5589 WebKit::WebSpeechInputListener* listener) { |
5667 if (!speech_input_dispatcher_.get()) | 5590 if (!speech_input_dispatcher_) |
5668 speech_input_dispatcher_.reset(new SpeechInputDispatcher(this, listener)); | 5591 speech_input_dispatcher_ = new SpeechInputDispatcher(this, listener); |
5669 return speech_input_dispatcher_.get(); | 5592 return speech_input_dispatcher_; |
5670 } | 5593 } |
5671 | 5594 |
5672 WebKit::WebDeviceOrientationClient* RenderView::deviceOrientationClient() { | 5595 WebKit::WebDeviceOrientationClient* RenderView::deviceOrientationClient() { |
5673 if (!device_orientation_dispatcher_.get()) | 5596 if (!device_orientation_dispatcher_) |
5674 device_orientation_dispatcher_.reset(new DeviceOrientationDispatcher(this)); | 5597 device_orientation_dispatcher_ = new DeviceOrientationDispatcher(this); |
5675 return device_orientation_dispatcher_.get(); | 5598 return device_orientation_dispatcher_; |
5676 } | 5599 } |
5677 | 5600 |
5678 void RenderView::zoomLimitsChanged(double minimum_level, double maximum_level) { | 5601 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 | 5602 // 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 | 5603 // normal web content (i.e. a fixed layout plugin would usually want them |
5681 // different). | 5604 // different). |
5682 bool remember = !webview()->mainFrame()->document().isPluginDocument(); | 5605 bool remember = !webview()->mainFrame()->document().isPluginDocument(); |
5683 | 5606 |
5684 int minimum_percent = static_cast<int>( | 5607 int minimum_percent = static_cast<int>( |
5685 WebView::zoomLevelToZoomFactor(minimum_level) * 100); | 5608 WebView::zoomLevelToZoomFactor(minimum_level) * 100); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5792 } | 5715 } |
5793 #endif | 5716 #endif |
5794 | 5717 |
5795 void RenderView::OnJavaScriptStressTestControl(int cmd, int param) { | 5718 void RenderView::OnJavaScriptStressTestControl(int cmd, int param) { |
5796 if (cmd == kJavaScriptStressTestSetStressRunType) { | 5719 if (cmd == kJavaScriptStressTestSetStressRunType) { |
5797 v8::Testing::SetStressRunType(static_cast<v8::Testing::StressType>(param)); | 5720 v8::Testing::SetStressRunType(static_cast<v8::Testing::StressType>(param)); |
5798 } else if (cmd == kJavaScriptStressTestPrepareStressRun) { | 5721 } else if (cmd == kJavaScriptStressTestPrepareStressRun) { |
5799 v8::Testing::PrepareStressRun(param); | 5722 v8::Testing::PrepareStressRun(param); |
5800 } | 5723 } |
5801 } | 5724 } |
OLD | NEW |