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 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 body_background_color_(SK_ColorWHITE), | 586 body_background_color_(SK_ColorWHITE), |
587 update_frame_info_scheduled_(false), | 587 update_frame_info_scheduled_(false), |
588 expected_content_intent_id_(0), | 588 expected_content_intent_id_(0), |
589 media_player_proxy_(NULL), | 589 media_player_proxy_(NULL), |
590 synchronous_find_active_match_ordinal_(-1), | 590 synchronous_find_active_match_ordinal_(-1), |
591 ALLOW_THIS_IN_INITIALIZER_LIST( | 591 ALLOW_THIS_IN_INITIALIZER_LIST( |
592 load_progress_tracker_(new LoadProgressTracker(this))), | 592 load_progress_tracker_(new LoadProgressTracker(this))), |
593 #endif | 593 #endif |
594 session_storage_namespace_id_(session_storage_namespace_id), | 594 session_storage_namespace_id_(session_storage_namespace_id), |
595 handling_select_range_(false), | 595 handling_select_range_(false), |
| 596 next_snapshot_id_(0), |
596 #if defined(OS_WIN) | 597 #if defined(OS_WIN) |
597 focused_plugin_id_(-1), | 598 focused_plugin_id_(-1), |
598 #endif | 599 #endif |
599 updating_frame_tree_(false), | 600 updating_frame_tree_(false), |
600 pending_frame_tree_update_(false), | 601 pending_frame_tree_update_(false), |
601 target_process_id_(0), | 602 target_process_id_(0), |
602 target_routing_id_(0), | 603 target_routing_id_(0), |
603 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)) { | 604 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)) { |
604 set_throttle_input_events(renderer_prefs.throttle_input_events); | 605 set_throttle_input_events(renderer_prefs.throttle_input_events); |
605 routing_id_ = routing_id; | 606 routing_id_ = routing_id; |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 IPC_MESSAGE_HANDLER(ViewMsg_CopyToFindPboard, OnCopyToFindPboard) | 996 IPC_MESSAGE_HANDLER(ViewMsg_CopyToFindPboard, OnCopyToFindPboard) |
996 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted, | 997 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted, |
997 OnPluginImeCompositionCompleted) | 998 OnPluginImeCompositionCompleted) |
998 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) | 999 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) |
999 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) | 1000 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) |
1000 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility) | 1001 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility) |
1001 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged) | 1002 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged) |
1002 #endif | 1003 #endif |
1003 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupDIB, | 1004 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupDIB, |
1004 OnReleaseDisambiguationPopupDIB) | 1005 OnReleaseDisambiguationPopupDIB) |
| 1006 IPC_MESSAGE_HANDLER(ViewMsg_WindowSnapshotCompleted, |
| 1007 OnWindowSnapshotCompleted) |
1005 | 1008 |
1006 // Have the super handle all other messages. | 1009 // Have the super handle all other messages. |
1007 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) | 1010 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) |
1008 IPC_END_MESSAGE_MAP() | 1011 IPC_END_MESSAGE_MAP() |
1009 | 1012 |
1010 if (!msg_is_ok) { | 1013 if (!msg_is_ok) { |
1011 // The message had a handler, but its deserialization failed. | 1014 // The message had a handler, but its deserialization failed. |
1012 // Kill the renderer to avoid potential spoofing attacks. | 1015 // Kill the renderer to avoid potential spoofing attacks. |
1013 CHECK(false) << "Unable to deserialize message in RenderViewImpl."; | 1016 CHECK(false) << "Unable to deserialize message in RenderViewImpl."; |
1014 } | 1017 } |
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1701 // equivalent of WebView::willEnterModalLoop. In the case of showModalDialog | 1704 // equivalent of WebView::willEnterModalLoop. In the case of showModalDialog |
1702 // it is particularly important that we do not call willEnterModalLoop as | 1705 // it is particularly important that we do not call willEnterModalLoop as |
1703 // that would defer resource loads for the dialog itself. | 1706 // that would defer resource loads for the dialog itself. |
1704 if (RenderThreadImpl::current()) // Will be NULL during unit tests. | 1707 if (RenderThreadImpl::current()) // Will be NULL during unit tests. |
1705 RenderThreadImpl::current()->DoNotNotifyWebKitOfModalLoop(); | 1708 RenderThreadImpl::current()->DoNotNotifyWebKitOfModalLoop(); |
1706 | 1709 |
1707 message->EnableMessagePumping(); // Runs a nested message loop. | 1710 message->EnableMessagePumping(); // Runs a nested message loop. |
1708 return Send(message); | 1711 return Send(message); |
1709 } | 1712 } |
1710 | 1713 |
| 1714 void RenderViewImpl::GetWindowSnapshot(const WindowSnapshotCallback& callback) { |
| 1715 int id = next_snapshot_id_++; |
| 1716 pending_snapshots_.insert(std::make_pair(id, callback)); |
| 1717 Send(new ViewHostMsg_GetWindowSnapshot(routing_id_, id)); |
| 1718 } |
| 1719 |
| 1720 void RenderViewImpl::OnWindowSnapshotCompleted(const int snapshot_id, |
| 1721 const gfx::Size& size, const std::vector<unsigned char>& png) { |
| 1722 PendingSnapshotMap::iterator it = pending_snapshots_.find(snapshot_id); |
| 1723 DCHECK(it != pending_snapshots_.end()); |
| 1724 it->second.Run(size, png); |
| 1725 pending_snapshots_.erase(it); |
| 1726 } |
| 1727 |
1711 // WebKit::WebViewClient ------------------------------------------------------ | 1728 // WebKit::WebViewClient ------------------------------------------------------ |
1712 | 1729 |
1713 WebView* RenderViewImpl::createView( | 1730 WebView* RenderViewImpl::createView( |
1714 WebFrame* creator, | 1731 WebFrame* creator, |
1715 const WebURLRequest& request, | 1732 const WebURLRequest& request, |
1716 const WebWindowFeatures& features, | 1733 const WebWindowFeatures& features, |
1717 const WebString& frame_name, | 1734 const WebString& frame_name, |
1718 WebNavigationPolicy policy) { | 1735 WebNavigationPolicy policy) { |
1719 // Check to make sure we aren't overloading on popups. | 1736 // Check to make sure we aren't overloading on popups. |
1720 if (shared_popup_counter_->data > kMaximumNumberOfUnacknowledgedPopups) | 1737 if (shared_popup_counter_->data > kMaximumNumberOfUnacknowledgedPopups) |
(...skipping 4640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6361 } | 6378 } |
6362 #endif | 6379 #endif |
6363 | 6380 |
6364 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( | 6381 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( |
6365 TransportDIB::Handle dib_handle) { | 6382 TransportDIB::Handle dib_handle) { |
6366 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); | 6383 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); |
6367 RenderProcess::current()->ReleaseTransportDIB(dib); | 6384 RenderProcess::current()->ReleaseTransportDIB(dib); |
6368 } | 6385 } |
6369 | 6386 |
6370 } // namespace content | 6387 } // namespace content |
OLD | NEW |