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() { ...@@ -150,13 +150,13 @@ void CastMainDelegate::InitializeResourceBundle() {
} }
content::ContentBrowserClient* CastMainDelegate::CreateContentBrowserClient() { content::ContentBrowserClient* CastMainDelegate::CreateContentBrowserClient() {
browser_client_.reset(new CastContentBrowserClient); browser_client_ = CastContentBrowserClient::Create();
return browser_client_.get(); return browser_client_.get();
} }
content::ContentRendererClient* content::ContentRendererClient*
CastMainDelegate::CreateContentRendererClient() { CastMainDelegate::CreateContentRendererClient() {
renderer_client_.reset(new CastContentRendererClient); renderer_client_ = CastContentRendererClient::Create();
return renderer_client_.get(); return renderer_client_.get();
} }
......
...@@ -42,7 +42,10 @@ class URLRequestContextFactory; ...@@ -42,7 +42,10 @@ class URLRequestContextFactory;
class CastContentBrowserClient: public content::ContentBrowserClient { class CastContentBrowserClient: public content::ContentBrowserClient {
public: public:
CastContentBrowserClient(); // Creates an implementation of CastContentBrowserClient. Platform should
// link in an implementation as needed.
static scoped_ptr<CastContentBrowserClient> Create();
~CastContentBrowserClient() override; ~CastContentBrowserClient() override;
// Appends extra command line arguments before launching a new process. // Appends extra command line arguments before launching a new process.
...@@ -119,6 +122,9 @@ class CastContentBrowserClient: public content::ContentBrowserClient { ...@@ -119,6 +122,9 @@ class CastContentBrowserClient: public content::ContentBrowserClient {
content::WebContents* web_contents) override; content::WebContents* web_contents) override;
#endif // defined(OS_ANDROID) && defined(VIDEO_HOLE) #endif // defined(OS_ANDROID) && defined(VIDEO_HOLE)
protected:
CastContentBrowserClient();
private: private:
void AddNetworkHintsMessageFilter(int render_process_id, void AddNetworkHintsMessageFilter(int render_process_id,
net::URLRequestContext* context); net::URLRequestContext* context);
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "chromecast/browser/cast_content_browser_client.h" #include "chromecast/browser/cast_content_browser_client.h"
#include "base/memory/scoped_ptr.h"
#include "chromecast/media/cma/backend/media_pipeline_device.h" #include "chromecast/media/cma/backend/media_pipeline_device.h"
#include "content/public/browser/browser_message_filter.h" #include "content/public/browser/browser_message_filter.h"
#include "media/audio/audio_manager_factory.h" #include "media/audio/audio_manager_factory.h"
...@@ -11,6 +12,11 @@ ...@@ -11,6 +12,11 @@
namespace chromecast { namespace chromecast {
namespace shell { namespace shell {
// static
scoped_ptr<CastContentBrowserClient> CastContentBrowserClient::Create() {
return make_scoped_ptr(new CastContentBrowserClient());
}
void CastContentBrowserClient::PlatformAppendExtraCommandLineSwitches( void CastContentBrowserClient::PlatformAppendExtraCommandLineSwitches(
base::CommandLine* command_line) { base::CommandLine* command_line) {
} }
......
...@@ -27,7 +27,10 @@ void PlatformAddRendererNativeBindings(blink::WebLocalFrame* frame); ...@@ -27,7 +27,10 @@ void PlatformAddRendererNativeBindings(blink::WebLocalFrame* frame);
class CastContentRendererClient : public content::ContentRendererClient { class CastContentRendererClient : public content::ContentRendererClient {
public: public:
CastContentRendererClient(); // Creates an implementation of CastContentRendererClient. Platform should
// link in an implementation as needed.
static scoped_ptr<CastContentRendererClient> Create();
~CastContentRendererClient() override; ~CastContentRendererClient() override;
// Returns any MessageFilters from the platform implementation that should // Returns any MessageFilters from the platform implementation that should
...@@ -49,6 +52,9 @@ class CastContentRendererClient : public content::ContentRendererClient { ...@@ -49,6 +52,9 @@ class CastContentRendererClient : public content::ContentRendererClient {
void DeferMediaLoad(content::RenderFrame* render_frame, void DeferMediaLoad(content::RenderFrame* render_frame,
const base::Closure& closure) override; const base::Closure& closure) override;
protected:
CastContentRendererClient();
private: private:
scoped_ptr<network_hints::PrescientNetworkingDispatcher> scoped_ptr<network_hints::PrescientNetworkingDispatcher>
prescient_networking_dispatcher_; prescient_networking_dispatcher_;
......
...@@ -4,11 +4,17 @@ ...@@ -4,11 +4,17 @@
#include "chromecast/renderer/cast_content_renderer_client.h" #include "chromecast/renderer/cast_content_renderer_client.h"
#include "base/memory/scoped_ptr.h"
#include "ipc/message_filter.h" #include "ipc/message_filter.h"
namespace chromecast { namespace chromecast {
namespace shell { namespace shell {
// static
scoped_ptr<CastContentRendererClient> CastContentRendererClient::Create() {
return make_scoped_ptr(new CastContentRendererClient());
}
void PlatformAddRendererNativeBindings(blink::WebLocalFrame* frame) { 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