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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 #include "content/public/common/drop_data.h" | 61 #include "content/public/common/drop_data.h" |
62 #include "content/public/common/result_codes.h" | 62 #include "content/public/common/result_codes.h" |
63 #include "content/public/common/url_constants.h" | 63 #include "content/public/common/url_constants.h" |
64 #include "content/public/common/url_utils.h" | 64 #include "content/public/common/url_utils.h" |
65 #include "net/base/net_util.h" | 65 #include "net/base/net_util.h" |
66 #include "net/url_request/url_request_context_getter.h" | 66 #include "net/url_request/url_request_context_getter.h" |
67 #include "third_party/skia/include/core/SkBitmap.h" | 67 #include "third_party/skia/include/core/SkBitmap.h" |
68 #include "ui/gfx/image/image_skia.h" | 68 #include "ui/gfx/image/image_skia.h" |
69 #include "ui/gfx/native_widget_types.h" | 69 #include "ui/gfx/native_widget_types.h" |
70 #include "ui/shell_dialogs/selected_file_info.h" | 70 #include "ui/shell_dialogs/selected_file_info.h" |
71 #include "ui/snapshot/snapshot.h" | |
72 #include "webkit/browser/fileapi/isolated_context.h" | 71 #include "webkit/browser/fileapi/isolated_context.h" |
73 | 72 |
74 #if defined(OS_MACOSX) | 73 #if defined(OS_MACOSX) |
75 #include "content/browser/renderer_host/popup_menu_helper_mac.h" | 74 #include "content/browser/renderer_host/popup_menu_helper_mac.h" |
76 #elif defined(OS_ANDROID) | 75 #elif defined(OS_ANDROID) |
77 #include "content/browser/media/android/browser_media_player_manager.h" | 76 #include "content/browser/media/android/browser_media_player_manager.h" |
78 #endif | 77 #endif |
79 | 78 |
80 using base::TimeDelta; | 79 using base::TimeDelta; |
81 using WebKit::WebConsoleMessage; | 80 using WebKit::WebConsoleMessage; |
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnFocusedNodeChanged) | 985 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnFocusedNodeChanged) |
987 IPC_MESSAGE_HANDLER(ViewHostMsg_AddMessageToConsole, OnAddMessageToConsole) | 986 IPC_MESSAGE_HANDLER(ViewHostMsg_AddMessageToConsole, OnAddMessageToConsole) |
988 IPC_MESSAGE_HANDLER(ViewHostMsg_ShouldClose_ACK, OnShouldCloseACK) | 987 IPC_MESSAGE_HANDLER(ViewHostMsg_ShouldClose_ACK, OnShouldCloseACK) |
989 IPC_MESSAGE_HANDLER(ViewHostMsg_ClosePage_ACK, OnClosePageACK) | 988 IPC_MESSAGE_HANDLER(ViewHostMsg_ClosePage_ACK, OnClosePageACK) |
990 IPC_MESSAGE_HANDLER(ViewHostMsg_SwapOut_ACK, OnSwapOutACK) | 989 IPC_MESSAGE_HANDLER(ViewHostMsg_SwapOut_ACK, OnSwapOutACK) |
991 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionChanged, OnSelectionChanged) | 990 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionChanged, OnSelectionChanged) |
992 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionBoundsChanged, | 991 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionBoundsChanged, |
993 OnSelectionBoundsChanged) | 992 OnSelectionBoundsChanged) |
994 IPC_MESSAGE_HANDLER(ViewHostMsg_ScriptEvalResponse, OnScriptEvalResponse) | 993 IPC_MESSAGE_HANDLER(ViewHostMsg_ScriptEvalResponse, OnScriptEvalResponse) |
995 IPC_MESSAGE_HANDLER(ViewHostMsg_DidZoomURL, OnDidZoomURL) | 994 IPC_MESSAGE_HANDLER(ViewHostMsg_DidZoomURL, OnDidZoomURL) |
996 IPC_MESSAGE_HANDLER(ViewHostMsg_GetWindowSnapshot, OnGetWindowSnapshot) | |
997 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_RequestPermission, | 995 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_RequestPermission, |
998 OnRequestDesktopNotificationPermission) | 996 OnRequestDesktopNotificationPermission) |
999 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Show, | 997 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Show, |
1000 OnShowDesktopNotification) | 998 OnShowDesktopNotification) |
1001 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Cancel, | 999 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Cancel, |
1002 OnCancelDesktopNotification) | 1000 OnCancelDesktopNotification) |
1003 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 1001 #if defined(OS_MACOSX) || defined(OS_ANDROID) |
1004 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowPopup, OnShowPopup) | 1002 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowPopup, OnShowPopup) |
1005 #endif | 1003 #endif |
1006 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser) | 1004 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser) |
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1987 | 1985 |
1988 void RenderViewHostImpl::OnDomOperationResponse( | 1986 void RenderViewHostImpl::OnDomOperationResponse( |
1989 const std::string& json_string, int automation_id) { | 1987 const std::string& json_string, int automation_id) { |
1990 DomOperationNotificationDetails details(json_string, automation_id); | 1988 DomOperationNotificationDetails details(json_string, automation_id); |
1991 NotificationService::current()->Notify( | 1989 NotificationService::current()->Notify( |
1992 NOTIFICATION_DOM_OPERATION_RESPONSE, | 1990 NOTIFICATION_DOM_OPERATION_RESPONSE, |
1993 Source<RenderViewHost>(this), | 1991 Source<RenderViewHost>(this), |
1994 Details<DomOperationNotificationDetails>(&details)); | 1992 Details<DomOperationNotificationDetails>(&details)); |
1995 } | 1993 } |
1996 | 1994 |
1997 void RenderViewHostImpl::OnGetWindowSnapshot(const int snapshot_id) { | |
1998 std::vector<unsigned char> png; | |
1999 | |
2000 // This feature is behind the kEnableGpuBenchmarking command line switch | |
2001 // because it poses security concerns and should only be used for testing. | |
2002 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | |
2003 if (command_line.HasSwitch(switches::kEnableGpuBenchmarking)) { | |
2004 gfx::Rect view_bounds = GetView()->GetViewBounds(); | |
2005 gfx::Rect snapshot_bounds(view_bounds.size()); | |
2006 gfx::Size snapshot_size = snapshot_bounds.size(); | |
2007 | |
2008 if (ui::GrabViewSnapshot(GetView()->GetNativeView(), | |
2009 &png, snapshot_bounds)) { | |
2010 Send(new ViewMsg_WindowSnapshotCompleted( | |
2011 GetRoutingID(), snapshot_id, snapshot_size, png)); | |
2012 return; | |
2013 } | |
2014 } | |
2015 | |
2016 Send(new ViewMsg_WindowSnapshotCompleted( | |
2017 GetRoutingID(), snapshot_id, gfx::Size(), png)); | |
2018 } | |
2019 | |
2020 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 1995 #if defined(OS_MACOSX) || defined(OS_ANDROID) |
2021 void RenderViewHostImpl::OnShowPopup( | 1996 void RenderViewHostImpl::OnShowPopup( |
2022 const ViewHostMsg_ShowPopup_Params& params) { | 1997 const ViewHostMsg_ShowPopup_Params& params) { |
2023 RenderViewHostDelegateView* view = delegate_->GetDelegateView(); | 1998 RenderViewHostDelegateView* view = delegate_->GetDelegateView(); |
2024 if (view) { | 1999 if (view) { |
2025 view->ShowPopupMenu(params.bounds, | 2000 view->ShowPopupMenu(params.bounds, |
2026 params.item_height, | 2001 params.item_height, |
2027 params.item_font_size, | 2002 params.item_font_size, |
2028 params.selected_item, | 2003 params.selected_item, |
2029 params.popup_items, | 2004 params.popup_items, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2068 void RenderViewHostImpl::AttachToFrameTree() { | 2043 void RenderViewHostImpl::AttachToFrameTree() { |
2069 FrameTree* frame_tree = delegate_->GetFrameTree(); | 2044 FrameTree* frame_tree = delegate_->GetFrameTree(); |
2070 | 2045 |
2071 frame_tree->SwapMainFrame(main_render_frame_host_.get()); | 2046 frame_tree->SwapMainFrame(main_render_frame_host_.get()); |
2072 if (main_frame_id() != FrameTreeNode::kInvalidFrameId) { | 2047 if (main_frame_id() != FrameTreeNode::kInvalidFrameId) { |
2073 frame_tree->OnFirstNavigationAfterSwap(main_frame_id()); | 2048 frame_tree->OnFirstNavigationAfterSwap(main_frame_id()); |
2074 } | 2049 } |
2075 } | 2050 } |
2076 | 2051 |
2077 } // namespace content | 2052 } // namespace content |
OLD | NEW |