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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 #include "content/public/browser/browser_context.h" | 45 #include "content/public/browser/browser_context.h" |
46 #include "content/public/browser/browser_message_filter.h" | 46 #include "content/public/browser/browser_message_filter.h" |
47 #include "content/public/browser/content_browser_client.h" | 47 #include "content/public/browser/content_browser_client.h" |
48 #include "content/public/browser/dom_operation_notification_details.h" | 48 #include "content/public/browser/dom_operation_notification_details.h" |
49 #include "content/public/browser/native_web_keyboard_event.h" | 49 #include "content/public/browser/native_web_keyboard_event.h" |
50 #include "content/public/browser/notification_details.h" | 50 #include "content/public/browser/notification_details.h" |
51 #include "content/public/browser/notification_service.h" | 51 #include "content/public/browser/notification_service.h" |
52 #include "content/public/browser/notification_types.h" | 52 #include "content/public/browser/notification_types.h" |
53 #include "content/public/browser/render_view_host_observer.h" | 53 #include "content/public/browser/render_view_host_observer.h" |
54 #include "content/public/browser/user_metrics.h" | 54 #include "content/public/browser/user_metrics.h" |
55 #include "content/public/browser/window_util.h" | |
55 #include "content/public/common/bindings_policy.h" | 56 #include "content/public/common/bindings_policy.h" |
56 #include "content/public/common/content_constants.h" | 57 #include "content/public/common/content_constants.h" |
57 #include "content/public/common/content_switches.h" | 58 #include "content/public/common/content_switches.h" |
58 #include "content/public/common/context_menu_params.h" | 59 #include "content/public/common/context_menu_params.h" |
59 #include "content/public/common/context_menu_source_type.h" | 60 #include "content/public/common/context_menu_source_type.h" |
60 #include "content/public/common/result_codes.h" | 61 #include "content/public/common/result_codes.h" |
61 #include "content/public/common/url_constants.h" | 62 #include "content/public/common/url_constants.h" |
62 #include "net/base/net_util.h" | 63 #include "net/base/net_util.h" |
63 #include "net/url_request/url_request_context_getter.h" | 64 #include "net/url_request/url_request_context_getter.h" |
64 #include "third_party/skia/include/core/SkBitmap.h" | 65 #include "third_party/skia/include/core/SkBitmap.h" |
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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, OnMsgGetWindowSnapshot) | |
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 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2028 // can cause navigations to be ignored in OnMsgNavigate. | 2030 // can cause navigations to be ignored in OnMsgNavigate. |
2029 is_waiting_for_beforeunload_ack_ = false; | 2031 is_waiting_for_beforeunload_ack_ = false; |
2030 is_waiting_for_unload_ack_ = false; | 2032 is_waiting_for_unload_ack_ = false; |
2031 has_timed_out_on_unload_ = false; | 2033 has_timed_out_on_unload_ = false; |
2032 } | 2034 } |
2033 | 2035 |
2034 void RenderViewHostImpl::ClearPowerSaveBlockers() { | 2036 void RenderViewHostImpl::ClearPowerSaveBlockers() { |
2035 STLDeleteValues(&power_save_blockers_); | 2037 STLDeleteValues(&power_save_blockers_); |
2036 } | 2038 } |
2037 | 2039 |
2040 void RenderViewHostImpl::OnMsgGetWindowSnapshot(const int id) { | |
2041 std::vector<unsigned char> png; | |
jam
2012/11/09 02:21:29
nit: 2 space tabbing per style guide
| |
2042 | |
2043 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | |
2044 if (command_line.HasSwitch(switches::kEnableGpuBenchmarking)) { | |
2045 gfx::Size snapshot_size; | |
2046 gfx::Rect view_bounds = GetView()->GetViewBounds(); | |
2047 gfx::Rect snapshot_bounds( | |
2048 0, 0, view_bounds.width(), view_bounds.height()); | |
2049 | |
2050 snapshot_size.SetSize(snapshot_bounds.width(), | |
2051 snapshot_bounds.height()); | |
2052 | |
2053 if (content::GrabViewSnapshot(GetView()->GetNativeView(), | |
2054 &png, snapshot_bounds)) { | |
2055 Send(new ViewMsg_WindowSnapshotCompleted( | |
2056 GetRoutingID(), id, snapshot_size, png)); | |
2057 return; | |
2058 } | |
2059 } | |
2060 | |
2061 Send(new ViewMsg_WindowSnapshotCompleted( | |
2062 GetRoutingID(), id, gfx::Size(), png)); | |
2063 } | |
2064 | |
2038 } // namespace content | 2065 } // namespace content |
OLD | NEW |