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

Side by Side Diff: content/browser/renderer_host/render_view_host_impl.cc

Issue 11399002: Implemented GetWindowSnapshot on RenderViewImpl (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Moved snapshot files to ui/base 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/browser/renderer_host/render_view_host_impl.h" 5 #include "content/browser/renderer_host/render_view_host_impl.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 #include "content/public/common/content_constants.h" 56 #include "content/public/common/content_constants.h"
57 #include "content/public/common/content_switches.h" 57 #include "content/public/common/content_switches.h"
58 #include "content/public/common/context_menu_params.h" 58 #include "content/public/common/context_menu_params.h"
59 #include "content/public/common/context_menu_source_type.h" 59 #include "content/public/common/context_menu_source_type.h"
60 #include "content/public/common/result_codes.h" 60 #include "content/public/common/result_codes.h"
61 #include "content/public/common/url_constants.h" 61 #include "content/public/common/url_constants.h"
62 #include "net/base/net_util.h" 62 #include "net/base/net_util.h"
63 #include "net/url_request/url_request_context_getter.h" 63 #include "net/url_request/url_request_context_getter.h"
64 #include "third_party/skia/include/core/SkBitmap.h" 64 #include "third_party/skia/include/core/SkBitmap.h"
65 #include "ui/base/dialogs/selected_file_info.h" 65 #include "ui/base/dialogs/selected_file_info.h"
66 #include "ui/base/snapshot/snapshot.h"
66 #include "ui/gfx/image/image_skia.h" 67 #include "ui/gfx/image/image_skia.h"
67 #include "ui/gfx/native_widget_types.h" 68 #include "ui/gfx/native_widget_types.h"
68 #include "webkit/fileapi/isolated_context.h" 69 #include "webkit/fileapi/isolated_context.h"
69 #include "webkit/glue/webdropdata.h" 70 #include "webkit/glue/webdropdata.h"
70 #include "webkit/glue/webkit_glue.h" 71 #include "webkit/glue/webkit_glue.h"
71 72
72 #if defined(OS_WIN) 73 #if defined(OS_WIN)
73 #include "base/win/windows_version.h" 74 #include "base/win/windows_version.h"
74 #include "third_party/WebKit/Source/WebKit/chromium/public/win/WebScreenInfoFact ory.h" 75 #include "third_party/WebKit/Source/WebKit/chromium/public/win/WebScreenInfoFact ory.h"
75 #elif defined(OS_MACOSX) 76 #elif defined(OS_MACOSX)
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnFocusedNodeChanged) 1023 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnFocusedNodeChanged)
1023 IPC_MESSAGE_HANDLER(ViewHostMsg_AddMessageToConsole, OnAddMessageToConsole) 1024 IPC_MESSAGE_HANDLER(ViewHostMsg_AddMessageToConsole, OnAddMessageToConsole)
1024 IPC_MESSAGE_HANDLER(ViewHostMsg_ShouldClose_ACK, OnMsgShouldCloseACK) 1025 IPC_MESSAGE_HANDLER(ViewHostMsg_ShouldClose_ACK, OnMsgShouldCloseACK)
1025 IPC_MESSAGE_HANDLER(ViewHostMsg_ClosePage_ACK, OnMsgClosePageACK) 1026 IPC_MESSAGE_HANDLER(ViewHostMsg_ClosePage_ACK, OnMsgClosePageACK)
1026 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionChanged, OnMsgSelectionChanged) 1027 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionChanged, OnMsgSelectionChanged)
1027 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionBoundsChanged, 1028 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionBoundsChanged,
1028 OnMsgSelectionBoundsChanged) 1029 OnMsgSelectionBoundsChanged)
1029 IPC_MESSAGE_HANDLER(ViewHostMsg_ScriptEvalResponse, OnScriptEvalResponse) 1030 IPC_MESSAGE_HANDLER(ViewHostMsg_ScriptEvalResponse, OnScriptEvalResponse)
1030 IPC_MESSAGE_HANDLER(ViewHostMsg_DidZoomURL, OnDidZoomURL) 1031 IPC_MESSAGE_HANDLER(ViewHostMsg_DidZoomURL, OnDidZoomURL)
1031 IPC_MESSAGE_HANDLER(ViewHostMsg_MediaNotification, OnMediaNotification) 1032 IPC_MESSAGE_HANDLER(ViewHostMsg_MediaNotification, OnMediaNotification)
1033 IPC_MESSAGE_HANDLER(ViewHostMsg_GetWindowSnapshot, OnGetWindowSnapshot)
1032 #if defined(OS_ANDROID) 1034 #if defined(OS_ANDROID)
1033 IPC_MESSAGE_HANDLER(ViewHostMsg_StartContentIntent, OnStartContentIntent) 1035 IPC_MESSAGE_HANDLER(ViewHostMsg_StartContentIntent, OnStartContentIntent)
1034 IPC_MESSAGE_HANDLER(ViewHostMsg_DidChangeBodyBackgroundColor, 1036 IPC_MESSAGE_HANDLER(ViewHostMsg_DidChangeBodyBackgroundColor,
1035 OnMsgDidChangeBodyBackgroundColor) 1037 OnMsgDidChangeBodyBackgroundColor)
1036 #endif 1038 #endif
1037 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_RequestPermission, 1039 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_RequestPermission,
1038 OnRequestDesktopNotificationPermission) 1040 OnRequestDesktopNotificationPermission)
1039 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Show, 1041 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Show,
1040 OnShowDesktopNotification) 1042 OnShowDesktopNotification)
1041 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Cancel, 1043 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Cancel,
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after
2030 // can cause navigations to be ignored in OnMsgNavigate. 2032 // can cause navigations to be ignored in OnMsgNavigate.
2031 is_waiting_for_beforeunload_ack_ = false; 2033 is_waiting_for_beforeunload_ack_ = false;
2032 is_waiting_for_unload_ack_ = false; 2034 is_waiting_for_unload_ack_ = false;
2033 has_timed_out_on_unload_ = false; 2035 has_timed_out_on_unload_ = false;
2034 } 2036 }
2035 2037
2036 void RenderViewHostImpl::ClearPowerSaveBlockers() { 2038 void RenderViewHostImpl::ClearPowerSaveBlockers() {
2037 STLDeleteValues(&power_save_blockers_); 2039 STLDeleteValues(&power_save_blockers_);
2038 } 2040 }
2039 2041
2042 void RenderViewHostImpl::OnGetWindowSnapshot(const int id) {
2043 std::vector<unsigned char> png;
2044
2045 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
2046 if (command_line.HasSwitch(switches::kEnableGpuBenchmarking)) {
2047 gfx::Size snapshot_size;
2048 gfx::Rect view_bounds = GetView()->GetViewBounds();
2049 gfx::Rect snapshot_bounds(
2050 0, 0, view_bounds.width(), view_bounds.height());
2051
2052 snapshot_size.SetSize(snapshot_bounds.width(),
2053 snapshot_bounds.height());
2054
2055 if (ui::GrabViewSnapshot(GetView()->GetNativeView(),
2056 &png, snapshot_bounds)) {
2057 Send(new ViewMsg_WindowSnapshotCompleted(
2058 GetRoutingID(), id, snapshot_size, png));
2059 return;
2060 }
2061 }
2062
2063 Send(new ViewMsg_WindowSnapshotCompleted(
2064 GetRoutingID(), id, gfx::Size(), png));
2065 }
2066
2040 } // namespace content 2067 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698