| 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 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 // stored in render_(view|frame)_message_source_. | 486 // stored in render_(view|frame)_message_source_. |
| 487 if (render_frame_host) | 487 if (render_frame_host) |
| 488 render_frame_message_source_ = render_frame_host; | 488 render_frame_message_source_ = render_frame_host; |
| 489 else | 489 else |
| 490 render_view_message_source_ = render_view_host; | 490 render_view_message_source_ = render_view_host; |
| 491 | 491 |
| 492 bool handled = true; | 492 bool handled = true; |
| 493 IPC_BEGIN_MESSAGE_MAP(WebContentsImpl, message) | 493 IPC_BEGIN_MESSAGE_MAP(WebContentsImpl, message) |
| 494 IPC_MESSAGE_HANDLER(FrameHostMsg_PepperPluginHung, OnPepperPluginHung) | 494 IPC_MESSAGE_HANDLER(FrameHostMsg_PepperPluginHung, OnPepperPluginHung) |
| 495 IPC_MESSAGE_HANDLER(FrameHostMsg_PluginCrashed, OnPluginCrashed) | 495 IPC_MESSAGE_HANDLER(FrameHostMsg_PluginCrashed, OnPluginCrashed) |
| 496 IPC_MESSAGE_HANDLER(FrameHostMsg_PluginContentOriginAllowed, |
| 497 OnPluginContentOriginAllowed) |
| 496 IPC_MESSAGE_HANDLER(FrameHostMsg_DomOperationResponse, | 498 IPC_MESSAGE_HANDLER(FrameHostMsg_DomOperationResponse, |
| 497 OnDomOperationResponse) | 499 OnDomOperationResponse) |
| 498 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeThemeColor, | 500 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeThemeColor, |
| 499 OnThemeColorChanged) | 501 OnThemeColorChanged) |
| 500 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFinishDocumentLoad, | 502 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFinishDocumentLoad, |
| 501 OnDocumentLoadedInFrame) | 503 OnDocumentLoadedInFrame) |
| 502 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFinishLoad, OnDidFinishLoad) | 504 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFinishLoad, OnDidFinishLoad) |
| 503 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartLoading, OnDidStartLoading) | 505 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartLoading, OnDidStartLoading) |
| 504 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStopLoading, OnDidStopLoading) | 506 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStopLoading, OnDidStopLoading) |
| 505 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeLoadProgress, | 507 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeLoadProgress, |
| (...skipping 2055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2561 const LoadCommittedDetails& details, | 2563 const LoadCommittedDetails& details, |
| 2562 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { | 2564 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { |
| 2563 if (details.is_navigation_to_different_page()) { | 2565 if (details.is_navigation_to_different_page()) { |
| 2564 // Clear the status bubble. This is a workaround for a bug where WebKit | 2566 // Clear the status bubble. This is a workaround for a bug where WebKit |
| 2565 // doesn't let us know that the cursor left an element during a | 2567 // doesn't let us know that the cursor left an element during a |
| 2566 // transition (this is also why the mouse cursor remains as a hand after | 2568 // transition (this is also why the mouse cursor remains as a hand after |
| 2567 // clicking on a link); see bugs 1184641 and 980803. We don't want to | 2569 // clicking on a link); see bugs 1184641 and 980803. We don't want to |
| 2568 // clear the bubble when a user navigates to a named anchor in the same | 2570 // clear the bubble when a user navigates to a named anchor in the same |
| 2569 // page. | 2571 // page. |
| 2570 UpdateTargetURL(GURL()); | 2572 UpdateTargetURL(GURL()); |
| 2573 |
| 2574 // Clear the tab-wide origin whitelist. We expect RenderFrames to clear |
| 2575 // their replicated origin whitelist independently. |
| 2576 plugin_content_origin_whitelist_.clear(); |
| 2571 } | 2577 } |
| 2572 | 2578 |
| 2573 if (!details.is_in_page) { | 2579 if (!details.is_in_page) { |
| 2574 // Once the main frame is navigated, we're no longer considered to have | 2580 // Once the main frame is navigated, we're no longer considered to have |
| 2575 // displayed insecure content. | 2581 // displayed insecure content. |
| 2576 displayed_insecure_content_ = false; | 2582 displayed_insecure_content_ = false; |
| 2577 SSLManager::NotifySSLInternalStateChanged( | 2583 SSLManager::NotifySSLInternalStateChanged( |
| 2578 GetController().GetBrowserContext()); | 2584 GetController().GetBrowserContext()); |
| 2579 } | 2585 } |
| 2580 | 2586 |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2892 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2898 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 2893 PluginHungStatusChanged(plugin_child_id, path, is_hung)); | 2899 PluginHungStatusChanged(plugin_child_id, path, is_hung)); |
| 2894 } | 2900 } |
| 2895 | 2901 |
| 2896 void WebContentsImpl::OnPluginCrashed(const base::FilePath& plugin_path, | 2902 void WebContentsImpl::OnPluginCrashed(const base::FilePath& plugin_path, |
| 2897 base::ProcessId plugin_pid) { | 2903 base::ProcessId plugin_pid) { |
| 2898 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2904 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 2899 PluginCrashed(plugin_path, plugin_pid)); | 2905 PluginCrashed(plugin_path, plugin_pid)); |
| 2900 } | 2906 } |
| 2901 | 2907 |
| 2908 void WebContentsImpl::OnPluginContentOriginAllowed(const GURL& content_origin) { |
| 2909 DCHECK(render_frame_message_source_); |
| 2910 DCHECK(!render_view_message_source_); |
| 2911 |
| 2912 plugin_content_origin_whitelist_.insert(content_origin); |
| 2913 |
| 2914 SendToAllFrames(new FrameMsg_UpdatePluginContentOriginWhitelist( |
| 2915 MSG_ROUTING_NONE, plugin_content_origin_whitelist_)); |
| 2916 } |
| 2917 |
| 2902 void WebContentsImpl::OnDomOperationResponse(const std::string& json_string, | 2918 void WebContentsImpl::OnDomOperationResponse(const std::string& json_string, |
| 2903 int automation_id) { | 2919 int automation_id) { |
| 2904 DomOperationNotificationDetails details(json_string, automation_id); | 2920 DomOperationNotificationDetails details(json_string, automation_id); |
| 2905 NotificationService::current()->Notify( | 2921 NotificationService::current()->Notify( |
| 2906 NOTIFICATION_DOM_OPERATION_RESPONSE, | 2922 NOTIFICATION_DOM_OPERATION_RESPONSE, |
| 2907 Source<WebContents>(this), | 2923 Source<WebContents>(this), |
| 2908 Details<DomOperationNotificationDetails>(&details)); | 2924 Details<DomOperationNotificationDetails>(&details)); |
| 2909 } | 2925 } |
| 2910 | 2926 |
| 2911 void WebContentsImpl::OnAppCacheAccessed(const GURL& manifest_url, | 2927 void WebContentsImpl::OnAppCacheAccessed(const GURL& manifest_url, |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3325 return GetLastCommittedURL(); | 3341 return GetLastCommittedURL(); |
| 3326 } | 3342 } |
| 3327 | 3343 |
| 3328 void WebContentsImpl::RenderFrameCreated(RenderFrameHost* render_frame_host) { | 3344 void WebContentsImpl::RenderFrameCreated(RenderFrameHost* render_frame_host) { |
| 3329 // Note this is only for subframes, the notification for the main frame | 3345 // Note this is only for subframes, the notification for the main frame |
| 3330 // happens in RenderViewCreated. | 3346 // happens in RenderViewCreated. |
| 3331 FOR_EACH_OBSERVER(WebContentsObserver, | 3347 FOR_EACH_OBSERVER(WebContentsObserver, |
| 3332 observers_, | 3348 observers_, |
| 3333 RenderFrameCreated(render_frame_host)); | 3349 RenderFrameCreated(render_frame_host)); |
| 3334 SetAccessibilityModeOnFrame(accessibility_mode_, render_frame_host); | 3350 SetAccessibilityModeOnFrame(accessibility_mode_, render_frame_host); |
| 3351 |
| 3352 if (!plugin_content_origin_whitelist_.empty()) { |
| 3353 Send(new FrameMsg_UpdatePluginContentOriginWhitelist( |
| 3354 render_frame_host->GetRoutingID(), plugin_content_origin_whitelist_)); |
| 3355 } |
| 3335 } | 3356 } |
| 3336 | 3357 |
| 3337 void WebContentsImpl::RenderFrameDeleted(RenderFrameHost* render_frame_host) { | 3358 void WebContentsImpl::RenderFrameDeleted(RenderFrameHost* render_frame_host) { |
| 3338 ClearPowerSaveBlockers(render_frame_host); | 3359 ClearPowerSaveBlockers(render_frame_host); |
| 3360 |
| 3339 FOR_EACH_OBSERVER(WebContentsObserver, | 3361 FOR_EACH_OBSERVER(WebContentsObserver, |
| 3340 observers_, | 3362 observers_, |
| 3341 RenderFrameDeleted(render_frame_host)); | 3363 RenderFrameDeleted(render_frame_host)); |
| 3342 } | 3364 } |
| 3343 | 3365 |
| 3344 void WebContentsImpl::WorkerCrashed(RenderFrameHost* render_frame_host) { | 3366 void WebContentsImpl::WorkerCrashed(RenderFrameHost* render_frame_host) { |
| 3345 if (delegate_) | 3367 if (delegate_) |
| 3346 delegate_->WorkerCrashed(this); | 3368 delegate_->WorkerCrashed(this); |
| 3347 } | 3369 } |
| 3348 | 3370 |
| (...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4325 node->render_manager()->ResumeResponseDeferredAtStart(); | 4347 node->render_manager()->ResumeResponseDeferredAtStart(); |
| 4326 } | 4348 } |
| 4327 | 4349 |
| 4328 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4350 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
| 4329 force_disable_overscroll_content_ = force_disable; | 4351 force_disable_overscroll_content_ = force_disable; |
| 4330 if (view_) | 4352 if (view_) |
| 4331 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4353 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 4332 } | 4354 } |
| 4333 | 4355 |
| 4334 } // namespace content | 4356 } // namespace content |
| OLD | NEW |