OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 #include "content/renderer/media/render_media_log.h" | 59 #include "content/renderer/media/render_media_log.h" |
60 #include "content/renderer/mhtml_generator.h" | 60 #include "content/renderer/mhtml_generator.h" |
61 #include "content/renderer/notification_provider.h" | 61 #include "content/renderer/notification_provider.h" |
62 #include "content/renderer/p2p/socket_dispatcher.h" | 62 #include "content/renderer/p2p/socket_dispatcher.h" |
63 #include "content/renderer/plugin_channel_host.h" | 63 #include "content/renderer/plugin_channel_host.h" |
64 #include "content/renderer/render_process.h" | 64 #include "content/renderer/render_process.h" |
65 #include "content/renderer/render_thread_impl.h" | 65 #include "content/renderer/render_thread_impl.h" |
66 #include "content/renderer/render_widget_fullscreen_pepper.h" | 66 #include "content/renderer/render_widget_fullscreen_pepper.h" |
67 #include "content/renderer/renderer_accessibility.h" | 67 #include "content/renderer/renderer_accessibility.h" |
68 #include "content/renderer/renderer_webapplicationcachehost_impl.h" | 68 #include "content/renderer/renderer_webapplicationcachehost_impl.h" |
| 69 #if defined(ENABLE_INPUT_COLOR) |
| 70 #include "content/renderer/renderer_webcolorchooser_impl.h" |
| 71 #endif |
69 #include "content/renderer/renderer_webstoragenamespace_impl.h" | 72 #include "content/renderer/renderer_webstoragenamespace_impl.h" |
70 #include "content/renderer/speech_input_dispatcher.h" | 73 #include "content/renderer/speech_input_dispatcher.h" |
71 #include "content/renderer/text_input_client_observer.h" | 74 #include "content/renderer/text_input_client_observer.h" |
72 #include "content/renderer/v8_value_converter_impl.h" | 75 #include "content/renderer/v8_value_converter_impl.h" |
73 #include "content/renderer/web_ui_bindings.h" | 76 #include "content/renderer/web_ui_bindings.h" |
74 #include "content/renderer/webplugin_delegate_proxy.h" | 77 #include "content/renderer/webplugin_delegate_proxy.h" |
75 #include "content/renderer/websharedworker_proxy.h" | 78 #include "content/renderer/websharedworker_proxy.h" |
76 #include "media/base/filter_collection.h" | 79 #include "media/base/filter_collection.h" |
77 #include "media/base/media_switches.h" | 80 #include "media/base/media_switches.h" |
78 #include "media/base/message_loop_factory_impl.h" | 81 #include "media/base/message_loop_factory_impl.h" |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 IPC_MESSAGE_HANDLER(ViewMsg_AllowBindings, OnAllowBindings) | 624 IPC_MESSAGE_HANDLER(ViewMsg_AllowBindings, OnAllowBindings) |
622 IPC_MESSAGE_HANDLER(ViewMsg_SetWebUIProperty, OnSetWebUIProperty) | 625 IPC_MESSAGE_HANDLER(ViewMsg_SetWebUIProperty, OnSetWebUIProperty) |
623 IPC_MESSAGE_HANDLER(ViewMsg_SetInitialFocus, OnSetInitialFocus) | 626 IPC_MESSAGE_HANDLER(ViewMsg_SetInitialFocus, OnSetInitialFocus) |
624 IPC_MESSAGE_HANDLER(ViewMsg_ScrollFocusedEditableNodeIntoRect, | 627 IPC_MESSAGE_HANDLER(ViewMsg_ScrollFocusedEditableNodeIntoRect, |
625 OnScrollFocusedEditableNodeIntoRect) | 628 OnScrollFocusedEditableNodeIntoRect) |
626 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTargetURL_ACK, OnUpdateTargetURLAck) | 629 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTargetURL_ACK, OnUpdateTargetURLAck) |
627 IPC_MESSAGE_HANDLER(ViewMsg_UpdateWebPreferences, OnUpdateWebPreferences) | 630 IPC_MESSAGE_HANDLER(ViewMsg_UpdateWebPreferences, OnUpdateWebPreferences) |
628 IPC_MESSAGE_HANDLER(ViewMsg_SetAltErrorPageURL, OnSetAltErrorPageURL) | 631 IPC_MESSAGE_HANDLER(ViewMsg_SetAltErrorPageURL, OnSetAltErrorPageURL) |
629 IPC_MESSAGE_HANDLER(ViewMsg_EnumerateDirectoryResponse, | 632 IPC_MESSAGE_HANDLER(ViewMsg_EnumerateDirectoryResponse, |
630 OnEnumerateDirectoryResponse) | 633 OnEnumerateDirectoryResponse) |
| 634 #if defined(ENABLE_INPUT_COLOR) |
| 635 IPC_MESSAGE_HANDLER(ViewMsg_DidChooseColorResponse, |
| 636 OnDidChooseColorResponse) |
| 637 IPC_MESSAGE_HANDLER(ViewMsg_DidCleanupColorChooser, |
| 638 OnDidCleanupColorChooser) |
| 639 #endif // defined(ENABLE_INPUT_COLOR) |
631 IPC_MESSAGE_HANDLER(ViewMsg_RunFileChooserResponse, OnFileChooserResponse) | 640 IPC_MESSAGE_HANDLER(ViewMsg_RunFileChooserResponse, OnFileChooserResponse) |
632 IPC_MESSAGE_HANDLER(ViewMsg_ShouldClose, OnShouldClose) | 641 IPC_MESSAGE_HANDLER(ViewMsg_ShouldClose, OnShouldClose) |
633 IPC_MESSAGE_HANDLER(ViewMsg_SwapOut, OnSwapOut) | 642 IPC_MESSAGE_HANDLER(ViewMsg_SwapOut, OnSwapOut) |
634 IPC_MESSAGE_HANDLER(ViewMsg_ClosePage, OnClosePage) | 643 IPC_MESSAGE_HANDLER(ViewMsg_ClosePage, OnClosePage) |
635 IPC_MESSAGE_HANDLER(ViewMsg_ThemeChanged, OnThemeChanged) | 644 IPC_MESSAGE_HANDLER(ViewMsg_ThemeChanged, OnThemeChanged) |
636 IPC_MESSAGE_HANDLER(ViewMsg_DisassociateFromPopupCount, | 645 IPC_MESSAGE_HANDLER(ViewMsg_DisassociateFromPopupCount, |
637 OnDisassociateFromPopupCount) | 646 OnDisassociateFromPopupCount) |
638 IPC_MESSAGE_HANDLER(ViewMsg_MoveOrResizeStarted, OnMoveOrResizeStarted) | 647 IPC_MESSAGE_HANDLER(ViewMsg_MoveOrResizeStarted, OnMoveOrResizeStarted) |
639 IPC_MESSAGE_HANDLER(ViewMsg_ClearFocusedNode, OnClearFocusedNode) | 648 IPC_MESSAGE_HANDLER(ViewMsg_ClearFocusedNode, OnClearFocusedNode) |
640 IPC_MESSAGE_HANDLER(ViewMsg_SetBackground, OnSetBackground) | 649 IPC_MESSAGE_HANDLER(ViewMsg_SetBackground, OnSetBackground) |
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1557 // seems safest to not execute the rest. | 1566 // seems safest to not execute the rest. |
1558 if (!frame->executeCommand(WebString::fromUTF8(it->name), | 1567 if (!frame->executeCommand(WebString::fromUTF8(it->name), |
1559 WebString::fromUTF8(it->value))) | 1568 WebString::fromUTF8(it->value))) |
1560 break; | 1569 break; |
1561 did_execute_command = true; | 1570 did_execute_command = true; |
1562 } | 1571 } |
1563 | 1572 |
1564 return did_execute_command; | 1573 return did_execute_command; |
1565 } | 1574 } |
1566 | 1575 |
| 1576 #if defined(ENABLE_INPUT_COLOR) |
| 1577 WebKit::WebColorChooser* RenderViewImpl::colorChooser() { |
| 1578 if (!color_chooser_.get()) { |
| 1579 color_chooser_.reset(new RendererWebColorChooserImpl(this)); |
| 1580 } |
| 1581 return static_cast<WebKit::WebColorChooser*>(color_chooser_.get()); |
| 1582 } |
| 1583 #endif |
| 1584 |
1567 bool RenderViewImpl::runFileChooser( | 1585 bool RenderViewImpl::runFileChooser( |
1568 const WebKit::WebFileChooserParams& params, | 1586 const WebKit::WebFileChooserParams& params, |
1569 WebFileChooserCompletion* chooser_completion) { | 1587 WebFileChooserCompletion* chooser_completion) { |
1570 // Do not open the file dialog in a hidden RenderView. | 1588 // Do not open the file dialog in a hidden RenderView. |
1571 if (is_hidden()) | 1589 if (is_hidden()) |
1572 return false; | 1590 return false; |
1573 ViewHostMsg_RunFileChooser_Params ipc_params; | 1591 ViewHostMsg_RunFileChooser_Params ipc_params; |
1574 if (params.directory) | 1592 if (params.directory) |
1575 ipc_params.mode = ViewHostMsg_RunFileChooser_Mode::OpenFolder; | 1593 ipc_params.mode = ViewHostMsg_RunFileChooser_Mode::OpenFolder; |
1576 else if (params.multiSelect) | 1594 else if (params.multiSelect) |
(...skipping 2175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3752 return; | 3770 return; |
3753 | 3771 |
3754 WebVector<WebString> ws_file_names(paths.size()); | 3772 WebVector<WebString> ws_file_names(paths.size()); |
3755 for (size_t i = 0; i < paths.size(); ++i) | 3773 for (size_t i = 0; i < paths.size(); ++i) |
3756 ws_file_names[i] = webkit_glue::FilePathToWebString(paths[i]); | 3774 ws_file_names[i] = webkit_glue::FilePathToWebString(paths[i]); |
3757 | 3775 |
3758 enumeration_completions_[id]->didChooseFile(ws_file_names); | 3776 enumeration_completions_[id]->didChooseFile(ws_file_names); |
3759 enumeration_completions_.erase(id); | 3777 enumeration_completions_.erase(id); |
3760 } | 3778 } |
3761 | 3779 |
| 3780 #if defined(ENABLE_INPUT_COLOR) |
| 3781 void RenderViewImpl::OnDidChooseColorResponse(WebKit::WebColor color) { |
| 3782 if(color_chooser_.get()) { |
| 3783 color_chooser_->didChooseColor(color); |
| 3784 } |
| 3785 } |
| 3786 |
| 3787 void RenderViewImpl::OnDidCleanupColorChooser() { |
| 3788 if(color_chooser_.get()) { |
| 3789 color_chooser_->didCleanup(); |
| 3790 color_chooser_.reset(); |
| 3791 } |
| 3792 } |
| 3793 #endif |
| 3794 |
3762 void RenderViewImpl::OnFileChooserResponse(const std::vector<FilePath>& paths) { | 3795 void RenderViewImpl::OnFileChooserResponse(const std::vector<FilePath>& paths) { |
3763 // This could happen if we navigated to a different page before the user | 3796 // This could happen if we navigated to a different page before the user |
3764 // closed the chooser. | 3797 // closed the chooser. |
3765 if (file_chooser_completions_.empty()) | 3798 if (file_chooser_completions_.empty()) |
3766 return; | 3799 return; |
3767 | 3800 |
3768 WebVector<WebString> ws_file_names(paths.size()); | 3801 WebVector<WebString> ws_file_names(paths.size()); |
3769 for (size_t i = 0; i < paths.size(); ++i) | 3802 for (size_t i = 0; i < paths.size(); ++i) |
3770 ws_file_names[i] = webkit_glue::FilePathToWebString(paths[i]); | 3803 ws_file_names[i] = webkit_glue::FilePathToWebString(paths[i]); |
3771 | 3804 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3875 | 3908 |
3876 WebPageSerializer::serialize(webview()->mainFrame(), true, this, weburl_links, | 3909 WebPageSerializer::serialize(webview()->mainFrame(), true, this, weburl_links, |
3877 webstring_paths, | 3910 webstring_paths, |
3878 webkit_glue::FilePathToWebString( | 3911 webkit_glue::FilePathToWebString( |
3879 local_directory_name)); | 3912 local_directory_name)); |
3880 } | 3913 } |
3881 | 3914 |
3882 void RenderViewImpl::OnShouldClose() { | 3915 void RenderViewImpl::OnShouldClose() { |
3883 bool should_close = webview()->dispatchBeforeUnloadEvent(); | 3916 bool should_close = webview()->dispatchBeforeUnloadEvent(); |
3884 Send(new ViewHostMsg_ShouldClose_ACK(routing_id_, should_close)); | 3917 Send(new ViewHostMsg_ShouldClose_ACK(routing_id_, should_close)); |
| 3918 #if defined(ENABLE_INPUT_COLOR) |
| 3919 if (color_chooser_.get()) |
| 3920 color_chooser_->cleanup(); |
| 3921 #endif |
3885 } | 3922 } |
3886 | 3923 |
3887 void RenderViewImpl::OnSwapOut(const ViewMsg_SwapOut_Params& params) { | 3924 void RenderViewImpl::OnSwapOut(const ViewMsg_SwapOut_Params& params) { |
3888 if (is_swapped_out_) | 3925 if (is_swapped_out_) |
3889 return; | 3926 return; |
3890 | 3927 |
3891 // Swap this RenderView out so the tab can navigate to a page rendered by a | 3928 // Swap this RenderView out so the tab can navigate to a page rendered by a |
3892 // different process. This involves running the unload handler and clearing | 3929 // different process. This involves running the unload handler and clearing |
3893 // the page. Once WasSwappedOut is called, we also allow this process to exit | 3930 // the page. Once WasSwappedOut is called, we also allow this process to exit |
3894 // if there are no other active RenderViews in it. | 3931 // if there are no other active RenderViews in it. |
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4696 return webview()->settings()->useThreadedCompositor(); | 4733 return webview()->settings()->useThreadedCompositor(); |
4697 } | 4734 } |
4698 | 4735 |
4699 void RenderViewImpl::OnJavaBridgeInit( | 4736 void RenderViewImpl::OnJavaBridgeInit( |
4700 const IPC::ChannelHandle& channel_handle) { | 4737 const IPC::ChannelHandle& channel_handle) { |
4701 DCHECK(!java_bridge_dispatcher_.get()); | 4738 DCHECK(!java_bridge_dispatcher_.get()); |
4702 #if defined(ENABLE_JAVA_BRIDGE) | 4739 #if defined(ENABLE_JAVA_BRIDGE) |
4703 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); | 4740 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); |
4704 #endif | 4741 #endif |
4705 } | 4742 } |
OLD | NEW |