Commit d781c58a authored by Simeon Anfinrud's avatar Simeon Anfinrud Committed by Commit Bot

[Chromecast] Remove protected fields from CastService.

Classes that derive from this can choose to store these pointers
in private members, initialized at construction.

Merge-With: eureka-internal/480348

Bug: Internal b/138199589
Test: Build internal chromecast binaries and tests
Change-Id: I84723d6d298c9453d43c92ffd9f05b136d774b43
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2518715
Auto-Submit: Simeon Anfinrud <sanfin@chromium.org>
Commit-Queue: Luke Halliwell (slow) <halliwell@chromium.org>
Reviewed-by: default avatarLuke Halliwell (slow) <halliwell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#824179}
parent ba05b80c
...@@ -198,8 +198,7 @@ std::unique_ptr<CastService> CastContentBrowserClient::CreateCastService( ...@@ -198,8 +198,7 @@ std::unique_ptr<CastService> CastContentBrowserClient::CreateCastService(
PrefService* pref_service, PrefService* pref_service,
media::VideoPlaneController* video_plane_controller, media::VideoPlaneController* video_plane_controller,
CastWindowManager* window_manager) { CastWindowManager* window_manager) {
return std::make_unique<CastServiceSimple>(browser_context, pref_service, return std::make_unique<CastServiceSimple>(browser_context, window_manager);
window_manager);
} }
media::VideoModeSwitcher* CastContentBrowserClient::GetVideoModeSwitcher() { media::VideoModeSwitcher* CastContentBrowserClient::GetVideoModeSwitcher() {
......
...@@ -40,10 +40,8 @@ GURL GetStartupURL() { ...@@ -40,10 +40,8 @@ GURL GetStartupURL() {
} // namespace } // namespace
CastServiceSimple::CastServiceSimple(content::BrowserContext* browser_context, CastServiceSimple::CastServiceSimple(content::BrowserContext* browser_context,
PrefService* pref_service,
CastWindowManager* window_manager) CastWindowManager* window_manager)
: CastService(browser_context, pref_service), : web_view_factory_(std::make_unique<CastWebViewFactory>(browser_context)),
web_view_factory_(std::make_unique<CastWebViewFactory>(browser_context)),
web_service_(std::make_unique<CastWebService>(browser_context, web_service_(std::make_unique<CastWebService>(browser_context,
web_view_factory_.get(), web_view_factory_.get(),
window_manager)) { window_manager)) {
......
...@@ -14,6 +14,10 @@ ...@@ -14,6 +14,10 @@
#include "chromecast/service/cast_service.h" #include "chromecast/service/cast_service.h"
#include "url/gurl.h" #include "url/gurl.h"
namespace content {
class BrowserContext;
} // namespace content
namespace chromecast { namespace chromecast {
class CastWebService; class CastWebService;
...@@ -25,7 +29,6 @@ namespace shell { ...@@ -25,7 +29,6 @@ namespace shell {
class CastServiceSimple : public CastService, public CastWebView::Delegate { class CastServiceSimple : public CastService, public CastWebView::Delegate {
public: public:
CastServiceSimple(content::BrowserContext* browser_context, CastServiceSimple(content::BrowserContext* browser_context,
PrefService* pref_service,
CastWindowManager* window_manager); CastWindowManager* window_manager);
~CastServiceSimple() override; ~CastServiceSimple() override;
......
...@@ -11,14 +11,8 @@ ...@@ -11,14 +11,8 @@
namespace chromecast { namespace chromecast {
CastService::CastService( CastService::CastService()
content::BrowserContext* browser_context, : stopped_(true), thread_checker_(new base::ThreadChecker()) {}
PrefService* pref_service)
: browser_context_(browser_context),
pref_service_(pref_service),
stopped_(true),
thread_checker_(new base::ThreadChecker()) {
}
CastService::~CastService() { CastService::~CastService() {
DCHECK(thread_checker_->CalledOnValidThread()); DCHECK(thread_checker_->CalledOnValidThread());
......
...@@ -10,16 +10,10 @@ ...@@ -10,16 +10,10 @@
#include "base/callback.h" #include "base/callback.h"
#include "base/macros.h" #include "base/macros.h"
class PrefService;
namespace base { namespace base {
class ThreadChecker; class ThreadChecker;
} }
namespace content {
class BrowserContext;
}
namespace chromecast { namespace chromecast {
class CastService { class CastService {
...@@ -38,8 +32,7 @@ class CastService { ...@@ -38,8 +32,7 @@ class CastService {
virtual void AccessibilityStateChanged(bool enabled); virtual void AccessibilityStateChanged(bool enabled);
protected: protected:
CastService(content::BrowserContext* browser_context, CastService();
PrefService* pref_service);
// Implementation-specific initialization. Initialization of cast service's // Implementation-specific initialization. Initialization of cast service's
// sub-components, and anything that requires IO operations should go here. // sub-components, and anything that requires IO operations should go here.
...@@ -60,12 +53,7 @@ class CastService { ...@@ -60,12 +53,7 @@ class CastService {
// StartInternal() should be finalized here. // StartInternal() should be finalized here.
virtual void StopInternal() = 0; virtual void StopInternal() = 0;
content::BrowserContext* browser_context() const { return browser_context_; }
PrefService* pref_service() const { return pref_service_; }
private: private:
content::BrowserContext* const browser_context_;
PrefService* const pref_service_;
bool stopped_; bool stopped_;
const std::unique_ptr<base::ThreadChecker> thread_checker_; const std::unique_ptr<base::ThreadChecker> thread_checker_;
......
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