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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 680193002: Plugin Power Saver: Implement size-based heuristic for peripheral content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: spinoff ifdef changes into separate cl Created 6 years, 1 month 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
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/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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) 498 #if defined(ENABLE_PLUGINS)
499 IPC_MESSAGE_HANDLER(FrameHostMsg_PepperPluginHung, OnPepperPluginHung) 499 IPC_MESSAGE_HANDLER(FrameHostMsg_PepperPluginHung, OnPepperPluginHung)
500 IPC_MESSAGE_HANDLER(FrameHostMsg_PluginCrashed, OnPluginCrashed) 500 IPC_MESSAGE_HANDLER(FrameHostMsg_PluginCrashed, OnPluginCrashed)
501 IPC_MESSAGE_HANDLER(FrameHostMsg_PluginContentOriginAllowed,
502 OnPluginContentOriginAllowed)
501 #endif 503 #endif
502 IPC_MESSAGE_HANDLER(FrameHostMsg_DomOperationResponse, 504 IPC_MESSAGE_HANDLER(FrameHostMsg_DomOperationResponse,
503 OnDomOperationResponse) 505 OnDomOperationResponse)
504 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeThemeColor, 506 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeThemeColor,
505 OnThemeColorChanged) 507 OnThemeColorChanged)
506 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFinishDocumentLoad, 508 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFinishDocumentLoad,
507 OnDocumentLoadedInFrame) 509 OnDocumentLoadedInFrame)
508 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFinishLoad, OnDidFinishLoad) 510 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFinishLoad, OnDidFinishLoad)
509 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartLoading, OnDidStartLoading) 511 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartLoading, OnDidStartLoading)
510 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStopLoading, OnDidStopLoading) 512 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStopLoading, OnDidStopLoading)
(...skipping 2058 matching lines...) Expand 10 before | Expand all | Expand 10 after
2569 const LoadCommittedDetails& details, 2571 const LoadCommittedDetails& details,
2570 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { 2572 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {
2571 if (details.is_navigation_to_different_page()) { 2573 if (details.is_navigation_to_different_page()) {
2572 // Clear the status bubble. This is a workaround for a bug where WebKit 2574 // Clear the status bubble. This is a workaround for a bug where WebKit
2573 // doesn't let us know that the cursor left an element during a 2575 // doesn't let us know that the cursor left an element during a
2574 // transition (this is also why the mouse cursor remains as a hand after 2576 // transition (this is also why the mouse cursor remains as a hand after
2575 // clicking on a link); see bugs 1184641 and 980803. We don't want to 2577 // clicking on a link); see bugs 1184641 and 980803. We don't want to
2576 // clear the bubble when a user navigates to a named anchor in the same 2578 // clear the bubble when a user navigates to a named anchor in the same
2577 // page. 2579 // page.
2578 UpdateTargetURL(GURL()); 2580 UpdateTargetURL(GURL());
2581
2582 #if defined(ENABLE_PLUGINS)
2583 // Clear the tab-wide origin whitelist. We expect RenderFrames to clear
2584 // their replicated origin whitelist independently.
2585 plugin_content_origin_whitelist_.clear();
2586 #endif
2579 } 2587 }
2580 2588
2581 if (!details.is_in_page) { 2589 if (!details.is_in_page) {
2582 // Once the main frame is navigated, we're no longer considered to have 2590 // Once the main frame is navigated, we're no longer considered to have
2583 // displayed insecure content. 2591 // displayed insecure content.
2584 displayed_insecure_content_ = false; 2592 displayed_insecure_content_ = false;
2585 SSLManager::NotifySSLInternalStateChanged( 2593 SSLManager::NotifySSLInternalStateChanged(
2586 GetController().GetBrowserContext()); 2594 GetController().GetBrowserContext());
2587 } 2595 }
2588 2596
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
2900 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 2908 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
2901 PluginHungStatusChanged(plugin_child_id, path, is_hung)); 2909 PluginHungStatusChanged(plugin_child_id, path, is_hung));
2902 } 2910 }
2903 2911
2904 void WebContentsImpl::OnPluginCrashed(const base::FilePath& plugin_path, 2912 void WebContentsImpl::OnPluginCrashed(const base::FilePath& plugin_path,
2905 base::ProcessId plugin_pid) { 2913 base::ProcessId plugin_pid) {
2906 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 2914 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
2907 PluginCrashed(plugin_path, plugin_pid)); 2915 PluginCrashed(plugin_path, plugin_pid));
2908 } 2916 }
2909 2917
2918 void WebContentsImpl::OnPluginContentOriginAllowed(const GURL& content_origin) {
2919 DCHECK(render_frame_message_source_);
2920 DCHECK(!render_view_message_source_);
2921
2922 plugin_content_origin_whitelist_.insert(content_origin);
2923
2924 SendToAllFrames(new FrameMsg_UpdatePluginContentOriginWhitelist(
2925 MSG_ROUTING_NONE, plugin_content_origin_whitelist_));
2926 }
2910 #endif // defined(ENABLE_PLUGINS) 2927 #endif // defined(ENABLE_PLUGINS)
2911 2928
2912 void WebContentsImpl::OnDomOperationResponse(const std::string& json_string, 2929 void WebContentsImpl::OnDomOperationResponse(const std::string& json_string,
2913 int automation_id) { 2930 int automation_id) {
2914 DomOperationNotificationDetails details(json_string, automation_id); 2931 DomOperationNotificationDetails details(json_string, automation_id);
2915 NotificationService::current()->Notify( 2932 NotificationService::current()->Notify(
2916 NOTIFICATION_DOM_OPERATION_RESPONSE, 2933 NOTIFICATION_DOM_OPERATION_RESPONSE,
2917 Source<WebContents>(this), 2934 Source<WebContents>(this),
2918 Details<DomOperationNotificationDetails>(&details)); 2935 Details<DomOperationNotificationDetails>(&details));
2919 } 2936 }
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
3335 return GetLastCommittedURL(); 3352 return GetLastCommittedURL();
3336 } 3353 }
3337 3354
3338 void WebContentsImpl::RenderFrameCreated(RenderFrameHost* render_frame_host) { 3355 void WebContentsImpl::RenderFrameCreated(RenderFrameHost* render_frame_host) {
3339 // Note this is only for subframes, the notification for the main frame 3356 // Note this is only for subframes, the notification for the main frame
3340 // happens in RenderViewCreated. 3357 // happens in RenderViewCreated.
3341 FOR_EACH_OBSERVER(WebContentsObserver, 3358 FOR_EACH_OBSERVER(WebContentsObserver,
3342 observers_, 3359 observers_,
3343 RenderFrameCreated(render_frame_host)); 3360 RenderFrameCreated(render_frame_host));
3344 SetAccessibilityModeOnFrame(accessibility_mode_, render_frame_host); 3361 SetAccessibilityModeOnFrame(accessibility_mode_, render_frame_host);
3362
3363 #if defined(ENABLE_PLUGINS)
3364 if (!plugin_content_origin_whitelist_.empty()) {
Charlie Reis 2014/10/30 22:13:16 This feels like it belongs in a WebContentsObserve
tommycli 2014/10/31 00:01:21 Done.
3365 Send(new FrameMsg_UpdatePluginContentOriginWhitelist(
3366 render_frame_host->GetRoutingID(), plugin_content_origin_whitelist_));
3367 }
3368 #endif
3345 } 3369 }
3346 3370
3347 void WebContentsImpl::RenderFrameDeleted(RenderFrameHost* render_frame_host) { 3371 void WebContentsImpl::RenderFrameDeleted(RenderFrameHost* render_frame_host) {
3348 ClearPowerSaveBlockers(render_frame_host); 3372 ClearPowerSaveBlockers(render_frame_host);
3349 FOR_EACH_OBSERVER(WebContentsObserver, 3373 FOR_EACH_OBSERVER(WebContentsObserver,
3350 observers_, 3374 observers_,
3351 RenderFrameDeleted(render_frame_host)); 3375 RenderFrameDeleted(render_frame_host));
3352 } 3376 }
3353 3377
3354 void WebContentsImpl::WorkerCrashed(RenderFrameHost* render_frame_host) { 3378 void WebContentsImpl::WorkerCrashed(RenderFrameHost* render_frame_host) {
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after
4335 node->render_manager()->ResumeResponseDeferredAtStart(); 4359 node->render_manager()->ResumeResponseDeferredAtStart();
4336 } 4360 }
4337 4361
4338 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { 4362 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4339 force_disable_overscroll_content_ = force_disable; 4363 force_disable_overscroll_content_ = force_disable;
4340 if (view_) 4364 if (view_)
4341 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 4365 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4342 } 4366 }
4343 4367
4344 } // namespace content 4368 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698