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

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

Issue 2845973005: Reland of name kDisableGestureRequirementForMediaPlayback and make it a test-only flag. (Closed)
Patch Set: Created 3 years, 7 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 <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 #include "content/public/common/service_names.mojom.h" 90 #include "content/public/common/service_names.mojom.h"
91 #include "content/public/common/url_constants.h" 91 #include "content/public/common/url_constants.h"
92 #include "content/public/renderer/plugin_instance_throttler.h" 92 #include "content/public/renderer/plugin_instance_throttler.h"
93 #include "content/public/renderer/render_frame.h" 93 #include "content/public/renderer/render_frame.h"
94 #include "content/public/renderer/render_frame_visitor.h" 94 #include "content/public/renderer/render_frame_visitor.h"
95 #include "content/public/renderer/render_thread.h" 95 #include "content/public/renderer/render_thread.h"
96 #include "content/public/renderer/render_view.h" 96 #include "content/public/renderer/render_view.h"
97 #include "extensions/common/constants.h" 97 #include "extensions/common/constants.h"
98 #include "extensions/features/features.h" 98 #include "extensions/features/features.h"
99 #include "ipc/ipc_sync_channel.h" 99 #include "ipc/ipc_sync_channel.h"
100 #include "media/base/media_switches.h"
100 #include "media/media_features.h" 101 #include "media/media_features.h"
101 #include "net/base/net_errors.h" 102 #include "net/base/net_errors.h"
102 #include "ppapi/c/private/ppb_pdf.h" 103 #include "ppapi/c/private/ppb_pdf.h"
103 #include "ppapi/features/features.h" 104 #include "ppapi/features/features.h"
104 #include "ppapi/shared_impl/ppapi_switches.h" 105 #include "ppapi/shared_impl/ppapi_switches.h"
105 #include "printing/features/features.h" 106 #include "printing/features/features.h"
106 #include "services/service_manager/public/cpp/connector.h" 107 #include "services/service_manager/public/cpp/connector.h"
107 #include "third_party/WebKit/public/platform/URLConversion.h" 108 #include "third_party/WebKit/public/platform/URLConversion.h"
108 #include "third_party/WebKit/public/platform/WebCache.h" 109 #include "third_party/WebKit/public/platform/WebCache.h"
109 #include "third_party/WebKit/public/platform/WebCachePolicy.h" 110 #include "third_party/WebKit/public/platform/WebCachePolicy.h"
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 // Don't allow autoplay/autoload of media resources in a RenderFrame that is 666 // Don't allow autoplay/autoload of media resources in a RenderFrame that is
666 // hidden and has never played any media before. We want to allow future 667 // hidden and has never played any media before. We want to allow future
667 // loads even when hidden to allow playlist-like functionality. 668 // loads even when hidden to allow playlist-like functionality.
668 // 669 //
669 // NOTE: This is also used to defer media loading for prerender. 670 // NOTE: This is also used to defer media loading for prerender.
670 // NOTE: Switch can be used to allow autoplay, unless frame is prerendered. 671 // NOTE: Switch can be used to allow autoplay, unless frame is prerendered.
671 // 672 //
672 // TODO(dalecurtis): Include an idle check too. http://crbug.com/509135 673 // TODO(dalecurtis): Include an idle check too. http://crbug.com/509135
673 if ((render_frame->IsHidden() && !has_played_media_before && 674 if ((render_frame->IsHidden() && !has_played_media_before &&
674 !base::CommandLine::ForCurrentProcess()->HasSwitch( 675 !base::CommandLine::ForCurrentProcess()->HasSwitch(
675 switches::kDisableGestureRequirementForMediaPlayback)) || 676 switches::kIgnoreAutoplayRestrictionsForTests)) ||
676 prerender::PrerenderHelper::IsPrerendering(render_frame)) { 677 prerender::PrerenderHelper::IsPrerendering(render_frame)) {
677 new MediaLoadDeferrer(render_frame, closure); 678 new MediaLoadDeferrer(render_frame, closure);
678 return; 679 return;
679 } 680 }
680 681
681 closure.Run(); 682 closure.Run();
682 } 683 }
683 684
684 #if BUILDFLAG(ENABLE_PLUGINS) 685 #if BUILDFLAG(ENABLE_PLUGINS)
685 WebPlugin* ChromeContentRendererClient::CreatePlugin( 686 WebPlugin* ChromeContentRendererClient::CreatePlugin(
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 1552
1552 RecordYouTubeRewriteUMA(result); 1553 RecordYouTubeRewriteUMA(result);
1553 return corrected_url.ReplaceComponents(r); 1554 return corrected_url.ReplaceComponents(r);
1554 } 1555 }
1555 1556
1556 std::unique_ptr<base::TaskScheduler::InitParams> 1557 std::unique_ptr<base::TaskScheduler::InitParams>
1557 ChromeContentRendererClient::GetTaskSchedulerInitParams() { 1558 ChromeContentRendererClient::GetTaskSchedulerInitParams() {
1558 return task_scheduler_util:: 1559 return task_scheduler_util::
1559 GetRendererTaskSchedulerInitParamsFromCommandLine(); 1560 GetRendererTaskSchedulerInitParamsFromCommandLine();
1560 } 1561 }
OLDNEW
« no previous file with comments | « chrome/browser/media/encrypted_media_browsertest.cc ('k') | chromecast/browser/cast_browser_main_parts.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698