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 #include "content/renderer/renderer_webcolorchooser_impl.h" |
77 #include "content/renderer/renderer_webstoragenamespace_impl.h" | 78 #include "content/renderer/renderer_webstoragenamespace_impl.h" |
78 #include "content/renderer/speech_input_dispatcher.h" | 79 #include "content/renderer/speech_input_dispatcher.h" |
79 #include "content/renderer/text_input_client_observer.h" | 80 #include "content/renderer/text_input_client_observer.h" |
80 #include "content/renderer/v8_value_converter_impl.h" | 81 #include "content/renderer/v8_value_converter_impl.h" |
81 #include "content/renderer/web_ui_bindings.h" | 82 #include "content/renderer/web_ui_bindings.h" |
82 #include "content/renderer/webplugin_delegate_proxy.h" | 83 #include "content/renderer/webplugin_delegate_proxy.h" |
83 #include "content/renderer/websharedworker_proxy.h" | 84 #include "content/renderer/websharedworker_proxy.h" |
84 #include "media/base/filter_collection.h" | 85 #include "media/base/filter_collection.h" |
85 #include "media/base/media_switches.h" | 86 #include "media/base/media_switches.h" |
86 #include "media/base/message_loop_factory_impl.h" | 87 #include "media/base/message_loop_factory_impl.h" |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 cached_has_main_frame_horizontal_scrollbar_(false), | 362 cached_has_main_frame_horizontal_scrollbar_(false), |
362 cached_has_main_frame_vertical_scrollbar_(false), | 363 cached_has_main_frame_vertical_scrollbar_(false), |
363 ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)), | 364 ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)), |
364 geolocation_dispatcher_(NULL), | 365 geolocation_dispatcher_(NULL), |
365 speech_input_dispatcher_(NULL), | 366 speech_input_dispatcher_(NULL), |
366 device_orientation_dispatcher_(NULL), | 367 device_orientation_dispatcher_(NULL), |
367 media_stream_dispatcher_(NULL), | 368 media_stream_dispatcher_(NULL), |
368 p2p_socket_dispatcher_(NULL), | 369 p2p_socket_dispatcher_(NULL), |
369 devtools_agent_(NULL), | 370 devtools_agent_(NULL), |
370 renderer_accessibility_(NULL), | 371 renderer_accessibility_(NULL), |
| 372 color_chooser_(NULL), |
371 session_storage_namespace_id_(session_storage_namespace_id), | 373 session_storage_namespace_id_(session_storage_namespace_id), |
372 handling_select_range_(false), | 374 handling_select_range_(false), |
373 #if defined(OS_WIN) | 375 #if defined(OS_WIN) |
374 focused_plugin_id_(-1), | 376 focused_plugin_id_(-1), |
375 #endif | 377 #endif |
376 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)) { | 378 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)) { |
377 routing_id_ = routing_id; | 379 routing_id_ = routing_id; |
378 if (opener_id != MSG_ROUTING_NONE) | 380 if (opener_id != MSG_ROUTING_NONE) |
379 opener_id_ = opener_id; | 381 opener_id_ = opener_id; |
380 | 382 |
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1562 // seems safest to not execute the rest. | 1564 // seems safest to not execute the rest. |
1563 if (!frame->executeCommand(WebString::fromUTF8(it->name), | 1565 if (!frame->executeCommand(WebString::fromUTF8(it->name), |
1564 WebString::fromUTF8(it->value))) | 1566 WebString::fromUTF8(it->value))) |
1565 break; | 1567 break; |
1566 did_execute_command = true; | 1568 did_execute_command = true; |
1567 } | 1569 } |
1568 | 1570 |
1569 return did_execute_command; | 1571 return did_execute_command; |
1570 } | 1572 } |
1571 | 1573 |
| 1574 WebKit::WebColorChooser* RenderViewImpl::createColorChooser( |
| 1575 WebKit::WebColorChooserClient* client, |
| 1576 const WebKit::WebColor& initial_color) { |
| 1577 if (color_chooser_) { |
| 1578 color_chooser_->endChooser(); |
| 1579 } |
| 1580 color_chooser_ = new RendererWebColorChooserImpl(this, client); |
| 1581 ViewHostMsg_SetSelectedColorInColorChooser_Params ipc_params; |
| 1582 ipc_params.color = initial_color; |
| 1583 Send(new ViewHostMsg_OpenColorChooser(routing_id_, ipc_params)); |
| 1584 return static_cast<WebKit::WebColorChooser*>(color_chooser_); |
| 1585 } |
| 1586 void RenderViewImpl::endColorChooser(WebKit::WebColorChooser* session) { |
| 1587 if (session != color_chooser_) |
| 1588 return; |
| 1589 color_chooser_ = NULL; |
| 1590 } |
| 1591 |
1572 bool RenderViewImpl::runFileChooser( | 1592 bool RenderViewImpl::runFileChooser( |
1573 const WebKit::WebFileChooserParams& params, | 1593 const WebKit::WebFileChooserParams& params, |
1574 WebFileChooserCompletion* chooser_completion) { | 1594 WebFileChooserCompletion* chooser_completion) { |
1575 // Do not open the file dialog in a hidden RenderView. | 1595 // Do not open the file dialog in a hidden RenderView. |
1576 if (is_hidden()) | 1596 if (is_hidden()) |
1577 return false; | 1597 return false; |
1578 content::FileChooserParams ipc_params; | 1598 content::FileChooserParams ipc_params; |
1579 if (params.directory) | 1599 if (params.directory) |
1580 ipc_params.mode = content::FileChooserParams::OpenFolder; | 1600 ipc_params.mode = content::FileChooserParams::OpenFolder; |
1581 else if (params.multiSelect) | 1601 else if (params.multiSelect) |
(...skipping 2474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4056 | 4076 |
4057 WebPageSerializer::serialize(webview()->mainFrame(), true, this, weburl_links, | 4077 WebPageSerializer::serialize(webview()->mainFrame(), true, this, weburl_links, |
4058 webstring_paths, | 4078 webstring_paths, |
4059 webkit_glue::FilePathToWebString( | 4079 webkit_glue::FilePathToWebString( |
4060 local_directory_name)); | 4080 local_directory_name)); |
4061 } | 4081 } |
4062 | 4082 |
4063 void RenderViewImpl::OnShouldClose() { | 4083 void RenderViewImpl::OnShouldClose() { |
4064 bool should_close = webview()->dispatchBeforeUnloadEvent(); | 4084 bool should_close = webview()->dispatchBeforeUnloadEvent(); |
4065 Send(new ViewHostMsg_ShouldClose_ACK(routing_id_, should_close)); | 4085 Send(new ViewHostMsg_ShouldClose_ACK(routing_id_, should_close)); |
| 4086 if (color_chooser_) |
| 4087 color_chooser_->endChooser(); |
4066 } | 4088 } |
4067 | 4089 |
4068 void RenderViewImpl::OnSwapOut(const ViewMsg_SwapOut_Params& params) { | 4090 void RenderViewImpl::OnSwapOut(const ViewMsg_SwapOut_Params& params) { |
4069 if (is_swapped_out_) | 4091 if (is_swapped_out_) |
4070 return; | 4092 return; |
4071 | 4093 |
4072 // Swap this RenderView out so the tab can navigate to a page rendered by a | 4094 // Swap this RenderView out so the tab can navigate to a page rendered by a |
4073 // different process. This involves running the unload handler and clearing | 4095 // different process. This involves running the unload handler and clearing |
4074 // the page. Once WasSwappedOut is called, we also allow this process to exit | 4096 // the page. Once WasSwappedOut is called, we also allow this process to exit |
4075 // if there are no other active RenderViews in it. | 4097 // if there are no other active RenderViews in it. |
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4867 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { | 4889 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { |
4868 return !!RenderThreadImpl::current()->compositor_thread(); | 4890 return !!RenderThreadImpl::current()->compositor_thread(); |
4869 } | 4891 } |
4870 | 4892 |
4871 void RenderViewImpl::OnJavaBridgeInit() { | 4893 void RenderViewImpl::OnJavaBridgeInit() { |
4872 DCHECK(!java_bridge_dispatcher_.get()); | 4894 DCHECK(!java_bridge_dispatcher_.get()); |
4873 #if defined(ENABLE_JAVA_BRIDGE) | 4895 #if defined(ENABLE_JAVA_BRIDGE) |
4874 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); | 4896 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); |
4875 #endif | 4897 #endif |
4876 } | 4898 } |
OLD | NEW |