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/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
559 OnUnregisterProtocolHandler) | 559 OnUnregisterProtocolHandler) |
560 IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply) | 560 IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply) |
561 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) | 561 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) |
562 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend) | 562 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend) |
563 #if defined(ENABLE_PLUGINS) | 563 #if defined(ENABLE_PLUGINS) |
564 IPC_MESSAGE_HANDLER(FrameHostMsg_PepperPluginHung, OnPepperPluginHung) | 564 IPC_MESSAGE_HANDLER(FrameHostMsg_PepperPluginHung, OnPepperPluginHung) |
565 IPC_MESSAGE_HANDLER(FrameHostMsg_PluginCrashed, OnPluginCrashed) | 565 IPC_MESSAGE_HANDLER(FrameHostMsg_PluginCrashed, OnPluginCrashed) |
566 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestPpapiBrokerPermission, | 566 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestPpapiBrokerPermission, |
567 OnRequestPpapiBrokerPermission) | 567 OnRequestPpapiBrokerPermission) |
568 IPC_MESSAGE_HANDLER_GENERIC(BrowserPluginHostMsg_Attach, | 568 IPC_MESSAGE_HANDLER_GENERIC(BrowserPluginHostMsg_Attach, |
569 OnBrowserPluginMessage(message)) | 569 OnBrowserPluginMessage(render_frame_host, |
570 message)) | |
570 #endif | 571 #endif |
571 IPC_MESSAGE_HANDLER(ImageHostMsg_DidDownloadImage, OnDidDownloadImage) | 572 IPC_MESSAGE_HANDLER(ImageHostMsg_DidDownloadImage, OnDidDownloadImage) |
572 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFaviconURL, OnUpdateFaviconURL) | 573 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFaviconURL, OnUpdateFaviconURL) |
573 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowValidationMessage, | 574 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowValidationMessage, |
574 OnShowValidationMessage) | 575 OnShowValidationMessage) |
575 IPC_MESSAGE_HANDLER(ViewHostMsg_HideValidationMessage, | 576 IPC_MESSAGE_HANDLER(ViewHostMsg_HideValidationMessage, |
576 OnHideValidationMessage) | 577 OnHideValidationMessage) |
577 IPC_MESSAGE_HANDLER(ViewHostMsg_MoveValidationMessage, | 578 IPC_MESSAGE_HANDLER(ViewHostMsg_MoveValidationMessage, |
578 OnMoveValidationMessage) | 579 OnMoveValidationMessage) |
579 #if defined(OS_ANDROID) | 580 #if defined(OS_ANDROID) |
(...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1862 return accessibility_mode_; | 1863 return accessibility_mode_; |
1863 } | 1864 } |
1864 | 1865 |
1865 void WebContentsImpl::AccessibilityEventReceived( | 1866 void WebContentsImpl::AccessibilityEventReceived( |
1866 const std::vector<AXEventNotificationDetails>& details) { | 1867 const std::vector<AXEventNotificationDetails>& details) { |
1867 FOR_EACH_OBSERVER( | 1868 FOR_EACH_OBSERVER( |
1868 WebContentsObserver, observers_, AccessibilityEventReceived(details)); | 1869 WebContentsObserver, observers_, AccessibilityEventReceived(details)); |
1869 } | 1870 } |
1870 | 1871 |
1871 RenderFrameHost* WebContentsImpl::GetGuestByInstanceID( | 1872 RenderFrameHost* WebContentsImpl::GetGuestByInstanceID( |
1873 RenderFrameHost* render_frame_host, | |
1872 int browser_plugin_instance_id) { | 1874 int browser_plugin_instance_id) { |
1873 BrowserPluginGuestManager* guest_manager = | 1875 BrowserPluginGuestManager* guest_manager = |
1874 GetBrowserContext()->GetGuestManager(); | 1876 GetBrowserContext()->GetGuestManager(); |
1877 // TODO(fsamuel): Change message routing to use the process ID of the | |
1878 // |render_frame_host| once BrowserPlugin IPCs get routed using the RFH | |
1879 // routing ID. | |
Charlie Reis
2015/02/13 22:36:14
nit: Bug number.
Fady Samuel
2015/02/13 22:47:09
Done.
| |
1875 WebContents* guest = guest_manager->GetGuestByInstanceID( | 1880 WebContents* guest = guest_manager->GetGuestByInstanceID( |
1876 this, browser_plugin_instance_id); | 1881 GetRenderProcessHost()->GetID(), browser_plugin_instance_id); |
1877 if (!guest) | 1882 if (!guest) |
1878 return NULL; | 1883 return NULL; |
1879 return guest->GetMainFrame(); | 1884 return guest->GetMainFrame(); |
1880 } | 1885 } |
1881 | 1886 |
1882 GeolocationServiceContext* WebContentsImpl::GetGeolocationServiceContext() { | 1887 GeolocationServiceContext* WebContentsImpl::GetGeolocationServiceContext() { |
1883 return geolocation_service_context_.get(); | 1888 return geolocation_service_context_.get(); |
1884 } | 1889 } |
1885 | 1890 |
1886 void WebContentsImpl::OnShowValidationMessage( | 1891 void WebContentsImpl::OnShowValidationMessage( |
(...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3108 NOTIMPLEMENTED(); | 3113 NOTIMPLEMENTED(); |
3109 OnPpapiBrokerPermissionResult(routing_id, false); | 3114 OnPpapiBrokerPermissionResult(routing_id, false); |
3110 } | 3115 } |
3111 } | 3116 } |
3112 | 3117 |
3113 void WebContentsImpl::OnPpapiBrokerPermissionResult(int routing_id, | 3118 void WebContentsImpl::OnPpapiBrokerPermissionResult(int routing_id, |
3114 bool result) { | 3119 bool result) { |
3115 Send(new ViewMsg_PpapiBrokerPermissionResult(routing_id, result)); | 3120 Send(new ViewMsg_PpapiBrokerPermissionResult(routing_id, result)); |
3116 } | 3121 } |
3117 | 3122 |
3118 void WebContentsImpl::OnBrowserPluginMessage(const IPC::Message& message) { | 3123 void WebContentsImpl::OnBrowserPluginMessage(RenderFrameHost* render_frame_host, |
3124 const IPC::Message& message) { | |
3119 // This creates a BrowserPluginEmbedder, which handles all the BrowserPlugin | 3125 // This creates a BrowserPluginEmbedder, which handles all the BrowserPlugin |
3120 // specific messages for this WebContents. This means that any message from | 3126 // specific messages for this WebContents. This means that any message from |
3121 // a BrowserPlugin prior to this will be ignored. | 3127 // a BrowserPlugin prior to this will be ignored. |
3122 // For more info, see comment above classes BrowserPluginEmbedder and | 3128 // For more info, see comment above classes BrowserPluginEmbedder and |
3123 // BrowserPluginGuest. | 3129 // BrowserPluginGuest. |
3124 CHECK(!browser_plugin_embedder_.get()); | 3130 CHECK(!browser_plugin_embedder_.get()); |
3125 browser_plugin_embedder_.reset(BrowserPluginEmbedder::Create(this)); | 3131 browser_plugin_embedder_.reset(BrowserPluginEmbedder::Create(this)); |
3126 browser_plugin_embedder_->OnMessageReceived(message); | 3132 browser_plugin_embedder_->OnMessageReceived(message, render_frame_host); |
3127 } | 3133 } |
3128 #endif // defined(ENABLE_PLUGINS) | 3134 #endif // defined(ENABLE_PLUGINS) |
3129 | 3135 |
3130 void WebContentsImpl::OnDidDownloadImage( | 3136 void WebContentsImpl::OnDidDownloadImage( |
3131 int id, | 3137 int id, |
3132 int http_status_code, | 3138 int http_status_code, |
3133 const GURL& image_url, | 3139 const GURL& image_url, |
3134 const std::vector<SkBitmap>& bitmaps, | 3140 const std::vector<SkBitmap>& bitmaps, |
3135 const std::vector<gfx::Size>& original_bitmap_sizes) { | 3141 const std::vector<gfx::Size>& original_bitmap_sizes) { |
3136 if (bitmaps.size() != original_bitmap_sizes.size()) | 3142 if (bitmaps.size() != original_bitmap_sizes.size()) |
(...skipping 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4500 node->render_manager()->ResumeResponseDeferredAtStart(); | 4506 node->render_manager()->ResumeResponseDeferredAtStart(); |
4501 } | 4507 } |
4502 | 4508 |
4503 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4509 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4504 force_disable_overscroll_content_ = force_disable; | 4510 force_disable_overscroll_content_ = force_disable; |
4505 if (view_) | 4511 if (view_) |
4506 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4512 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4507 } | 4513 } |
4508 | 4514 |
4509 } // namespace content | 4515 } // namespace content |
OLD | NEW |