-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upstream Cast Runtime Code to Chromium
This CL makes the following changes: - Upstream Cast Runtime code from Chromecast Internal to Chromium. - Upstream cors_exempt_headers.cc / .h to Chromium. These provide a list of existing headers which pre-date CORS preflight check support in HTTP servers. - Modify //chromecast/cast_core/cast_runtime_service interface to change all methods from non-pure-virtual to have empty implementations to simplify existing and upcoming code. This class acts as the singleton implementation of CastService when running the cast runtime executable - Add CastRuntimeContentBrowserClient (to act as the top-level browser-process integration point for the Cast Runtime) and the CastRuntimeMain to act as the entry point for this executable. - Rework existing //chromecast/cast_core classes to support the newly upstreamed code. This is required for E2E testing of the Cast Runtime's Mirroring implementation. Change-Id: I8bf9983860561d7d526a2b4ab23893a2169c08f8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2956889 Reviewed-by: Brandon Tolsch <btolsch@chromium.org> Reviewed-by: Yuchen Liu <yucliu@chromium.org> Commit-Queue: Ryan Keane <rwkeane@google.com> Cr-Commit-Position: refs/heads/master@{#892282}
- Loading branch information
Ryan Keane
authored and
Chromium LUCI CQ
committed
Jun 14, 2021
1 parent
416e97e
commit 0781701
Showing
15 changed files
with
339 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
chromecast/cast_core/cast_runtime_content_browser_client.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright 2021 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "chromecast/cast_core/cast_runtime_content_browser_client.h" | ||
|
||
#include "chromecast/browser/service_manager_connection.h" | ||
#include "chromecast/cast_core/cast_runtime_service.h" | ||
#include "chromecast/common/cors_exempt_headers.h" | ||
|
||
namespace chromecast { | ||
namespace shell { | ||
namespace { | ||
|
||
constexpr char kAcceptLanguageHeader[] = "Accept-Language"; | ||
|
||
} // namespace | ||
|
||
// static | ||
std::unique_ptr<CastContentBrowserClient> CastContentBrowserClient::Create( | ||
CastFeatureListCreator* feature_list_creator) { | ||
return CastRuntimeContentBrowserClient::Create(feature_list_creator); | ||
} | ||
|
||
// static | ||
std::vector<std::string> CastContentBrowserClient::GetCorsExemptHeadersList() { | ||
base::span<const char*> base_headers = GetLegacyCorsExemptHeaders(); | ||
std::vector<std::string> headers{base_headers.begin(), base_headers.end()}; | ||
headers.emplace_back(kAcceptLanguageHeader); | ||
return headers; | ||
} | ||
|
||
} // namespace shell | ||
|
||
CastRuntimeContentBrowserClient::CastRuntimeContentBrowserClient( | ||
CastFeatureListCreator* feature_list_creator) | ||
: shell::CastContentBrowserClient(feature_list_creator) {} | ||
|
||
CastRuntimeContentBrowserClient::~CastRuntimeContentBrowserClient() = default; | ||
|
||
std::unique_ptr<CastService> CastRuntimeContentBrowserClient::CreateCastService( | ||
content::BrowserContext* browser_context, | ||
CastSystemMemoryPressureEvaluatorAdjuster* memory_pressure_adjuster, | ||
PrefService* pref_service, | ||
media::VideoPlaneController* video_plane_controller, | ||
CastWindowManager* window_manager) { | ||
return CastRuntimeService::Create( | ||
GetMediaTaskRunner(), browser_context, window_manager, | ||
media_pipeline_backend_manager(), pref_service); | ||
} | ||
|
||
} // namespace chromecast |
35 changes: 35 additions & 0 deletions
35
chromecast/cast_core/cast_runtime_content_browser_client.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright 2021 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef CHROMECAST_CAST_CORE_CAST_RUNTIME_CONTENT_BROWSER_CLIENT_H_ | ||
#define CHROMECAST_CAST_CORE_CAST_RUNTIME_CONTENT_BROWSER_CLIENT_H_ | ||
|
||
#include "chromecast/browser/cast_content_browser_client.h" | ||
|
||
namespace chromecast { | ||
|
||
class CastFeatureListCreator; | ||
|
||
class CastRuntimeContentBrowserClient final | ||
: public shell::CastContentBrowserClient { | ||
public: | ||
static std::unique_ptr<CastRuntimeContentBrowserClient> Create( | ||
CastFeatureListCreator* feature_list_creator); | ||
|
||
explicit CastRuntimeContentBrowserClient( | ||
CastFeatureListCreator* feature_list_creator); | ||
~CastRuntimeContentBrowserClient() override; | ||
|
||
// CastContentBrowserClient overrides: | ||
std::unique_ptr<CastService> CreateCastService( | ||
content::BrowserContext* browser_context, | ||
CastSystemMemoryPressureEvaluatorAdjuster* memory_pressure_adjuster, | ||
PrefService* pref_service, | ||
media::VideoPlaneController* video_plane_controller, | ||
CastWindowManager* window_manager) final; | ||
}; | ||
|
||
} // namespace chromecast | ||
|
||
#endif // CHROMECAST_CAST_CORE_CAST_RUNTIME_CONTENT_BROWSER_CLIENT_H_ |
17 changes: 17 additions & 0 deletions
17
chromecast/cast_core/cast_runtime_content_browser_client_simple.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright 2021 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "chromecast/cast_core/cast_runtime_content_browser_client.h" | ||
|
||
namespace chromecast { | ||
|
||
// static | ||
std::unique_ptr<CastRuntimeContentBrowserClient> | ||
CastRuntimeContentBrowserClient::Create( | ||
CastFeatureListCreator* feature_list_creator) { | ||
return std::make_unique<CastRuntimeContentBrowserClient>( | ||
feature_list_creator); | ||
} | ||
|
||
} // namespace chromecast |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright 2021 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "chromecast/app/cast_main_delegate.h" | ||
#include "content/public/app/content_main.h" | ||
|
||
int main(int argc, const char** argv) { | ||
chromecast::shell::CastMainDelegate delegate; | ||
content::ContentMainParams params(&delegate); | ||
params.argc = argc; | ||
params.argv = argv; | ||
return content::ContentMain(params); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.