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 "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 Loading... |
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" | |
101 #include "media/media_features.h" | 100 #include "media/media_features.h" |
102 #include "net/base/net_errors.h" | 101 #include "net/base/net_errors.h" |
103 #include "ppapi/c/private/ppb_pdf.h" | 102 #include "ppapi/c/private/ppb_pdf.h" |
104 #include "ppapi/features/features.h" | 103 #include "ppapi/features/features.h" |
105 #include "ppapi/shared_impl/ppapi_switches.h" | 104 #include "ppapi/shared_impl/ppapi_switches.h" |
106 #include "printing/features/features.h" | 105 #include "printing/features/features.h" |
107 #include "services/service_manager/public/cpp/connector.h" | 106 #include "services/service_manager/public/cpp/connector.h" |
108 #include "third_party/WebKit/public/platform/URLConversion.h" | 107 #include "third_party/WebKit/public/platform/URLConversion.h" |
109 #include "third_party/WebKit/public/platform/WebCache.h" | 108 #include "third_party/WebKit/public/platform/WebCache.h" |
110 #include "third_party/WebKit/public/platform/WebCachePolicy.h" | 109 #include "third_party/WebKit/public/platform/WebCachePolicy.h" |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 // Don't allow autoplay/autoload of media resources in a RenderFrame that is | 665 // Don't allow autoplay/autoload of media resources in a RenderFrame that is |
667 // hidden and has never played any media before. We want to allow future | 666 // hidden and has never played any media before. We want to allow future |
668 // loads even when hidden to allow playlist-like functionality. | 667 // loads even when hidden to allow playlist-like functionality. |
669 // | 668 // |
670 // NOTE: This is also used to defer media loading for prerender. | 669 // NOTE: This is also used to defer media loading for prerender. |
671 // NOTE: Switch can be used to allow autoplay, unless frame is prerendered. | 670 // NOTE: Switch can be used to allow autoplay, unless frame is prerendered. |
672 // | 671 // |
673 // TODO(dalecurtis): Include an idle check too. http://crbug.com/509135 | 672 // TODO(dalecurtis): Include an idle check too. http://crbug.com/509135 |
674 if ((render_frame->IsHidden() && !has_played_media_before && | 673 if ((render_frame->IsHidden() && !has_played_media_before && |
675 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 674 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
676 switches::kIgnoreAutoplayRestrictionsForTests)) || | 675 switches::kDisableGestureRequirementForMediaPlayback)) || |
677 prerender::PrerenderHelper::IsPrerendering(render_frame)) { | 676 prerender::PrerenderHelper::IsPrerendering(render_frame)) { |
678 new MediaLoadDeferrer(render_frame, closure); | 677 new MediaLoadDeferrer(render_frame, closure); |
679 return; | 678 return; |
680 } | 679 } |
681 | 680 |
682 closure.Run(); | 681 closure.Run(); |
683 } | 682 } |
684 | 683 |
685 #if BUILDFLAG(ENABLE_PLUGINS) | 684 #if BUILDFLAG(ENABLE_PLUGINS) |
686 WebPlugin* ChromeContentRendererClient::CreatePlugin( | 685 WebPlugin* ChromeContentRendererClient::CreatePlugin( |
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1552 | 1551 |
1553 RecordYouTubeRewriteUMA(result); | 1552 RecordYouTubeRewriteUMA(result); |
1554 return corrected_url.ReplaceComponents(r); | 1553 return corrected_url.ReplaceComponents(r); |
1555 } | 1554 } |
1556 | 1555 |
1557 std::unique_ptr<base::TaskScheduler::InitParams> | 1556 std::unique_ptr<base::TaskScheduler::InitParams> |
1558 ChromeContentRendererClient::GetTaskSchedulerInitParams() { | 1557 ChromeContentRendererClient::GetTaskSchedulerInitParams() { |
1559 return task_scheduler_util:: | 1558 return task_scheduler_util:: |
1560 GetRendererTaskSchedulerInitParamsFromCommandLine(); | 1559 GetRendererTaskSchedulerInitParamsFromCommandLine(); |
1561 } | 1560 } |
OLD | NEW |