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

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

Issue 10377170: Browser Plugin: browser process side changes (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Updated according to creis@ Created 8 years, 7 months 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 | Annotate | Revision Log
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 12 matching lines...) Expand all
23 #endif 23 #endif
24 #include "content/browser/child_process_security_policy_impl.h" 24 #include "content/browser/child_process_security_policy_impl.h"
25 #include "content/browser/cross_site_request_manager.h" 25 #include "content/browser/cross_site_request_manager.h"
26 #include "content/browser/dom_storage/dom_storage_context_impl.h" 26 #include "content/browser/dom_storage/dom_storage_context_impl.h"
27 #include "content/browser/dom_storage/session_storage_namespace_impl.h" 27 #include "content/browser/dom_storage/session_storage_namespace_impl.h"
28 #include "content/browser/gpu/gpu_surface_tracker.h" 28 #include "content/browser/gpu/gpu_surface_tracker.h"
29 #include "content/browser/host_zoom_map_impl.h" 29 #include "content/browser/host_zoom_map_impl.h"
30 #include "content/browser/power_save_blocker.h" 30 #include "content/browser/power_save_blocker.h"
31 #include "content/browser/renderer_host/render_process_host_impl.h" 31 #include "content/browser/renderer_host/render_process_host_impl.h"
32 #include "content/common/accessibility_messages.h" 32 #include "content/common/accessibility_messages.h"
33 #include "content/common/browser_plugin_messages.h"
33 #include "content/common/desktop_notification_messages.h" 34 #include "content/common/desktop_notification_messages.h"
34 #include "content/common/drag_messages.h" 35 #include "content/common/drag_messages.h"
35 #include "content/common/inter_process_time_ticks_converter.h" 36 #include "content/common/inter_process_time_ticks_converter.h"
36 #include "content/common/speech_recognition_messages.h" 37 #include "content/common/speech_recognition_messages.h"
37 #include "content/common/swapped_out_messages.h" 38 #include "content/common/swapped_out_messages.h"
38 #include "content/common/view_messages.h" 39 #include "content/common/view_messages.h"
39 #include "content/port/browser/render_widget_host_view_port.h" 40 #include "content/port/browser/render_widget_host_view_port.h"
40 #include "content/public/browser/browser_accessibility_state.h" 41 #include "content/public/browser/browser_accessibility_state.h"
41 #include "content/public/browser/browser_context.h" 42 #include "content/public/browser/browser_context.h"
42 #include "content/public/browser/browser_message_filter.h" 43 #include "content/public/browser/browser_message_filter.h"
43 #include "content/public/browser/content_browser_client.h" 44 #include "content/public/browser/content_browser_client.h"
44 #include "content/public/browser/dom_operation_notification_details.h" 45 #include "content/public/browser/dom_operation_notification_details.h"
45 #include "content/public/browser/native_web_keyboard_event.h" 46 #include "content/public/browser/native_web_keyboard_event.h"
46 #include "content/public/browser/notification_details.h" 47 #include "content/public/browser/notification_details.h"
47 #include "content/public/browser/notification_service.h" 48 #include "content/public/browser/notification_service.h"
48 #include "content/public/browser/notification_types.h" 49 #include "content/public/browser/notification_types.h"
49 #include "content/public/browser/render_view_host_delegate.h" 50 #include "content/public/browser/render_view_host_delegate.h"
50 #include "content/public/browser/render_view_host_observer.h" 51 #include "content/public/browser/render_view_host_observer.h"
51 #include "content/public/browser/user_metrics.h" 52 #include "content/public/browser/user_metrics.h"
52 #include "content/public/common/bindings_policy.h" 53 #include "content/public/common/bindings_policy.h"
53 #include "content/public/common/content_constants.h" 54 #include "content/public/common/content_constants.h"
54 #include "content/public/common/content_switches.h" 55 #include "content/public/common/content_switches.h"
55 #include "content/public/common/context_menu_params.h" 56 #include "content/public/common/context_menu_params.h"
56 #include "content/public/common/result_codes.h" 57 #include "content/public/common/result_codes.h"
57 #include "content/public/common/selected_file_info.h" 58 #include "content/public/common/selected_file_info.h"
58 #include "content/public/common/url_constants.h" 59 #include "content/public/common/url_constants.h"
60 #include "ipc/ipc_channel_handle.h"
59 #include "net/base/net_util.h" 61 #include "net/base/net_util.h"
60 #include "net/url_request/url_request_context_getter.h" 62 #include "net/url_request/url_request_context_getter.h"
61 #include "third_party/skia/include/core/SkBitmap.h" 63 #include "third_party/skia/include/core/SkBitmap.h"
62 #if defined(OS_WIN) 64 #if defined(OS_WIN)
63 #include "third_party/WebKit/Source/WebKit/chromium/public/win/WebScreenInfoFact ory.h" 65 #include "third_party/WebKit/Source/WebKit/chromium/public/win/WebScreenInfoFact ory.h"
64 #endif 66 #endif
65 #include "ui/gfx/native_widget_types.h" 67 #include "ui/gfx/native_widget_types.h"
66 #include "webkit/fileapi/isolated_context.h" 68 #include "webkit/fileapi/isolated_context.h"
67 #include "webkit/glue/webaccessibility.h" 69 #include "webkit/glue/webaccessibility.h"
68 #include "webkit/glue/webdropdata.h" 70 #include "webkit/glue/webdropdata.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 } else { 253 } else {
252 content::RenderWidgetHostViewPort::GetDefaultScreenInfo( 254 content::RenderWidgetHostViewPort::GetDefaultScreenInfo(
253 &params.screen_info); 255 &params.screen_info);
254 } 256 }
255 #else 257 #else
256 params.screen_info = 258 params.screen_info =
257 WebKit::WebScreenInfoFactory::screenInfo( 259 WebKit::WebScreenInfoFactory::screenInfo(
258 gfx::NativeViewFromId(GetNativeViewId())); 260 gfx::NativeViewFromId(GetNativeViewId()));
259 #endif 261 #endif
260 262
261 if (embedder_process_id != -1) 263 if (embedder_process_id != -1) {
262 params.embedder_channel_name = 264 params.embedder_channel_name =
263 StringPrintf("%d.r%d", GetProcess()->GetID(), embedder_process_id); 265 StringPrintf("%d.r%d", GetProcess()->GetID(), embedder_process_id);
266 }
264 267
265 params.accessibility_mode = 268 params.accessibility_mode =
266 BrowserAccessibilityState::GetInstance()->IsAccessibleBrowser() ? 269 BrowserAccessibilityState::GetInstance()->IsAccessibleBrowser() ?
267 AccessibilityModeComplete : 270 AccessibilityModeComplete :
268 AccessibilityModeOff; 271 AccessibilityModeOff;
269 272
270 #if defined(OS_WIN) 273 #if defined(OS_WIN)
271 // On Windows 8, always enable accessibility for editable text controls 274 // On Windows 8, always enable accessibility for editable text controls
272 // so we can show the virtual keyboard when one is enabled. 275 // so we can show the virtual keyboard when one is enabled.
273 if (base::win::GetVersion() >= base::win::VERSION_WIN8 && 276 if (base::win::GetVersion() >= base::win::VERSION_WIN8 &&
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Cancel, 917 IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Cancel,
915 OnCancelDesktopNotification) 918 OnCancelDesktopNotification)
916 #if defined(OS_MACOSX) 919 #if defined(OS_MACOSX)
917 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowPopup, OnMsgShowPopup) 920 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowPopup, OnMsgShowPopup)
918 #endif 921 #endif
919 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser) 922 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser)
920 IPC_MESSAGE_HANDLER(ViewHostMsg_DomOperationResponse, 923 IPC_MESSAGE_HANDLER(ViewHostMsg_DomOperationResponse,
921 OnDomOperationResponse) 924 OnDomOperationResponse)
922 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Notifications, 925 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Notifications,
923 OnAccessibilityNotifications) 926 OnAccessibilityNotifications)
927 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_ConnectToChannel,
928 OnConnectToChannel)
929 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_NavigateFromEmbedder,
930 OnNavigateGuestFromEmbedder)
931 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_ResizeGuest, OnResizeGuest)
924 // Have the super handle all other messages. 932 // Have the super handle all other messages.
925 IPC_MESSAGE_UNHANDLED( 933 IPC_MESSAGE_UNHANDLED(
926 handled = RenderWidgetHostImpl::OnMessageReceived(msg)) 934 handled = RenderWidgetHostImpl::OnMessageReceived(msg))
927 IPC_END_MESSAGE_MAP_EX() 935 IPC_END_MESSAGE_MAP_EX()
928 936
929 if (!msg_is_ok) { 937 if (!msg_is_ok) {
930 // The message had a handler, but its de-serialization failed. 938 // The message had a handler, but its de-serialization failed.
931 // Kill the renderer. 939 // Kill the renderer.
932 content::RecordAction(UserMetricsAction("BadMessageTerminate_RVH")); 940 content::RecordAction(UserMetricsAction("BadMessageTerminate_RVH"));
933 GetProcess()->ReceivedBadMessage(); 941 GetProcess()->ReceivedBadMessage();
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
1821 1829
1822 void RenderViewHostImpl::OnDomOperationResponse( 1830 void RenderViewHostImpl::OnDomOperationResponse(
1823 const std::string& json_string, int automation_id) { 1831 const std::string& json_string, int automation_id) {
1824 DomOperationNotificationDetails details(json_string, automation_id); 1832 DomOperationNotificationDetails details(json_string, automation_id);
1825 content::NotificationService::current()->Notify( 1833 content::NotificationService::current()->Notify(
1826 content::NOTIFICATION_DOM_OPERATION_RESPONSE, 1834 content::NOTIFICATION_DOM_OPERATION_RESPONSE,
1827 content::Source<RenderViewHost>(this), 1835 content::Source<RenderViewHost>(this),
1828 content::Details<DomOperationNotificationDetails>(&details)); 1836 content::Details<DomOperationNotificationDetails>(&details));
1829 } 1837 }
1830 1838
1839 void RenderViewHostImpl::OnConnectToChannel(
1840 const IPC::ChannelHandle& channel_handle) {
1841 delegate_->ConnectEmbedderToChannel(this, channel_handle);
1842 }
1843
1844 void RenderViewHostImpl::OnNavigateGuestFromEmbedder(int32 instance_id,
1845 long long frame_id,
1846 const std::string& src,
1847 const gfx::Size& size) {
1848 delegate_->NavigateGuestFromEmbedder(
1849 this,
1850 instance_id,
1851 frame_id,
1852 src,
1853 size);
1854 }
1855
1856 void RenderViewHostImpl::OnResizeGuest(int width, int height) {
1857 DCHECK(GetView());
1858 GetView()->SetSize(gfx::Size(width, height));
1859 }
1860
1861
1831 void RenderViewHostImpl::SetSwappedOut(bool is_swapped_out) { 1862 void RenderViewHostImpl::SetSwappedOut(bool is_swapped_out) {
1832 is_swapped_out_ = is_swapped_out; 1863 is_swapped_out_ = is_swapped_out;
1833 1864
1834 // Whenever we change swap out state, we should not be waiting for 1865 // Whenever we change swap out state, we should not be waiting for
1835 // beforeunload or unload acks. We clear them here to be safe, since they 1866 // beforeunload or unload acks. We clear them here to be safe, since they
1836 // can cause navigations to be ignored in OnMsgNavigate. 1867 // can cause navigations to be ignored in OnMsgNavigate.
1837 is_waiting_for_beforeunload_ack_ = false; 1868 is_waiting_for_beforeunload_ack_ = false;
1838 is_waiting_for_unload_ack_ = false; 1869 is_waiting_for_unload_ack_ = false;
1839 } 1870 }
1840 1871
1841 void RenderViewHostImpl::ClearPowerSaveBlockers() { 1872 void RenderViewHostImpl::ClearPowerSaveBlockers() {
1842 STLDeleteValues(&power_save_blockers_); 1873 STLDeleteValues(&power_save_blockers_);
1843 } 1874 }
1844 1875
1845 } // namespace content 1876 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698