Chromium Code Reviews| 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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 488 // Message handlers should be aware of which | 488 // Message handlers should be aware of which |
| 489 // RenderViewHost/RenderFrameHost sent the message, which is temporarily | 489 // RenderViewHost/RenderFrameHost sent the message, which is temporarily |
| 490 // stored in render_(view|frame)_message_source_. | 490 // stored in render_(view|frame)_message_source_. |
| 491 if (render_frame_host) | 491 if (render_frame_host) |
| 492 render_frame_message_source_ = render_frame_host; | 492 render_frame_message_source_ = render_frame_host; |
| 493 else | 493 else |
| 494 render_view_message_source_ = render_view_host; | 494 render_view_message_source_ = render_view_host; |
| 495 | 495 |
| 496 bool handled = true; | 496 bool handled = true; |
| 497 IPC_BEGIN_MESSAGE_MAP(WebContentsImpl, message) | 497 IPC_BEGIN_MESSAGE_MAP(WebContentsImpl, message) |
| 498 #if defined(ENABLE_PLUGINS) | |
|
Lei Zhang
2014/10/30 21:48:54
There's already another ENABLE_PLUGINS section bel
tommycli
2014/10/30 22:37:21
Done.
| |
| 498 IPC_MESSAGE_HANDLER(FrameHostMsg_PepperPluginHung, OnPepperPluginHung) | 499 IPC_MESSAGE_HANDLER(FrameHostMsg_PepperPluginHung, OnPepperPluginHung) |
| 499 IPC_MESSAGE_HANDLER(FrameHostMsg_PluginCrashed, OnPluginCrashed) | 500 IPC_MESSAGE_HANDLER(FrameHostMsg_PluginCrashed, OnPluginCrashed) |
| 501 #endif | |
| 500 IPC_MESSAGE_HANDLER(FrameHostMsg_DomOperationResponse, | 502 IPC_MESSAGE_HANDLER(FrameHostMsg_DomOperationResponse, |
| 501 OnDomOperationResponse) | 503 OnDomOperationResponse) |
| 502 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeThemeColor, | 504 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeThemeColor, |
| 503 OnThemeColorChanged) | 505 OnThemeColorChanged) |
| 504 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFinishDocumentLoad, | 506 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFinishDocumentLoad, |
| 505 OnDocumentLoadedInFrame) | 507 OnDocumentLoadedInFrame) |
| 506 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFinishLoad, OnDidFinishLoad) | 508 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFinishLoad, OnDidFinishLoad) |
| 507 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartLoading, OnDidStartLoading) | 509 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartLoading, OnDidStartLoading) |
| 508 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStopLoading, OnDidStopLoading) | 510 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStopLoading, OnDidStopLoading) |
| 509 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeLoadProgress, | 511 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeLoadProgress, |
| (...skipping 2370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2880 const ViewHostMsg_DateTimeDialogValue_Params& value) { | 2882 const ViewHostMsg_DateTimeDialogValue_Params& value) { |
| 2881 date_time_chooser_->ShowDialog(ContentViewCore::FromWebContents(this), | 2883 date_time_chooser_->ShowDialog(ContentViewCore::FromWebContents(this), |
| 2882 GetRenderViewHost(), | 2884 GetRenderViewHost(), |
| 2883 value.dialog_type, | 2885 value.dialog_type, |
| 2884 value.dialog_value, | 2886 value.dialog_value, |
| 2885 value.minimum, | 2887 value.minimum, |
| 2886 value.maximum, | 2888 value.maximum, |
| 2887 value.step, | 2889 value.step, |
| 2888 value.suggestions); | 2890 value.suggestions); |
| 2889 } | 2891 } |
| 2890 | |
| 2891 #endif | 2892 #endif |
| 2892 | 2893 |
| 2894 #if defined(ENABLE_PLUGINS) | |
| 2893 void WebContentsImpl::OnPepperPluginHung(int plugin_child_id, | 2895 void WebContentsImpl::OnPepperPluginHung(int plugin_child_id, |
| 2894 const base::FilePath& path, | 2896 const base::FilePath& path, |
| 2895 bool is_hung) { | 2897 bool is_hung) { |
| 2896 UMA_HISTOGRAM_COUNTS("Pepper.PluginHung", 1); | 2898 UMA_HISTOGRAM_COUNTS("Pepper.PluginHung", 1); |
| 2897 | 2899 |
| 2898 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2900 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 2899 PluginHungStatusChanged(plugin_child_id, path, is_hung)); | 2901 PluginHungStatusChanged(plugin_child_id, path, is_hung)); |
| 2900 } | 2902 } |
| 2901 | 2903 |
| 2902 void WebContentsImpl::OnPluginCrashed(const base::FilePath& plugin_path, | 2904 void WebContentsImpl::OnPluginCrashed(const base::FilePath& plugin_path, |
| 2903 base::ProcessId plugin_pid) { | 2905 base::ProcessId plugin_pid) { |
| 2904 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2906 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 2905 PluginCrashed(plugin_path, plugin_pid)); | 2907 PluginCrashed(plugin_path, plugin_pid)); |
| 2906 } | 2908 } |
| 2907 | 2909 |
| 2910 #endif // defined(ENABLE_PLUGINS) | |
| 2911 | |
| 2908 void WebContentsImpl::OnDomOperationResponse(const std::string& json_string, | 2912 void WebContentsImpl::OnDomOperationResponse(const std::string& json_string, |
| 2909 int automation_id) { | 2913 int automation_id) { |
| 2910 DomOperationNotificationDetails details(json_string, automation_id); | 2914 DomOperationNotificationDetails details(json_string, automation_id); |
| 2911 NotificationService::current()->Notify( | 2915 NotificationService::current()->Notify( |
| 2912 NOTIFICATION_DOM_OPERATION_RESPONSE, | 2916 NOTIFICATION_DOM_OPERATION_RESPONSE, |
| 2913 Source<WebContents>(this), | 2917 Source<WebContents>(this), |
| 2914 Details<DomOperationNotificationDetails>(&details)); | 2918 Details<DomOperationNotificationDetails>(&details)); |
| 2915 } | 2919 } |
| 2916 | 2920 |
| 2917 void WebContentsImpl::OnAppCacheAccessed(const GURL& manifest_url, | 2921 void WebContentsImpl::OnAppCacheAccessed(const GURL& manifest_url, |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2989 void WebContentsImpl::OnBrowserPluginMessage(const IPC::Message& message) { | 2993 void WebContentsImpl::OnBrowserPluginMessage(const IPC::Message& message) { |
| 2990 // This creates a BrowserPluginEmbedder, which handles all the BrowserPlugin | 2994 // This creates a BrowserPluginEmbedder, which handles all the BrowserPlugin |
| 2991 // specific messages for this WebContents. This means that any message from | 2995 // specific messages for this WebContents. This means that any message from |
| 2992 // a BrowserPlugin prior to this will be ignored. | 2996 // a BrowserPlugin prior to this will be ignored. |
| 2993 // For more info, see comment above classes BrowserPluginEmbedder and | 2997 // For more info, see comment above classes BrowserPluginEmbedder and |
| 2994 // BrowserPluginGuest. | 2998 // BrowserPluginGuest. |
| 2995 CHECK(!browser_plugin_embedder_.get()); | 2999 CHECK(!browser_plugin_embedder_.get()); |
| 2996 browser_plugin_embedder_.reset(BrowserPluginEmbedder::Create(this)); | 3000 browser_plugin_embedder_.reset(BrowserPluginEmbedder::Create(this)); |
| 2997 browser_plugin_embedder_->OnMessageReceived(message); | 3001 browser_plugin_embedder_->OnMessageReceived(message); |
| 2998 } | 3002 } |
| 2999 #endif | 3003 #endif // defined(ENABLE_PLUGINS) |
| 3000 | 3004 |
| 3001 void WebContentsImpl::OnDidDownloadImage( | 3005 void WebContentsImpl::OnDidDownloadImage( |
| 3002 int id, | 3006 int id, |
| 3003 int http_status_code, | 3007 int http_status_code, |
| 3004 const GURL& image_url, | 3008 const GURL& image_url, |
| 3005 const std::vector<SkBitmap>& bitmaps, | 3009 const std::vector<SkBitmap>& bitmaps, |
| 3006 const std::vector<gfx::Size>& original_bitmap_sizes) { | 3010 const std::vector<gfx::Size>& original_bitmap_sizes) { |
| 3007 if (bitmaps.size() != original_bitmap_sizes.size()) | 3011 if (bitmaps.size() != original_bitmap_sizes.size()) |
| 3008 return; | 3012 return; |
| 3009 | 3013 |
| (...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4331 node->render_manager()->ResumeResponseDeferredAtStart(); | 4335 node->render_manager()->ResumeResponseDeferredAtStart(); |
| 4332 } | 4336 } |
| 4333 | 4337 |
| 4334 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4338 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
| 4335 force_disable_overscroll_content_ = force_disable; | 4339 force_disable_overscroll_content_ = force_disable; |
| 4336 if (view_) | 4340 if (view_) |
| 4337 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4341 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 4338 } | 4342 } |
| 4339 | 4343 |
| 4340 } // namespace content | 4344 } // namespace content |
| OLD | NEW |