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/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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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/gfx/image/image_skia.h" | 66 #include "ui/gfx/image/image_skia.h" |
67 #include "ui/gfx/native_widget_types.h" | 67 #include "ui/gfx/native_widget_types.h" |
68 #include "ui/snapshot/snapshot.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) |
76 #include "content/browser/renderer_host/popup_menu_helper_mac.h" | 77 #include "content/browser/renderer_host/popup_menu_helper_mac.h" |
77 #elif defined(OS_ANDROID) | 78 #elif defined(OS_ANDROID) |
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1013 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnFocusedNodeChanged) | 1014 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnFocusedNodeChanged) |
1014 IPC_MESSAGE_HANDLER(ViewHostMsg_AddMessageToConsole, OnAddMessageToConsole) | 1015 IPC_MESSAGE_HANDLER(ViewHostMsg_AddMessageToConsole, OnAddMessageToConsole) |
1015 IPC_MESSAGE_HANDLER(ViewHostMsg_ShouldClose_ACK, OnMsgShouldCloseACK) | 1016 IPC_MESSAGE_HANDLER(ViewHostMsg_ShouldClose_ACK, OnMsgShouldCloseACK) |
1016 IPC_MESSAGE_HANDLER(ViewHostMsg_ClosePage_ACK, OnMsgClosePageACK) | 1017 IPC_MESSAGE_HANDLER(ViewHostMsg_ClosePage_ACK, OnMsgClosePageACK) |
1017 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionChanged, OnMsgSelectionChanged) | 1018 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionChanged, OnMsgSelectionChanged) |
1018 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionBoundsChanged, | 1019 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionBoundsChanged, |
1019 OnMsgSelectionBoundsChanged) | 1020 OnMsgSelectionBoundsChanged) |
1020 IPC_MESSAGE_HANDLER(ViewHostMsg_ScriptEvalResponse, OnScriptEvalResponse) | 1021 IPC_MESSAGE_HANDLER(ViewHostMsg_ScriptEvalResponse, OnScriptEvalResponse) |
1021 IPC_MESSAGE_HANDLER(ViewHostMsg_DidZoomURL, OnDidZoomURL) | 1022 IPC_MESSAGE_HANDLER(ViewHostMsg_DidZoomURL, OnDidZoomURL) |
1022 IPC_MESSAGE_HANDLER(ViewHostMsg_MediaNotification, OnMediaNotification) | 1023 IPC_MESSAGE_HANDLER(ViewHostMsg_MediaNotification, OnMediaNotification) |
1024 IPC_MESSAGE_HANDLER(ViewHostMsg_GetWindowSnapshot, OnGetWindowSnapshot) | |
1023 #if defined(OS_ANDROID) | 1025 #if defined(OS_ANDROID) |
1024 IPC_MESSAGE_HANDLER(ViewHostMsg_StartContentIntent, OnStartContentIntent) | 1026 IPC_MESSAGE_HANDLER(ViewHostMsg_StartContentIntent, OnStartContentIntent) |
1025 IPC_MESSAGE_HANDLER(ViewHostMsg_DidChangeBodyBackgroundColor, | 1027 IPC_MESSAGE_HANDLER(ViewHostMsg_DidChangeBodyBackgroundColor, |
1026 OnMsgDidChangeBodyBackgroundColor) | 1028 OnMsgDidChangeBodyBackgroundColor) |
1027 #endif | 1029 #endif |
1028 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_RequestPermission, | 1030 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_RequestPermission, |
1029 OnRequestDesktopNotificationPermission) | 1031 OnRequestDesktopNotificationPermission) |
1030 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Show, | 1032 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Show, |
1031 OnShowDesktopNotification) | 1033 OnShowDesktopNotification) |
1032 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Cancel, | 1034 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Cancel, |
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2032 // can cause navigations to be ignored in OnMsgNavigate. | 2034 // can cause navigations to be ignored in OnMsgNavigate. |
2033 is_waiting_for_beforeunload_ack_ = false; | 2035 is_waiting_for_beforeunload_ack_ = false; |
2034 is_waiting_for_unload_ack_ = false; | 2036 is_waiting_for_unload_ack_ = false; |
2035 has_timed_out_on_unload_ = false; | 2037 has_timed_out_on_unload_ = false; |
2036 } | 2038 } |
2037 | 2039 |
2038 void RenderViewHostImpl::ClearPowerSaveBlockers() { | 2040 void RenderViewHostImpl::ClearPowerSaveBlockers() { |
2039 STLDeleteValues(&power_save_blockers_); | 2041 STLDeleteValues(&power_save_blockers_); |
2040 } | 2042 } |
2041 | 2043 |
2044 void RenderViewHostImpl::OnGetWindowSnapshot(const int snapshot_id) { | |
2045 std::vector<unsigned char> png; | |
2046 | |
2047 // This feature is behind the kEnableGpuBenchmarking command line switch | |
2048 // because it poses security concerns and should only be used for testing. | |
Nico
2012/12/12 23:46:20
nit: Might be worth mentioning that if this was co
| |
2049 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | |
2050 if (command_line.HasSwitch(switches::kEnableGpuBenchmarking)) { | |
2051 gfx::Size snapshot_size; | |
2052 gfx::Rect view_bounds = GetView()->GetViewBounds(); | |
2053 gfx::Rect snapshot_bounds( | |
piman
2012/12/12 23:59:50
nit: this should work:
gfx::Rect snapshot_bounds(v
| |
2054 0, 0, view_bounds.width(), view_bounds.height()); | |
2055 | |
2056 snapshot_size.SetSize(snapshot_bounds.width(), | |
piman
2012/12/12 23:59:50
nit: snapshot_size = snapshot_bounds.size();
Even
| |
2057 snapshot_bounds.height()); | |
2058 | |
2059 if (ui::GrabViewSnapshot(GetView()->GetNativeView(), | |
2060 &png, snapshot_bounds)) { | |
piman
2012/12/12 23:59:50
nit: arguments should align in function call:
| |
2061 Send(new ViewMsg_WindowSnapshotCompleted( | |
2062 GetRoutingID(), snapshot_id, snapshot_size, png)); | |
2063 return; | |
2064 } | |
2065 } | |
2066 | |
2067 Send(new ViewMsg_WindowSnapshotCompleted( | |
2068 GetRoutingID(), snapshot_id, gfx::Size(), png)); | |
2069 } | |
2070 | |
2042 } // namespace content | 2071 } // namespace content |
OLD | NEW |