OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 #include "content/renderer/notification_provider.h" | 67 #include "content/renderer/notification_provider.h" |
68 #include "content/renderer/p2p/socket_dispatcher.h" | 68 #include "content/renderer/p2p/socket_dispatcher.h" |
69 #include "content/renderer/plugin_channel_host.h" | 69 #include "content/renderer/plugin_channel_host.h" |
70 #include "content/renderer/render_audiosourceprovider.h" | 70 #include "content/renderer/render_audiosourceprovider.h" |
71 #include "content/renderer/render_process.h" | 71 #include "content/renderer/render_process.h" |
72 #include "content/renderer/render_thread_impl.h" | 72 #include "content/renderer/render_thread_impl.h" |
73 #include "content/renderer/render_widget_fullscreen_pepper.h" | 73 #include "content/renderer/render_widget_fullscreen_pepper.h" |
74 #include "content/renderer/renderer_accessibility.h" | 74 #include "content/renderer/renderer_accessibility.h" |
75 #include "content/renderer/renderer_gpu_video_decoder_factories.h" | 75 #include "content/renderer/renderer_gpu_video_decoder_factories.h" |
76 #include "content/renderer/renderer_webapplicationcachehost_impl.h" | 76 #include "content/renderer/renderer_webapplicationcachehost_impl.h" |
| 77 #if defined(ENABLE_INPUT_COLOR) |
| 78 #include "content/renderer/renderer_webcolorchooser_impl.h" |
| 79 #endif |
77 #include "content/renderer/renderer_webstoragenamespace_impl.h" | 80 #include "content/renderer/renderer_webstoragenamespace_impl.h" |
78 #include "content/renderer/speech_input_dispatcher.h" | 81 #include "content/renderer/speech_input_dispatcher.h" |
79 #include "content/renderer/text_input_client_observer.h" | 82 #include "content/renderer/text_input_client_observer.h" |
80 #include "content/renderer/v8_value_converter_impl.h" | 83 #include "content/renderer/v8_value_converter_impl.h" |
81 #include "content/renderer/web_ui_bindings.h" | 84 #include "content/renderer/web_ui_bindings.h" |
82 #include "content/renderer/webplugin_delegate_proxy.h" | 85 #include "content/renderer/webplugin_delegate_proxy.h" |
83 #include "content/renderer/websharedworker_proxy.h" | 86 #include "content/renderer/websharedworker_proxy.h" |
84 #include "media/base/filter_collection.h" | 87 #include "media/base/filter_collection.h" |
85 #include "media/base/media_switches.h" | 88 #include "media/base/media_switches.h" |
86 #include "media/base/message_loop_factory_impl.h" | 89 #include "media/base/message_loop_factory_impl.h" |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 cached_has_main_frame_horizontal_scrollbar_(false), | 365 cached_has_main_frame_horizontal_scrollbar_(false), |
363 cached_has_main_frame_vertical_scrollbar_(false), | 366 cached_has_main_frame_vertical_scrollbar_(false), |
364 ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)), | 367 ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)), |
365 geolocation_dispatcher_(NULL), | 368 geolocation_dispatcher_(NULL), |
366 speech_input_dispatcher_(NULL), | 369 speech_input_dispatcher_(NULL), |
367 device_orientation_dispatcher_(NULL), | 370 device_orientation_dispatcher_(NULL), |
368 media_stream_dispatcher_(NULL), | 371 media_stream_dispatcher_(NULL), |
369 p2p_socket_dispatcher_(NULL), | 372 p2p_socket_dispatcher_(NULL), |
370 devtools_agent_(NULL), | 373 devtools_agent_(NULL), |
371 renderer_accessibility_(NULL), | 374 renderer_accessibility_(NULL), |
| 375 #if defined(ENABLE_INPUT_COLOR) |
| 376 color_chooser_(NULL), |
| 377 #endif |
372 session_storage_namespace_id_(session_storage_namespace_id), | 378 session_storage_namespace_id_(session_storage_namespace_id), |
373 handling_select_range_(false), | 379 handling_select_range_(false), |
374 #if defined(OS_WIN) | 380 #if defined(OS_WIN) |
375 focused_plugin_id_(-1), | 381 focused_plugin_id_(-1), |
376 #endif | 382 #endif |
377 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)) { | 383 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)) { |
378 routing_id_ = routing_id; | 384 routing_id_ = routing_id; |
379 if (opener_id != MSG_ROUTING_NONE) | 385 if (opener_id != MSG_ROUTING_NONE) |
380 opener_id_ = opener_id; | 386 opener_id_ = opener_id; |
381 | 387 |
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1563 // seems safest to not execute the rest. | 1569 // seems safest to not execute the rest. |
1564 if (!frame->executeCommand(WebString::fromUTF8(it->name), | 1570 if (!frame->executeCommand(WebString::fromUTF8(it->name), |
1565 WebString::fromUTF8(it->value))) | 1571 WebString::fromUTF8(it->value))) |
1566 break; | 1572 break; |
1567 did_execute_command = true; | 1573 did_execute_command = true; |
1568 } | 1574 } |
1569 | 1575 |
1570 return did_execute_command; | 1576 return did_execute_command; |
1571 } | 1577 } |
1572 | 1578 |
| 1579 #if defined(ENABLE_INPUT_COLOR) |
| 1580 WebKit::WebColorChooser* RenderViewImpl::createColorChooser( |
| 1581 WebKit::WebColorChooserClient* client, |
| 1582 const WebKit::WebColor& initial_color) { |
| 1583 if (color_chooser_) { |
| 1584 color_chooser_->endChooser(); |
| 1585 } |
| 1586 color_chooser_ = new RendererWebColorChooserImpl(this, client); |
| 1587 ViewHostMsg_SetSelectedColorInColorChooser_Params ipc_params; |
| 1588 ipc_params.color = initial_color; |
| 1589 Send(new ViewHostMsg_OpenColorChooser(routing_id_, ipc_params)); |
| 1590 return static_cast<WebKit::WebColorChooser*>(color_chooser_); |
| 1591 } |
| 1592 void RenderViewImpl::detachColorChooser(WebKit::WebColorChooser* session) { |
| 1593 if (session != color_chooser_) |
| 1594 return; |
| 1595 color_chooser_ = NULL; |
| 1596 } |
| 1597 #endif |
| 1598 |
1573 bool RenderViewImpl::runFileChooser( | 1599 bool RenderViewImpl::runFileChooser( |
1574 const WebKit::WebFileChooserParams& params, | 1600 const WebKit::WebFileChooserParams& params, |
1575 WebFileChooserCompletion* chooser_completion) { | 1601 WebFileChooserCompletion* chooser_completion) { |
1576 // Do not open the file dialog in a hidden RenderView. | 1602 // Do not open the file dialog in a hidden RenderView. |
1577 if (is_hidden()) | 1603 if (is_hidden()) |
1578 return false; | 1604 return false; |
1579 content::FileChooserParams ipc_params; | 1605 content::FileChooserParams ipc_params; |
1580 if (params.directory) | 1606 if (params.directory) |
1581 ipc_params.mode = content::FileChooserParams::OpenFolder; | 1607 ipc_params.mode = content::FileChooserParams::OpenFolder; |
1582 else if (params.multiSelect) | 1608 else if (params.multiSelect) |
(...skipping 2475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4058 | 4084 |
4059 WebPageSerializer::serialize(webview()->mainFrame(), true, this, weburl_links, | 4085 WebPageSerializer::serialize(webview()->mainFrame(), true, this, weburl_links, |
4060 webstring_paths, | 4086 webstring_paths, |
4061 webkit_glue::FilePathToWebString( | 4087 webkit_glue::FilePathToWebString( |
4062 local_directory_name)); | 4088 local_directory_name)); |
4063 } | 4089 } |
4064 | 4090 |
4065 void RenderViewImpl::OnShouldClose() { | 4091 void RenderViewImpl::OnShouldClose() { |
4066 bool should_close = webview()->dispatchBeforeUnloadEvent(); | 4092 bool should_close = webview()->dispatchBeforeUnloadEvent(); |
4067 Send(new ViewHostMsg_ShouldClose_ACK(routing_id_, should_close)); | 4093 Send(new ViewHostMsg_ShouldClose_ACK(routing_id_, should_close)); |
| 4094 #if defined(ENABLE_INPUT_COLOR) |
| 4095 if (color_chooser_) |
| 4096 color_chooser_->endChooser(); |
| 4097 #endif |
4068 } | 4098 } |
4069 | 4099 |
4070 void RenderViewImpl::OnSwapOut(const ViewMsg_SwapOut_Params& params) { | 4100 void RenderViewImpl::OnSwapOut(const ViewMsg_SwapOut_Params& params) { |
4071 if (is_swapped_out_) | 4101 if (is_swapped_out_) |
4072 return; | 4102 return; |
4073 | 4103 |
4074 // Swap this RenderView out so the tab can navigate to a page rendered by a | 4104 // Swap this RenderView out so the tab can navigate to a page rendered by a |
4075 // different process. This involves running the unload handler and clearing | 4105 // different process. This involves running the unload handler and clearing |
4076 // the page. Once WasSwappedOut is called, we also allow this process to exit | 4106 // the page. Once WasSwappedOut is called, we also allow this process to exit |
4077 // if there are no other active RenderViews in it. | 4107 // if there are no other active RenderViews in it. |
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4869 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { | 4899 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { |
4870 return !!RenderThreadImpl::current()->compositor_thread(); | 4900 return !!RenderThreadImpl::current()->compositor_thread(); |
4871 } | 4901 } |
4872 | 4902 |
4873 void RenderViewImpl::OnJavaBridgeInit() { | 4903 void RenderViewImpl::OnJavaBridgeInit() { |
4874 DCHECK(!java_bridge_dispatcher_.get()); | 4904 DCHECK(!java_bridge_dispatcher_.get()); |
4875 #if defined(ENABLE_JAVA_BRIDGE) | 4905 #if defined(ENABLE_JAVA_BRIDGE) |
4876 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); | 4906 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); |
4877 #endif | 4907 #endif |
4878 } | 4908 } |
OLD | NEW |