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

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: Added stub methods for iOS Created 8 years 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
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | ui/snapshot/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 body_background_color_(SK_ColorWHITE), 593 body_background_color_(SK_ColorWHITE),
594 update_frame_info_scheduled_(false), 594 update_frame_info_scheduled_(false),
595 expected_content_intent_id_(0), 595 expected_content_intent_id_(0),
596 media_player_proxy_(NULL), 596 media_player_proxy_(NULL),
597 synchronous_find_active_match_ordinal_(-1), 597 synchronous_find_active_match_ordinal_(-1),
598 ALLOW_THIS_IN_INITIALIZER_LIST( 598 ALLOW_THIS_IN_INITIALIZER_LIST(
599 load_progress_tracker_(new LoadProgressTracker(this))), 599 load_progress_tracker_(new LoadProgressTracker(this))),
600 #endif 600 #endif
601 session_storage_namespace_id_(params->session_storage_namespace_id), 601 session_storage_namespace_id_(params->session_storage_namespace_id),
602 handling_select_range_(false), 602 handling_select_range_(false),
603 next_snapshot_id_(0),
603 #if defined(OS_WIN) 604 #if defined(OS_WIN)
604 focused_plugin_id_(-1), 605 focused_plugin_id_(-1),
605 #endif 606 #endif
606 updating_frame_tree_(false), 607 updating_frame_tree_(false),
607 pending_frame_tree_update_(false), 608 pending_frame_tree_update_(false),
608 target_process_id_(0), 609 target_process_id_(0),
609 target_routing_id_(0) { 610 target_routing_id_(0) {
610 #if defined(ENABLE_PLUGINS) 611 #if defined(ENABLE_PLUGINS)
611 pepper_helper_.reset(new PepperPluginDelegateImpl(this)); 612 pepper_helper_.reset(new PepperPluginDelegateImpl(this));
612 #else 613 #else
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 IPC_MESSAGE_HANDLER(ViewMsg_CopyToFindPboard, OnCopyToFindPboard) 1037 IPC_MESSAGE_HANDLER(ViewMsg_CopyToFindPboard, OnCopyToFindPboard)
1037 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted, 1038 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted,
1038 OnPluginImeCompositionCompleted) 1039 OnPluginImeCompositionCompleted)
1039 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) 1040 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem)
1040 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) 1041 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize)
1041 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility) 1042 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility)
1042 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged) 1043 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged)
1043 #endif 1044 #endif
1044 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupDIB, 1045 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupDIB,
1045 OnReleaseDisambiguationPopupDIB) 1046 OnReleaseDisambiguationPopupDIB)
1047 IPC_MESSAGE_HANDLER(ViewMsg_WindowSnapshotCompleted,
1048 OnWindowSnapshotCompleted)
1046 1049
1047 // Have the super handle all other messages. 1050 // Have the super handle all other messages.
1048 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) 1051 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message))
1049 IPC_END_MESSAGE_MAP() 1052 IPC_END_MESSAGE_MAP()
1050 1053
1051 if (!msg_is_ok) { 1054 if (!msg_is_ok) {
1052 // The message had a handler, but its deserialization failed. 1055 // The message had a handler, but its deserialization failed.
1053 // Kill the renderer to avoid potential spoofing attacks. 1056 // Kill the renderer to avoid potential spoofing attacks.
1054 CHECK(false) << "Unable to deserialize message in RenderViewImpl."; 1057 CHECK(false) << "Unable to deserialize message in RenderViewImpl.";
1055 } 1058 }
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
1750 // equivalent of WebView::willEnterModalLoop. In the case of showModalDialog 1753 // equivalent of WebView::willEnterModalLoop. In the case of showModalDialog
1751 // it is particularly important that we do not call willEnterModalLoop as 1754 // it is particularly important that we do not call willEnterModalLoop as
1752 // that would defer resource loads for the dialog itself. 1755 // that would defer resource loads for the dialog itself.
1753 if (RenderThreadImpl::current()) // Will be NULL during unit tests. 1756 if (RenderThreadImpl::current()) // Will be NULL during unit tests.
1754 RenderThreadImpl::current()->DoNotNotifyWebKitOfModalLoop(); 1757 RenderThreadImpl::current()->DoNotNotifyWebKitOfModalLoop();
1755 1758
1756 message->EnableMessagePumping(); // Runs a nested message loop. 1759 message->EnableMessagePumping(); // Runs a nested message loop.
1757 return Send(message); 1760 return Send(message);
1758 } 1761 }
1759 1762
1763 void RenderViewImpl::GetWindowSnapshot(const WindowSnapshotCallback& callback) {
1764 int id = next_snapshot_id_++;
1765 pending_snapshots_.insert(std::make_pair(id, callback));
1766 Send(new ViewHostMsg_GetWindowSnapshot(routing_id_, id));
1767 }
1768
1769 void RenderViewImpl::OnWindowSnapshotCompleted(const int snapshot_id,
1770 const gfx::Size& size, const std::vector<unsigned char>& png) {
1771 PendingSnapshotMap::iterator it = pending_snapshots_.find(snapshot_id);
1772 DCHECK(it != pending_snapshots_.end());
1773 it->second.Run(size, png);
1774 pending_snapshots_.erase(it);
1775 }
1776
1760 // WebKit::WebViewClient ------------------------------------------------------ 1777 // WebKit::WebViewClient ------------------------------------------------------
1761 1778
1762 WebView* RenderViewImpl::createView( 1779 WebView* RenderViewImpl::createView(
1763 WebFrame* creator, 1780 WebFrame* creator,
1764 const WebURLRequest& request, 1781 const WebURLRequest& request,
1765 const WebWindowFeatures& features, 1782 const WebWindowFeatures& features,
1766 const WebString& frame_name, 1783 const WebString& frame_name,
1767 WebNavigationPolicy policy) { 1784 WebNavigationPolicy policy) {
1768 // Check to make sure we aren't overloading on popups. 1785 // Check to make sure we aren't overloading on popups.
1769 if (shared_popup_counter_->data > kMaximumNumberOfUnacknowledgedPopups) 1786 if (shared_popup_counter_->data > kMaximumNumberOfUnacknowledgedPopups)
(...skipping 4712 matching lines...) Expand 10 before | Expand all | Expand 10 after
6482 } 6499 }
6483 #endif 6500 #endif
6484 6501
6485 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( 6502 void RenderViewImpl::OnReleaseDisambiguationPopupDIB(
6486 TransportDIB::Handle dib_handle) { 6503 TransportDIB::Handle dib_handle) {
6487 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); 6504 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle);
6488 RenderProcess::current()->ReleaseTransportDIB(dib); 6505 RenderProcess::current()->ReleaseTransportDIB(dib);
6489 } 6506 }
6490 6507
6491 } // namespace content 6508 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | ui/snapshot/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698