Commit 5e3e1a5e authored by gunsch's avatar gunsch Committed by Commit bot

Chromecast: use CastContent{Browser,Renderer}Client as a base class.

This will allow consolidating many current "link-time" implementations
into virtual methods in our ContentClient classes, which should both
provide increased clarity and eliminate frequent internal build breaks
due to lag between a new public feature and matching internal CLs.

See discussion on https://codereview.chromium.org/1168643004/.

R=halliwell@chromium.org,lcwu@chromium.org,byungchul@chromium.org
BUG=None

Review URL: https://codereview.chromium.org/1153173006

Cr-Commit-Position: refs/heads/master@{#333151}
parent 94e195a2
......@@ -150,13 +150,13 @@ void CastMainDelegate::InitializeResourceBundle() {
}
content::ContentBrowserClient* CastMainDelegate::CreateContentBrowserClient() {
browser_client_.reset(new CastContentBrowserClient);
browser_client_ = CastContentBrowserClient::Create();
return browser_client_.get();
}
content::ContentRendererClient*
CastMainDelegate::CreateContentRendererClient() {
renderer_client_.reset(new CastContentRendererClient);
renderer_client_ = CastContentRendererClient::Create();
return renderer_client_.get();
}
......
......@@ -42,7 +42,10 @@ class URLRequestContextFactory;
class CastContentBrowserClient: public content::ContentBrowserClient {
public:
CastContentBrowserClient();
// Creates an implementation of CastContentBrowserClient. Platform should
// link in an implementation as needed.
static scoped_ptr<CastContentBrowserClient> Create();
~CastContentBrowserClient() override;
// Appends extra command line arguments before launching a new process.
......@@ -119,6 +122,9 @@ class CastContentBrowserClient: public content::ContentBrowserClient {
content::WebContents* web_contents) override;
#endif // defined(OS_ANDROID) && defined(VIDEO_HOLE)
protected:
CastContentBrowserClient();
private:
void AddNetworkHintsMessageFilter(int render_process_id,
net::URLRequestContext* context);
......
......@@ -4,6 +4,7 @@
#include "chromecast/browser/cast_content_browser_client.h"
#include "base/memory/scoped_ptr.h"
#include "chromecast/media/cma/backend/media_pipeline_device.h"
#include "content/public/browser/browser_message_filter.h"
#include "media/audio/audio_manager_factory.h"
......@@ -11,6 +12,11 @@
namespace chromecast {
namespace shell {
// static
scoped_ptr<CastContentBrowserClient> CastContentBrowserClient::Create() {
return make_scoped_ptr(new CastContentBrowserClient());
}
void CastContentBrowserClient::PlatformAppendExtraCommandLineSwitches(
base::CommandLine* command_line) {
}
......
......@@ -27,7 +27,10 @@ void PlatformAddRendererNativeBindings(blink::WebLocalFrame* frame);
class CastContentRendererClient : public content::ContentRendererClient {
public:
CastContentRendererClient();
// Creates an implementation of CastContentRendererClient. Platform should
// link in an implementation as needed.
static scoped_ptr<CastContentRendererClient> Create();
~CastContentRendererClient() override;
// Returns any MessageFilters from the platform implementation that should
......@@ -49,6 +52,9 @@ class CastContentRendererClient : public content::ContentRendererClient {
void DeferMediaLoad(content::RenderFrame* render_frame,
const base::Closure& closure) override;
protected:
CastContentRendererClient();
private:
scoped_ptr<network_hints::PrescientNetworkingDispatcher>
prescient_networking_dispatcher_;
......
......@@ -4,11 +4,17 @@
#include "chromecast/renderer/cast_content_renderer_client.h"
#include "base/memory/scoped_ptr.h"
#include "ipc/message_filter.h"
namespace chromecast {
namespace shell {
// static
scoped_ptr<CastContentRendererClient> CastContentRendererClient::Create() {
return make_scoped_ptr(new CastContentRendererClient());
}
void PlatformAddRendererNativeBindings(blink::WebLocalFrame* frame) {
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment