Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 11399002: Implemented GetWindowSnapshot on RenderViewImpl (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 body_background_color_(SK_ColorWHITE), 587 body_background_color_(SK_ColorWHITE),
588 update_frame_info_scheduled_(false), 588 update_frame_info_scheduled_(false),
589 expected_content_intent_id_(0), 589 expected_content_intent_id_(0),
590 media_player_proxy_(NULL), 590 media_player_proxy_(NULL),
591 synchronous_find_active_match_ordinal_(-1), 591 synchronous_find_active_match_ordinal_(-1),
592 ALLOW_THIS_IN_INITIALIZER_LIST( 592 ALLOW_THIS_IN_INITIALIZER_LIST(
593 load_progress_tracker_(new LoadProgressTracker(this))), 593 load_progress_tracker_(new LoadProgressTracker(this))),
594 #endif 594 #endif
595 session_storage_namespace_id_(session_storage_namespace_id), 595 session_storage_namespace_id_(session_storage_namespace_id),
596 handling_select_range_(false), 596 handling_select_range_(false),
597 next_snapshot_id_(0),
597 #if defined(OS_WIN) 598 #if defined(OS_WIN)
598 focused_plugin_id_(-1), 599 focused_plugin_id_(-1),
599 #endif 600 #endif
600 updating_frame_tree_(false), 601 updating_frame_tree_(false),
601 pending_frame_tree_update_(false), 602 pending_frame_tree_update_(false),
602 target_process_id_(0), 603 target_process_id_(0),
603 target_routing_id_(0), 604 target_routing_id_(0),
604 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)) { 605 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)) {
605 set_throttle_input_events(renderer_prefs.throttle_input_events); 606 set_throttle_input_events(renderer_prefs.throttle_input_events);
606 routing_id_ = routing_id; 607 routing_id_ = routing_id;
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 IPC_MESSAGE_HANDLER(ViewMsg_CopyToFindPboard, OnCopyToFindPboard) 1001 IPC_MESSAGE_HANDLER(ViewMsg_CopyToFindPboard, OnCopyToFindPboard)
1001 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted, 1002 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted,
1002 OnPluginImeCompositionCompleted) 1003 OnPluginImeCompositionCompleted)
1003 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) 1004 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem)
1004 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) 1005 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize)
1005 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility) 1006 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility)
1006 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged) 1007 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged)
1007 #endif 1008 #endif
1008 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupDIB, 1009 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupDIB,
1009 OnReleaseDisambiguationPopupDIB) 1010 OnReleaseDisambiguationPopupDIB)
1011 IPC_MESSAGE_HANDLER(ViewMsg_WindowSnapshotCompleted,
1012 OnWindowSnapshotCompleted)
1010 1013
1011 // Have the super handle all other messages. 1014 // Have the super handle all other messages.
1012 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) 1015 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message))
1013 IPC_END_MESSAGE_MAP() 1016 IPC_END_MESSAGE_MAP()
1014 1017
1015 if (!msg_is_ok) { 1018 if (!msg_is_ok) {
1016 // The message had a handler, but its deserialization failed. 1019 // The message had a handler, but its deserialization failed.
1017 // Kill the renderer to avoid potential spoofing attacks. 1020 // Kill the renderer to avoid potential spoofing attacks.
1018 CHECK(false) << "Unable to deserialize message in RenderViewImpl."; 1021 CHECK(false) << "Unable to deserialize message in RenderViewImpl.";
1019 } 1022 }
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
1706 // equivalent of WebView::willEnterModalLoop. In the case of showModalDialog 1709 // equivalent of WebView::willEnterModalLoop. In the case of showModalDialog
1707 // it is particularly important that we do not call willEnterModalLoop as 1710 // it is particularly important that we do not call willEnterModalLoop as
1708 // that would defer resource loads for the dialog itself. 1711 // that would defer resource loads for the dialog itself.
1709 if (RenderThreadImpl::current()) // Will be NULL during unit tests. 1712 if (RenderThreadImpl::current()) // Will be NULL during unit tests.
1710 RenderThreadImpl::current()->DoNotNotifyWebKitOfModalLoop(); 1713 RenderThreadImpl::current()->DoNotNotifyWebKitOfModalLoop();
1711 1714
1712 message->EnableMessagePumping(); // Runs a nested message loop. 1715 message->EnableMessagePumping(); // Runs a nested message loop.
1713 return Send(message); 1716 return Send(message);
1714 } 1717 }
1715 1718
1719 void RenderViewImpl::GetWindowSnapshot(const WindowSnapshotCallback& callback) {
1720 int id = next_smooth_scroll_gesture_id_++;
Ken Russell (switch to Gerrit) 2012/11/08 22:27:44 Typo: next_smooth_scroll_gesture_id_ -> next_snaps
1721 pending_snapshots_.insert(std::make_pair(id, callback));
1722 Send(new ViewHostMsg_GetWindowSnapshot(routing_id_, id));
1723 }
1724
1725 void RenderViewImpl::OnWindowSnapshotCompleted(const int snapshot_id,
1726 const gfx::Size& size, const std::vector<unsigned char>& png) {
1727 PendingSnapshotMap::iterator it = pending_snapshots_.find(snapshot_id);
1728 DCHECK(it != pending_snapshots_.end());
1729 it->second.Run(size, png);
1730 pending_snapshots_.erase(it);
1731 }
1732
1716 // WebKit::WebViewClient ------------------------------------------------------ 1733 // WebKit::WebViewClient ------------------------------------------------------
1717 1734
1718 WebView* RenderViewImpl::createView( 1735 WebView* RenderViewImpl::createView(
1719 WebFrame* creator, 1736 WebFrame* creator,
1720 const WebURLRequest& request, 1737 const WebURLRequest& request,
1721 const WebWindowFeatures& features, 1738 const WebWindowFeatures& features,
1722 const WebString& frame_name, 1739 const WebString& frame_name,
1723 WebNavigationPolicy policy) { 1740 WebNavigationPolicy policy) {
1724 // Check to make sure we aren't overloading on popups. 1741 // Check to make sure we aren't overloading on popups.
1725 if (shared_popup_counter_->data > kMaximumNumberOfUnacknowledgedPopups) 1742 if (shared_popup_counter_->data > kMaximumNumberOfUnacknowledgedPopups)
(...skipping 4625 matching lines...) Expand 10 before | Expand all | Expand 10 after
6351 } 6368 }
6352 #endif 6369 #endif
6353 6370
6354 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( 6371 void RenderViewImpl::OnReleaseDisambiguationPopupDIB(
6355 TransportDIB::Handle dib_handle) { 6372 TransportDIB::Handle dib_handle) {
6356 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); 6373 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle);
6357 RenderProcess::current()->ReleaseTransportDIB(dib); 6374 RenderProcess::current()->ReleaseTransportDIB(dib);
6358 } 6375 }
6359 6376
6360 } // namespace content 6377 } // namespace content
OLDNEW
« content/public/browser/window_util.h ('K') | « content/renderer/render_view_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698