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

Side by Side Diff: chrome/renderer/chrome_content_renderer_client.cc

Issue 1015023002: Plugin Power Saver: Throttle 'large' plugins that appear small. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
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 "chrome/renderer/chrome_content_renderer_client.h" 5 #include "chrome/renderer/chrome_content_renderer_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/crash_logging.h" 8 #include "base/debug/crash_logging.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 status_value = 789 status_value =
790 ChromeViewHostMsg_GetPluginInfo_Status::kNPAPINotSupported; 790 ChromeViewHostMsg_GetPluginInfo_Status::kNPAPINotSupported;
791 } 791 }
792 #endif 792 #endif
793 793
794 auto create_blocked_plugin = 794 auto create_blocked_plugin =
795 [&render_frame, &frame, &params, &info, &identifier, &group_name]( 795 [&render_frame, &frame, &params, &info, &identifier, &group_name](
796 int template_id, const base::string16& message) { 796 int template_id, const base::string16& message) {
797 return ChromePluginPlaceholder::CreateBlockedPlugin( 797 return ChromePluginPlaceholder::CreateBlockedPlugin(
798 render_frame, frame, params, info, identifier, group_name, 798 render_frame, frame, params, info, identifier, group_name,
799 template_id, message, std::string(), GURL()); 799 template_id, message, std::string(), GURL(), 0, 0);
800 }; 800 };
801 switch (status_value) { 801 switch (status_value) {
802 case ChromeViewHostMsg_GetPluginInfo_Status::kNotFound: { 802 case ChromeViewHostMsg_GetPluginInfo_Status::kNotFound: {
803 NOTREACHED(); 803 NOTREACHED();
804 break; 804 break;
805 } 805 }
806 case ChromeViewHostMsg_GetPluginInfo_Status::kAllowed: 806 case ChromeViewHostMsg_GetPluginInfo_Status::kAllowed:
807 case ChromeViewHostMsg_GetPluginInfo_Status::kPlayImportantContent: { 807 case ChromeViewHostMsg_GetPluginInfo_Status::kPlayImportantContent: {
808 #if !defined(DISABLE_NACL) && defined(ENABLE_EXTENSIONS) 808 #if !defined(DISABLE_NACL) && defined(ENABLE_EXTENSIONS)
809 const bool is_nacl_plugin = 809 const bool is_nacl_plugin =
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 // reduce the chance of future regressions. 886 // reduce the chance of future regressions.
887 bool is_prerendering = 887 bool is_prerendering =
888 prerender::PrerenderHelper::IsPrerendering(render_frame); 888 prerender::PrerenderHelper::IsPrerendering(render_frame);
889 if (blocked_for_background_tab || is_prerendering || 889 if (blocked_for_background_tab || is_prerendering ||
890 !poster_attribute.empty()) { 890 !poster_attribute.empty()) {
891 placeholder = ChromePluginPlaceholder::CreateBlockedPlugin( 891 placeholder = ChromePluginPlaceholder::CreateBlockedPlugin(
892 render_frame, frame, params, info, identifier, group_name, 892 render_frame, frame, params, info, identifier, group_name,
893 poster_attribute.empty() ? IDR_BLOCKED_PLUGIN_HTML 893 poster_attribute.empty() ? IDR_BLOCKED_PLUGIN_HTML
894 : IDR_PLUGIN_POSTER_HTML, 894 : IDR_PLUGIN_POSTER_HTML,
895 l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name), 895 l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name),
896 poster_attribute, frame->document().url()); 896 poster_attribute, frame->document().url(), 0, 0);
897 placeholder->set_blocked_for_background_tab( 897 placeholder->set_blocked_for_background_tab(
898 blocked_for_background_tab); 898 blocked_for_background_tab);
899 placeholder->set_blocked_for_prerendering(is_prerendering); 899 placeholder->set_blocked_for_prerendering(is_prerendering);
900 placeholder->set_power_saver_enabled(power_saver_enabled); 900 placeholder->set_power_saver_enabled(power_saver_enabled);
901 placeholder->set_allow_loading(true); 901 placeholder->set_allow_loading(true);
902 break; 902 break;
903 } 903 }
904 904
905 scoped_ptr<content::PluginInstanceThrottler> throttler = 905 scoped_ptr<content::PluginInstanceThrottler> throttler =
906 PluginInstanceThrottler::Create(power_saver_enabled); 906 PluginInstanceThrottler::Create(power_saver_enabled);
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
1658 if (mime_type == content::kBrowserPluginMimeType) { 1658 if (mime_type == content::kBrowserPluginMimeType) {
1659 return new extensions::ExtensionsGuestViewContainer(render_frame); 1659 return new extensions::ExtensionsGuestViewContainer(render_frame);
1660 } else { 1660 } else {
1661 return new extensions::MimeHandlerViewContainer( 1661 return new extensions::MimeHandlerViewContainer(
1662 render_frame, mime_type, original_url); 1662 render_frame, mime_type, original_url);
1663 } 1663 }
1664 #else 1664 #else
1665 return NULL; 1665 return NULL;
1666 #endif 1666 #endif
1667 } 1667 }
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/plugins/chrome_plugin_placeholder.h » ('j') | chrome/renderer/plugins/plugin_preroller.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698