Commit 74a6aa5b authored by Chrome Cunningham's avatar Chrome Cunningham Committed by Commit Bot

Revert "[Kaleidoscope] Add native parts to OSS repo"

This reverts commit 30e7e503.

Reason for revert: Broke https://ci.chromium.org/p/chrome/builders/ci/win64-chrome/3694

Original change's description:
> [Kaleidoscope] Add native parts to OSS repo
> 
> Add the Kaleidoscope native parts to the OSS repo.
> 
> BUG=1044741
> 
> Change-Id: I8562c8e35db2d1fa0ef8ce140ddbbc57ca7a9991
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2255563
> Commit-Queue: Becca Hughes <beccahughes@chromium.org>
> Reviewed-by: Samuel Huang <huangs@chromium.org>
> Reviewed-by: Elly Fong-Jones <ellyjones@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Reviewed-by: Tommy Steimel <steimel@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#782073}

TBR=ellyjones@chromium.org,dcheng@chromium.org,huangs@chromium.org,beccahughes@chromium.org,steimel@chromium.org

Change-Id: I534b8281aabb88bcf9af7f56881e297eaa1efb98
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1044741, 1099007
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2264589Reviewed-by: default avatarChrome Cunningham <chcunningham@chromium.org>
Commit-Queue: Chrome Cunningham <chcunningham@chromium.org>
Cr-Commit-Position: refs/heads/master@{#782078}
parent 41fb74f9
...@@ -3192,16 +3192,6 @@ static_library("browser") { ...@@ -3192,16 +3192,6 @@ static_library("browser") {
"media/feeds/media_feeds_service.h", "media/feeds/media_feeds_service.h",
"media/feeds/media_feeds_service_factory.cc", "media/feeds/media_feeds_service_factory.cc",
"media/feeds/media_feeds_service_factory.h", "media/feeds/media_feeds_service_factory.h",
"media/kaleidoscope/constants.cc",
"media/kaleidoscope/constants.h",
"media/kaleidoscope/kaleidoscope_data_provider_impl.cc",
"media/kaleidoscope/kaleidoscope_data_provider_impl.h",
"media/kaleidoscope/kaleidoscope_tab_helper.cc",
"media/kaleidoscope/kaleidoscope_tab_helper.h",
"media/kaleidoscope/kaleidoscope_ui.cc",
"media/kaleidoscope/kaleidoscope_ui.h",
"media/kaleidoscope/switches.cc",
"media/kaleidoscope/switches.h",
"media/unified_autoplay_config.cc", "media/unified_autoplay_config.cc",
"media/unified_autoplay_config.h", "media/unified_autoplay_config.h",
"media/webrtc/desktop_capture_devices_util.cc", "media/webrtc/desktop_capture_devices_util.cc",
...@@ -3704,7 +3694,6 @@ static_library("browser") { ...@@ -3704,7 +3694,6 @@ static_library("browser") {
"//base/util/memory_pressure", "//base/util/memory_pressure",
"//base/util/timer", "//base/util/timer",
"//chrome/app/vector_icons", "//chrome/app/vector_icons",
"//chrome/browser/media/kaleidoscope/mojom",
"//chrome/browser/nearby_sharing/logging", "//chrome/browser/nearby_sharing/logging",
"//chrome/browser/nearby_sharing/proto", "//chrome/browser/nearby_sharing/proto",
"//chrome/browser/policy:path_parser", "//chrome/browser/policy:path_parser",
...@@ -4783,6 +4772,13 @@ static_library("browser") { ...@@ -4783,6 +4772,13 @@ static_library("browser") {
] ]
} }
if (enable_kaleidoscope) {
deps += [
"//chrome/browser/media/kaleidoscope/internal",
"//chrome/browser/media/kaleidoscope/internal/mojom",
]
}
if (enable_legacy_desktop_in_product_help) { if (enable_legacy_desktop_in_product_help) {
sources += [ sources += [
"feature_engagement/bookmark/bookmark_tracker.cc", "feature_engagement/bookmark/bookmark_tracker.cc",
......
...@@ -102,8 +102,6 @@ ...@@ -102,8 +102,6 @@
#include "chrome/browser/accessibility/caption_host_impl.h" #include "chrome/browser/accessibility/caption_host_impl.h"
#include "chrome/browser/badging/badge_manager.h" #include "chrome/browser/badging/badge_manager.h"
#include "chrome/browser/media/feeds/media_feeds_store.mojom.h" #include "chrome/browser/media/feeds/media_feeds_store.mojom.h"
#include "chrome/browser/media/kaleidoscope/kaleidoscope_ui.h"
#include "chrome/browser/media/kaleidoscope/mojom/kaleidoscope.mojom.h"
#include "chrome/browser/payments/payment_request_factory.h" #include "chrome/browser/payments/payment_request_factory.h"
#include "chrome/browser/speech/speech_recognition_service.h" #include "chrome/browser/speech/speech_recognition_service.h"
#include "chrome/browser/speech/speech_recognition_service_factory.h" #include "chrome/browser/speech/speech_recognition_service_factory.h"
...@@ -169,6 +167,11 @@ ...@@ -169,6 +167,11 @@
#include "extensions/common/api/mime_handler.mojom.h" // nogncheck #include "extensions/common/api/mime_handler.mojom.h" // nogncheck
#endif #endif
#if BUILDFLAG(ENABLE_KALEIDOSCOPE)
#include "chrome/browser/media/kaleidoscope/internal/kaleidoscope_ui.h"
#include "chrome/browser/media/kaleidoscope/internal/mojom/kaleidoscope.mojom.h"
#endif // BUILDFLAG(ENABLE_KALEIDOSCOPE)
namespace chrome { namespace chrome {
namespace internal { namespace internal {
...@@ -594,10 +597,10 @@ void PopulateChromeWebUIFrameBinders( ...@@ -594,10 +597,10 @@ void PopulateChromeWebUIFrameBinders(
ResetPasswordUI>(map); ResetPasswordUI>(map);
#endif #endif
#if !defined(OS_ANDROID) #if BUILDFLAG(ENABLE_KALEIDOSCOPE)
RegisterWebUIControllerInterfaceBinder<media::mojom::KaleidoscopeDataProvider, RegisterWebUIControllerInterfaceBinder<media::mojom::KaleidoscopeDataProvider,
KaleidoscopeUI>(map); KaleidoscopeUI>(map);
#endif // !defined(OS_ANDROID) #endif // BUILDFLAG(ENABLE_KALEIDOSCOPE)
} }
} // namespace internal } // namespace internal
......
# Copyright 2020 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.
import("//chrome/browser/buildflags.gni")
import("//tools/grit/grit_rule.gni")
# If the ENABLE_KALEIDOSCOPE flag is enabled and src-internal is available then
# include the internal resources. Otherwise, empty resources are used.
if (enable_kaleidoscope) {
grit("kaleidoscope_resources") {
source = "kaleidoscope_internal_resources.grd"
outputs = [
"grit/kaleidoscope_resources.h",
"kaleidoscope_resources.pak",
]
grit_flags = [
"-E",
"root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
]
deps = [
"//chrome/browser/media/kaleidoscope/internal:kaleidoscope_strings",
"//chrome/browser/media/kaleidoscope/internal/resources:content",
"//chrome/browser/media/kaleidoscope/mojom:mojom_js",
"//url/mojom:url_mojom_gurl_js",
]
}
} else {
grit("kaleidoscope_resources") {
source = "kaleidoscope_resources.grd"
outputs = [
"grit/kaleidoscope_resources.h",
"kaleidoscope_resources.pak",
]
grit_flags = [
"-E",
"root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
]
deps = [
"//chrome/browser/media/kaleidoscope/mojom:mojom_js",
"//url/mojom:url_mojom_gurl_js",
]
}
}
// Copyright 2020 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 "chrome/browser/media/kaleidoscope/constants.h"
const char kKaleidoscopeUIHost[] = "kaleidoscope";
const char kKaleidoscopeUIURL[] = "chrome://kaleidoscope";
const char kKaleidoscopeUntrustedContentUIURL[] =
"chrome-untrusted://kaleidoscope/";
// Copyright 2020 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 CHROME_BROWSER_MEDIA_KALEIDOSCOPE_CONSTANTS_H_
#define CHROME_BROWSER_MEDIA_KALEIDOSCOPE_CONSTANTS_H_
extern const char kKaleidoscopeUIHost[];
extern const char kKaleidoscopeUIURL[];
extern const char kKaleidoscopeUntrustedContentUIURL[];
#endif // CHROME_BROWSER_MEDIA_KALEIDOSCOPE_CONSTANTS_H_
// Copyright 2019 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 "chrome/browser/media/kaleidoscope/kaleidoscope_data_provider_impl.h"
#include <memory>
#include "base/callback.h"
#include "base/strings/string_util.h"
#include "chrome/browser/media/history/media_history_keyed_service.h"
#include "chrome/browser/media/history/media_history_keyed_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/common/channel_info.h"
#include "components/signin/public/identity_manager/access_token_info.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "components/signin/public/identity_manager/primary_account_access_token_fetcher.h"
#include "components/signin/public/identity_manager/scope_set.h"
#include "components/version_info/version_info.h"
#include "content/public/browser/storage_partition.h"
#include "google_apis/gaia/gaia_constants.h"
#include "google_apis/google_api_keys.h"
#include "media/base/media_switches.h"
namespace {
// The number of top media feeds to load for potential display.
constexpr unsigned kMediaFeedsLoadLimit = 5u;
// The minimum audio+video watchtime that is needed for display in Kaleidoscope.
constexpr base::TimeDelta kMediaFeedsAudioVideoWatchtimeMin =
base::TimeDelta::FromMinutes(30);
// The minimum number of items a media feed needs to be displayed. This is the
// number of items needed to populate a collection.
constexpr int kMediaFeedsFetchedItemsMin = 4;
// The maximum number of feed items to display.
constexpr int kMediaFeedsItemsMaxCount = 20;
constexpr char kChromeMediaRecommendationsOAuth2Scope[] =
"https://www.googleapis.com/auth/chrome-media-recommendations";
} // namespace
KaleidoscopeDataProviderImpl::KaleidoscopeDataProviderImpl(
mojo::PendingReceiver<media::mojom::KaleidoscopeDataProvider> receiver,
Profile* profile)
: credentials_(media::mojom::Credentials::New()),
profile_(profile),
receiver_(this, std::move(receiver)) {
DCHECK(profile);
// If this is Google Chrome then we should use the official API key.
if (google_apis::IsGoogleChromeAPIKeyUsed()) {
bool is_stable_channel =
chrome::GetChannel() == version_info::Channel::STABLE;
credentials_->api_key = is_stable_channel
? google_apis::GetAPIKey()
: google_apis::GetNonStableAPIKey();
}
identity_manager_ = IdentityManagerFactory::GetForProfile(profile);
DCHECK(identity_manager_);
}
KaleidoscopeDataProviderImpl::~KaleidoscopeDataProviderImpl() = default;
void KaleidoscopeDataProviderImpl::GetCredentials(GetCredentialsCallback cb) {
// If the user is not signed in, return the credentials without an access
// token. Sync consent is not required to use Kaleidoscope.
if (!identity_manager_->HasPrimaryAccount(
signin::ConsentLevel::kNotRequired)) {
std::move(cb).Run(credentials_.Clone());
return;
}
pending_callbacks_.push_back(std::move(cb));
// Get an OAuth token for the backend API. This token will be limited to just
// our backend scope. Destroying |token_fetcher_| will cancel the fetch so
// unretained is safe here.
signin::ScopeSet scopes = {kChromeMediaRecommendationsOAuth2Scope};
token_fetcher_ = std::make_unique<signin::PrimaryAccountAccessTokenFetcher>(
"kaleidoscope_service", identity_manager_, scopes,
base::BindOnce(&KaleidoscopeDataProviderImpl::OnAccessTokenAvailable,
base::Unretained(this)),
signin::PrimaryAccountAccessTokenFetcher::Mode::kImmediate,
signin::ConsentLevel::kNotRequired);
}
void KaleidoscopeDataProviderImpl::GetTopMediaFeeds(
GetTopMediaFeedsCallback callback) {
GetMediaHistoryService()->GetMediaFeeds(
media_history::MediaHistoryKeyedService::GetMediaFeedsRequest::
CreateTopFeedsForDisplay(
kMediaFeedsLoadLimit, kMediaFeedsAudioVideoWatchtimeMin,
kMediaFeedsFetchedItemsMin,
// Require Safe Search checking if the integration is enabled.
base::FeatureList::IsEnabled(media::kMediaFeedsSafeSearch)),
std::move(callback));
}
void KaleidoscopeDataProviderImpl::GetMediaFeedContents(
int64_t feed_id,
GetMediaFeedContentsCallback callback) {
GetMediaHistoryService()->GetMediaFeedItems(
media_history::MediaHistoryKeyedService::GetMediaFeedItemsRequest::
CreateItemsForFeed(
feed_id, kMediaFeedsItemsMaxCount,
// Require Safe Search checking if the integration is enabled.
base::FeatureList::IsEnabled(media::kMediaFeedsSafeSearch)),
std::move(callback));
}
media_history::MediaHistoryKeyedService*
KaleidoscopeDataProviderImpl::GetMediaHistoryService() {
return media_history::MediaHistoryKeyedServiceFactory::GetForProfile(
profile_);
}
void KaleidoscopeDataProviderImpl::OnAccessTokenAvailable(
GoogleServiceAuthError error,
signin::AccessTokenInfo access_token_info) {
DCHECK(token_fetcher_);
token_fetcher_.reset();
if (error.state() == GoogleServiceAuthError::State::NONE)
credentials_->access_token = access_token_info.token;
for (auto& callback : pending_callbacks_)
std::move(callback).Run(credentials_.Clone());
pending_callbacks_.clear();
}
// Copyright 2019 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 CHROME_BROWSER_MEDIA_KALEIDOSCOPE_KALEIDOSCOPE_DATA_PROVIDER_IMPL_H_
#define CHROME_BROWSER_MEDIA_KALEIDOSCOPE_KALEIDOSCOPE_DATA_PROVIDER_IMPL_H_
#include <memory>
#include "chrome/browser/media/kaleidoscope/mojom/kaleidoscope.mojom.h"
#include "google_apis/gaia/google_service_auth_error.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
namespace media_history {
class MediaHistoryKeyedService;
} // namespace media_history
namespace signin {
struct AccessTokenInfo;
class IdentityManager;
class PrimaryAccountAccessTokenFetcher;
} // namespace signin
class Profile;
class KaleidoscopeDataProviderImpl
: public media::mojom::KaleidoscopeDataProvider {
public:
KaleidoscopeDataProviderImpl(
mojo::PendingReceiver<media::mojom::KaleidoscopeDataProvider> receiver,
Profile* profile);
KaleidoscopeDataProviderImpl(const KaleidoscopeDataProviderImpl&) = delete;
KaleidoscopeDataProviderImpl& operator=(const KaleidoscopeDataProviderImpl&) =
delete;
~KaleidoscopeDataProviderImpl() override;
// media::mojom::KaleidoscopeDataProvider implementation.
void GetTopMediaFeeds(GetTopMediaFeedsCallback callback) override;
void GetMediaFeedContents(int64_t feed_id,
GetMediaFeedContentsCallback callback) override;
void GetCredentials(GetCredentialsCallback cb) override;
private:
media_history::MediaHistoryKeyedService* GetMediaHistoryService();
// Called when an access token request completes (successfully or not).
void OnAccessTokenAvailable(GoogleServiceAuthError error,
signin::AccessTokenInfo access_token_info);
// Helper for fetching OAuth2 access tokens. This is non-null iff an access
// token request is currently in progress.
std::unique_ptr<signin::PrimaryAccountAccessTokenFetcher> token_fetcher_;
// The current set of credentials.
media::mojom::CredentialsPtr credentials_;
// Pending credentials waiting on an access token.
std::vector<GetCredentialsCallback> pending_callbacks_;
signin::IdentityManager* identity_manager_;
Profile* const profile_;
mojo::Receiver<media::mojom::KaleidoscopeDataProvider> receiver_;
};
#endif // CHROME_BROWSER_MEDIA_KALEIDOSCOPE_KALEIDOSCOPE_DATA_PROVIDER_IMPL_H_
<?xml version="1.0" encoding="UTF-8"?>
<grit latest_public_release="0" current_release="1" output_all_resource_defines="false">
<outputs>
<output filename="grit/kaleidoscope_resources.h" type="rc_header">
<emit emit_type='prepend'></emit>
</output>
<output filename="kaleidoscope_resources.pak" type="data_package" />
</outputs>
<release seq="1">
<includes>
<include name="IDR_KALEIDOSCOPE_CONTENT_CSS" file="internal/resources/content.css" type="chrome_html" flattenhtml="true" compress="gzip" />
<include name="IDR_KALEIDOSCOPE_CONTENT_HTML" file="internal/resources/content.html" type="BINDATA" compress="gzip" />
<include name="IDR_KALEIDOSCOPE_CONTENT_JS" file="${root_gen_dir}/chrome/browser/media/kaleidoscope/internal/resources/ks-content.js" use_base_dir="false" type="BINDATA" compress="gzip" />
<include name="IDR_KALEIDOSCOPE_HTML" file="internal/resources/kaleidoscope.html" type="BINDATA" compress="gzip" />
<include name="IDR_KALEIDOSCOPE_JS" file="internal/resources/kaleidoscope.js" type="BINDATA" compress="gzip" />
<include name="IDR_KALEIDOSCOPE_MESSAGES_JS" file="internal/resources/messages.js" type="BINDATA" compress="gzip" />
<include name="IDR_KALEIDOSCOPE_UTILS_JS" file="internal/resources/utils.js" type="BINDATA" compress="gzip" />
<include name="IDR_GEOMETRY_MOJOM_LITE_JS" file="${root_gen_dir}/ui/gfx/geometry/mojom/geometry.mojom-lite.js" use_base_dir="false" type="BINDATA" compress="gzip" />
<include name="IDR_KALEIDOSCOPE_MOJOM_LITE_JS" file="${root_gen_dir}/chrome/browser/media/kaleidoscope/mojom/kaleidoscope.mojom-lite.js" use_base_dir="false" type="BINDATA" compress="gzip" />
<!-- Strings -->
<include name="IDR_KALEIDOSCOPE_LOCALE_EN" file="${root_gen_dir}/chrome/browser/media/kaleidoscope/internal/resources/_locales/en/messages.json" use_base_dir="false" type="BINDATA" compress="gzip" />
<!-- Google Sans -->
<include name="IDR_GOOGLE_SANS_CSS" file="internal/resources/fonts/fonts.css" type="BINDATA" compress="gzip" />
<include name="IDR_GOOGLE_SANS_BOLD" file="internal/resources/fonts/GoogleSans-Bold.woff2" type="BINDATA" compress="gzip" />
<include name="IDR_GOOGLE_SANS_MEDIUM" file="internal/resources/fonts/GoogleSans-Medium.woff2" type="BINDATA" compress="gzip" />
<include name="IDR_GOOGLE_SANS_REGULAR" file="internal/resources/fonts/GoogleSans-Regular.woff2" type="BINDATA" compress="gzip" />
</includes>
</release>
</grit>
<?xml version="1.0" encoding="UTF-8"?>
<grit latest_public_release="0" current_release="1" output_all_resource_defines="false">
<outputs>
<output filename="grit/kaleidoscope_resources.h" type="rc_header">
<emit emit_type='prepend'></emit>
</output>
<output filename="kaleidoscope_resources.pak" type="data_package" />
</outputs>
<release seq="1">
<includes>
<!-- TODO: Add resources. -->
</includes>
</release>
</grit>
// Copyright 2020 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 "chrome/browser/media/kaleidoscope/kaleidoscope_tab_helper.h"
#include "chrome/browser/media/kaleidoscope/constants.h"
#include "content/public/browser/navigation_handle.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "third_party/blink/public/mojom/autoplay/autoplay.mojom.h"
namespace {
const url::Origin& KaleidoscopeOrigin() {
static base::NoDestructor<url::Origin> origin(
url::Origin::Create(GURL(kKaleidoscopeUntrustedContentUIURL)));
return *origin;
}
} // namespace
KaleidoscopeTabHelper::KaleidoscopeTabHelper(content::WebContents* web_contents)
: content::WebContentsObserver(web_contents) {}
KaleidoscopeTabHelper::~KaleidoscopeTabHelper() = default;
void KaleidoscopeTabHelper::ReadyToCommitNavigation(
content::NavigationHandle* handle) {
if (!handle->IsInMainFrame() || handle->IsSameDocument() ||
handle->IsErrorPage()) {
return;
}
if (handle->GetInitiatorOrigin().has_value() &&
handle->GetInitiatorOrigin() != KaleidoscopeOrigin()) {
return;
}
mojo::AssociatedRemote<blink::mojom::AutoplayConfigurationClient> client;
handle->GetRenderFrameHost()->GetRemoteAssociatedInterfaces()->GetInterface(
&client);
client->AddAutoplayFlags(url::Origin::Create(handle->GetURL()),
blink::mojom::kAutoplayFlagUserException);
}
WEB_CONTENTS_USER_DATA_KEY_IMPL(KaleidoscopeTabHelper)
// Copyright 2020 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 CHROME_BROWSER_MEDIA_KALEIDOSCOPE_KALEIDOSCOPE_TAB_HELPER_H_
#define CHROME_BROWSER_MEDIA_KALEIDOSCOPE_KALEIDOSCOPE_TAB_HELPER_H_
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
class KaleidoscopeTabHelper
: public content::WebContentsObserver,
public content::WebContentsUserData<KaleidoscopeTabHelper> {
public:
~KaleidoscopeTabHelper() override;
KaleidoscopeTabHelper(const KaleidoscopeTabHelper&) = delete;
KaleidoscopeTabHelper& operator=(const KaleidoscopeTabHelper&) = delete;
// content::WebContentsObserver:
void ReadyToCommitNavigation(content::NavigationHandle* handle) override;
private:
friend class content::WebContentsUserData<KaleidoscopeTabHelper>;
explicit KaleidoscopeTabHelper(content::WebContents* web_contents);
WEB_CONTENTS_USER_DATA_KEY_DECL();
};
#endif // CHROME_BROWSER_MEDIA_KALEIDOSCOPE_KALEIDOSCOPE_TAB_HELPER_H_
// Copyright 2019 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 "chrome/browser/media/kaleidoscope/kaleidoscope_ui.h"
#include "base/command_line.h"
#include "base/memory/ref_counted_memory.h"
#include "chrome/browser/buildflags.h"
#include "chrome/browser/media/kaleidoscope/constants.h"
#include "chrome/browser/media/kaleidoscope/kaleidoscope_data_provider_impl.h"
#include "chrome/browser/media/kaleidoscope/switches.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/grit/dev_ui_browser_resources.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
#include "services/network/public/mojom/content_security_policy.mojom.h"
#include "ui/base/resource/resource_bundle.h"
#if BUILDFLAG(ENABLE_KALEIDOSCOPE)
#include "chrome/browser/media/kaleidoscope/grit/kaleidoscope_resources.h"
#endif // BUILDFLAG(ENABLE_KALEIDOSCOPE)
namespace {
// Wraps the strings in JS so they can be accessed by the code. The strings are
// placed on the window object so they can always be accessed.
const char kStringWrapper[] =
"window.KALEIDOSCOPE_STRINGS = new Map(Object.entries(%s));";
bool OnShouldHandleRequest(const std::string& path) {
return base::EqualsCaseInsensitiveASCII(path,
"resources/_locales/strings.js");
}
void OnStringsRequest(const std::string& path,
content::WebUIDataSource::GotDataCallback callback) {
DCHECK(OnShouldHandleRequest(path));
#if BUILDFLAG(ENABLE_KALEIDOSCOPE)
// TODO(beccahughes): Switch locale here.
auto str = ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
IDR_KALEIDOSCOPE_LOCALE_EN);
#else
std::string str;
#endif // BUILDFLAG(ENABLE_KALEIDOSCOPE)
base::RefCountedString* ref_contents = new base::RefCountedString();
ref_contents->data() = base::StringPrintf(kStringWrapper, str.c_str());
std::move(callback).Run(ref_contents);
}
content::WebUIDataSource* CreateUntrustedWebUIDataSource() {
content::WebUIDataSource* untrusted_source =
content::WebUIDataSource::Create(kKaleidoscopeUntrustedContentUIURL);
untrusted_source->DisableDenyXFrameOptions();
untrusted_source->UseStringsJs();
// Add a request filter to handle strings.js
untrusted_source->SetRequestFilter(base::BindRepeating(OnShouldHandleRequest),
base::BindRepeating(OnStringsRequest));
const auto backend_url =
GetGoogleAPIBaseURL(*base::CommandLine::ForCurrentProcess());
// Allow scripts and styles from chrome-untrusted://resources.
untrusted_source->OverrideContentSecurityPolicy(
network::mojom::CSPDirectiveName::ScriptSrc,
"script-src chrome-untrusted://resources 'unsafe-inline' 'self';");
untrusted_source->OverrideContentSecurityPolicy(
network::mojom::CSPDirectiveName::StyleSrc,
"style-src chrome-untrusted://resources 'unsafe-inline' 'self';");
// Allow images and videos from anywhere.
untrusted_source->OverrideContentSecurityPolicy(
network::mojom::CSPDirectiveName::ImgSrc, "img-src * data:;");
untrusted_source->OverrideContentSecurityPolicy(
network::mojom::CSPDirectiveName::MediaSrc, "media-src *;");
// Allow access to Google APIs.
untrusted_source->OverrideContentSecurityPolicy(
network::mojom::CSPDirectiveName::ConnectSrc,
base::StringPrintf("connect-src %s;", backend_url.spec().c_str()));
// Add the URL to the backend.
untrusted_source->AddString("googleApiUrl", backend_url.spec());
#if BUILDFLAG(ENABLE_KALEIDOSCOPE)
untrusted_source->AddResourcePath("content.css",
IDR_KALEIDOSCOPE_CONTENT_CSS);
untrusted_source->AddResourcePath("content.js", IDR_KALEIDOSCOPE_CONTENT_JS);
untrusted_source->AddResourcePath("messages.js",
IDR_KALEIDOSCOPE_MESSAGES_JS);
untrusted_source->AddResourcePath("geometry.mojom-lite.js",
IDR_GEOMETRY_MOJOM_LITE_JS);
untrusted_source->AddResourcePath("kaleidoscope.mojom-lite.js",
IDR_KALEIDOSCOPE_MOJOM_LITE_JS);
untrusted_source->AddResourcePath(
"chrome/browser/media/feeds/media_feeds_store.mojom-lite.js",
IDR_MEDIA_FEEDS_STORE_MOJOM_LITE_JS);
// Google Sans.
untrusted_source->AddResourcePath("resources/fonts/fonts.css",
IDR_GOOGLE_SANS_CSS);
untrusted_source->AddResourcePath("resources/fonts/GoogleSans-Bold.woff2",
IDR_GOOGLE_SANS_BOLD);
untrusted_source->AddResourcePath("resources/fonts/GoogleSans-Medium.woff2",
IDR_GOOGLE_SANS_MEDIUM);
untrusted_source->AddResourcePath("resources/fonts/GoogleSans-Regular.woff2",
IDR_GOOGLE_SANS_REGULAR);
untrusted_source->AddResourcePath("content.html",
IDR_KALEIDOSCOPE_CONTENT_HTML);
#endif // BUILDFLAG(ENABLE_KALEIDOSCOPE)
return untrusted_source;
}
content::WebUIDataSource* CreateWebUIDataSource() {
content::WebUIDataSource* html_source =
content::WebUIDataSource::Create(kKaleidoscopeUIHost);
// Allows us to put content in an IFrame.
html_source->OverrideContentSecurityPolicy(
network::mojom::CSPDirectiveName::ChildSrc,
"child-src chrome-untrusted://kaleidoscope;");
// Add a request filter to handle strings.js
html_source->SetRequestFilter(base::BindRepeating(OnShouldHandleRequest),
base::BindRepeating(OnStringsRequest));
#if BUILDFLAG(ENABLE_KALEIDOSCOPE)
html_source->AddResourcePath("kaleidoscope.js", IDR_KALEIDOSCOPE_JS);
html_source->AddResourcePath("messages.js", IDR_KALEIDOSCOPE_MESSAGES_JS);
html_source->AddResourcePath("utils.js", IDR_KALEIDOSCOPE_UTILS_JS);
html_source->AddResourcePath("geometry.mojom-lite.js",
IDR_GEOMETRY_MOJOM_LITE_JS);
html_source->AddResourcePath("kaleidoscope.mojom-lite.js",
IDR_KALEIDOSCOPE_MOJOM_LITE_JS);
html_source->AddResourcePath(
"chrome/browser/media/feeds/media_feeds_store.mojom-lite.js",
IDR_MEDIA_FEEDS_STORE_MOJOM_LITE_JS);
html_source->SetDefaultResource(IDR_KALEIDOSCOPE_HTML);
#endif // BUILDFLAG(ENABLE_KALEIDOSCOPE)
return html_source;
}
} // anonymous namespace
// We set |enable_chrome_send| to true since we need it for browser tests.
KaleidoscopeUI::KaleidoscopeUI(content::WebUI* web_ui)
: ui::MojoWebUIController(web_ui, /*enable_chrome_send=*/true) {
web_ui->AddRequestableScheme(content::kChromeUIUntrustedScheme);
auto* browser_context = web_ui->GetWebContents()->GetBrowserContext();
content::WebUIDataSource::Add(browser_context, CreateWebUIDataSource());
content::WebUIDataSource::Add(browser_context,
CreateUntrustedWebUIDataSource());
}
KaleidoscopeUI::~KaleidoscopeUI() = default;
void KaleidoscopeUI::BindInterface(
mojo::PendingReceiver<media::mojom::KaleidoscopeDataProvider> provider) {
provider_ = std::make_unique<KaleidoscopeDataProviderImpl>(
std::move(provider), Profile::FromWebUI(web_ui()));
}
WEB_UI_CONTROLLER_TYPE_IMPL(KaleidoscopeUI)
// Copyright 2019 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 CHROME_BROWSER_MEDIA_KALEIDOSCOPE_KALEIDOSCOPE_UI_H_
#define CHROME_BROWSER_MEDIA_KALEIDOSCOPE_KALEIDOSCOPE_UI_H_
#include "chrome/browser/media/kaleidoscope/mojom/kaleidoscope.mojom.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "ui/webui/mojo_web_ui_controller.h"
class KaleidoscopeUI : public ui::MojoWebUIController {
public:
explicit KaleidoscopeUI(content::WebUI* web_ui);
KaleidoscopeUI(const KaleidoscopeUI&) = delete;
KaleidoscopeUI& operator=(const KaleidoscopeUI&) = delete;
~KaleidoscopeUI() override;
void BindInterface(
mojo::PendingReceiver<media::mojom::KaleidoscopeDataProvider> provider);
private:
std::unique_ptr<media::mojom::KaleidoscopeDataProvider> provider_;
WEB_UI_CONTROLLER_TYPE_DECL();
};
#endif // CHROME_BROWSER_MEDIA_KALEIDOSCOPE_KALEIDOSCOPE_UI_H_
# Copyright 2019 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.
import("//mojo/public/tools/bindings/mojom.gni")
mojom("mojom") {
sources = [ "kaleidoscope.mojom" ]
public_deps = [ "//chrome/browser/media/feeds:mojo_bindings" ]
}
per-file *.mojom=set noparent
per-file *.mojom=file://ipc/SECURITY_OWNERS
// Copyright 2019 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.
module media.mojom;
import "chrome/browser/media/feeds/media_feeds_store.mojom";
// The credentials required to make Google API calls from JS.
struct Credentials {
// Chrome's API Key.
string api_key;
// An OAuth access token scoped to the Kaleidoscope API for the currently
// logged in user. If the user is not signed in then this will be empty.
string? access_token;
};
// Provides data for the kaleidoscope page.
interface KaleidoscopeDataProvider {
// Returns all the Media Feeds that Kaleidoscope might decide to show.
GetTopMediaFeeds() => (array<media_feeds.mojom.MediaFeed> feeds);
// Returns all the items from a Media Feed that Kaleidoscope might decide to
// show.
GetMediaFeedContents(int64 feed_id) => (array<media_feeds.mojom.MediaFeedItem> items);
// Retrieves the current credentials.
GetCredentials() => (Credentials credentials);
};
// Copyright 2020 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 "chrome/browser/media/kaleidoscope/switches.h"
#include "base/command_line.h"
#include "url/gurl.h"
namespace switches {
// A command line switch for overriding the base URL of the API.
const char kKaleidoscopeBackendUrl[] = "kaleidoscope-backend-url";
// The command line alias and URL for the "prod" environment.
const char kKaleidoscopeBackendUrlProdAlias[] = "prod";
const char kKaleidoscopeBackendUrlProdUrl[] =
"https://chromemediarecommendations-pa.googleapis.com";
// The command line alias and URL for the "staging" environment.
const char kKaleidoscopeBackendUrlStagingAlias[] = "staging";
const char kKaleidoscopeBackendUrlStagingUrl[] =
"https://staging-chromemediarecommendations-pa.sandbox.googleapis.com";
// The command line alias and URL for the "autopush" environment.
const char kKaleidoscopeBackendUrlAutopushAlias[] = "autopush";
const char kKaleidoscopeBackendUrlAutopushUrl[] =
"https://autopush-chromemediarecommendations-pa.sandbox.googleapis.com";
} // namespace switches
GURL GetGoogleAPIBaseURL(const base::CommandLine& command_line) {
// Return the URL set in the command line, if any.
if (command_line.HasSwitch(switches::kKaleidoscopeBackendUrl)) {
auto value =
command_line.GetSwitchValueASCII(switches::kKaleidoscopeBackendUrl);
// If the value is a valid base URL then return it.
GURL url(value);
if (url.is_valid() && (url.path().empty() || url.path() == "/")) {
return url;
}
// Check if the value is an alias and return it.
if (value == switches::kKaleidoscopeBackendUrlProdAlias) {
return GURL(switches::kKaleidoscopeBackendUrlProdUrl);
} else if (value == switches::kKaleidoscopeBackendUrlStagingAlias) {
return GURL(switches::kKaleidoscopeBackendUrlStagingUrl);
} else if (value == switches::kKaleidoscopeBackendUrlAutopushAlias) {
return GURL(switches::kKaleidoscopeBackendUrlAutopushUrl);
}
}
// TODO(beccahughes): Update this when prod is live.
return GURL(switches::kKaleidoscopeBackendUrlStagingUrl);
}
// Copyright 2020 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 CHROME_BROWSER_MEDIA_KALEIDOSCOPE_SWITCHES_H_
#define CHROME_BROWSER_MEDIA_KALEIDOSCOPE_SWITCHES_H_
namespace base {
class CommandLine;
} // namespace base
class GURL;
namespace switches {
extern const char kKaleidoscopeBackendUrl[];
extern const char kKaleidoscopeBackendUrlProdAlias[];
extern const char kKaleidoscopeBackendUrlProdUrl[];
extern const char kKaleidoscopeBackendUrlStagingAlias[];
extern const char kKaleidoscopeBackendUrlStagingUrl[];
extern const char kKaleidoscopeBackendUrlAutopushAlias[];
extern const char kKaleidoscopeBackendUrlAutopushUrl[];
} // namespace switches
// Based on a |command_line| return the base URL to the Google API. The
// --kaleidoscope-backend-url switch takes either a URL or an alias which is
// one of autopush, staging or prod.
GURL GetGoogleAPIBaseURL(const base::CommandLine& command_line);
#endif // CHROME_BROWSER_MEDIA_KALEIDOSCOPE_SWITCHES_H_
// Copyright 2020 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 "chrome/browser/media/kaleidoscope/switches.h"
#include "base/command_line.h"
#include "base/test/scoped_command_line.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
namespace {
const char kDefaultUrl[] =
"https://staging-chromemediarecommendations-pa.sandbox.googleapis.com";
} // namespace
using KaleidoscopeSwitchesTest = testing::Test;
TEST_F(KaleidoscopeSwitchesTest, Switches_Default) {
GURL expected(kDefaultUrl);
EXPECT_EQ(expected,
GetGoogleAPIBaseURL(*base::CommandLine::ForCurrentProcess()));
}
TEST_F(KaleidoscopeSwitchesTest, Switches_Prod) {
base::test::ScopedCommandLine scoped_command_line;
base::CommandLine* command_line = scoped_command_line.GetProcessCommandLine();
command_line->AppendSwitchASCII(switches::kKaleidoscopeBackendUrl,
switches::kKaleidoscopeBackendUrlProdAlias);
GURL expected("https://chromemediarecommendations-pa.googleapis.com");
EXPECT_EQ(expected, GetGoogleAPIBaseURL(*command_line));
}
TEST_F(KaleidoscopeSwitchesTest, Switches_Staging) {
base::test::ScopedCommandLine scoped_command_line;
base::CommandLine* command_line = scoped_command_line.GetProcessCommandLine();
command_line->AppendSwitchASCII(
switches::kKaleidoscopeBackendUrl,
switches::kKaleidoscopeBackendUrlStagingAlias);
GURL expected(
"https://staging-chromemediarecommendations-pa.sandbox.googleapis.com");
EXPECT_EQ(expected, GetGoogleAPIBaseURL(*command_line));
}
TEST_F(KaleidoscopeSwitchesTest, Switches_Autopush) {
base::test::ScopedCommandLine scoped_command_line;
base::CommandLine* command_line = scoped_command_line.GetProcessCommandLine();
command_line->AppendSwitchASCII(
switches::kKaleidoscopeBackendUrl,
switches::kKaleidoscopeBackendUrlAutopushAlias);
GURL expected(
"https://autopush-chromemediarecommendations-pa.sandbox.googleapis.com");
EXPECT_EQ(expected, GetGoogleAPIBaseURL(*command_line));
}
TEST_F(KaleidoscopeSwitchesTest, Switches_Bad) {
base::test::ScopedCommandLine scoped_command_line;
base::CommandLine* command_line = scoped_command_line.GetProcessCommandLine();
command_line->AppendSwitchASCII(switches::kKaleidoscopeBackendUrl, "xxx");
GURL expected(kDefaultUrl);
EXPECT_EQ(expected, GetGoogleAPIBaseURL(*command_line));
}
TEST_F(KaleidoscopeSwitchesTest, Switches_CustomURL) {
base::test::ScopedCommandLine scoped_command_line;
base::CommandLine* command_line = scoped_command_line.GetProcessCommandLine();
command_line->AppendSwitchASCII(switches::kKaleidoscopeBackendUrl,
"https://test.sandbox.googleapis.com");
GURL expected("https://test.sandbox.googleapis.com");
EXPECT_EQ(expected, GetGoogleAPIBaseURL(*command_line));
}
TEST_F(KaleidoscopeSwitchesTest, Switches_CustomURL_WithPath) {
base::test::ScopedCommandLine scoped_command_line;
base::CommandLine* command_line = scoped_command_line.GetProcessCommandLine();
command_line->AppendSwitchASCII(switches::kKaleidoscopeBackendUrl,
"https://test.sandbox.googleapis.com/v1");
GURL expected(kDefaultUrl);
EXPECT_EQ(expected, GetGoogleAPIBaseURL(*command_line));
}
...@@ -1521,6 +1521,10 @@ static_library("ui") { ...@@ -1521,6 +1521,10 @@ static_library("ui") {
} }
} }
if (enable_kaleidoscope) {
deps += [ "//chrome/browser/media/kaleidoscope/internal" ]
}
if (enable_paint_preview) { if (enable_paint_preview) {
deps += [ "//components/paint_preview/browser" ] deps += [ "//components/paint_preview/browser" ]
} }
......
...@@ -150,7 +150,6 @@ ...@@ -150,7 +150,6 @@
#if !defined(OS_ANDROID) #if !defined(OS_ANDROID)
#include "chrome/browser/media/feeds/media_feeds_contents_observer.h" #include "chrome/browser/media/feeds/media_feeds_contents_observer.h"
#include "chrome/browser/media/feeds/media_feeds_service.h" #include "chrome/browser/media/feeds/media_feeds_service.h"
#include "chrome/browser/media/kaleidoscope/kaleidoscope_tab_helper.h"
#endif #endif
#if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION) #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION)
...@@ -166,6 +165,10 @@ ...@@ -166,6 +165,10 @@
#include "extensions/browser/view_type_utils.h" #include "extensions/browser/view_type_utils.h"
#endif #endif
#if BUILDFLAG(ENABLE_KALEIDOSCOPE)
#include "chrome/browser/media/kaleidoscope/internal/kaleidoscope_tab_helper.h"
#endif // BUILDFLAG(ENABLE_KALEIDOSCOPE)
#if BUILDFLAG(ENABLE_OFFLINE_PAGES) #if BUILDFLAG(ENABLE_OFFLINE_PAGES)
#include "chrome/browser/offline_pages/android/auto_fetch_page_load_watcher.h" #include "chrome/browser/offline_pages/android/auto_fetch_page_load_watcher.h"
#include "chrome/browser/offline_pages/offline_page_tab_helper.h" #include "chrome/browser/offline_pages/offline_page_tab_helper.h"
...@@ -421,10 +424,10 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) { ...@@ -421,10 +424,10 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) {
web_app::WebAppMetrics::Get(profile); web_app::WebAppMetrics::Get(profile);
#endif #endif
#if !defined(OS_ANDROID) #if BUILDFLAG(ENABLE_KALEIDOSCOPE)
if (base::FeatureList::IsEnabled(media::kKaleidoscope)) if (base::FeatureList::IsEnabled(media::kKaleidoscope))
KaleidoscopeTabHelper::CreateForWebContents(web_contents); KaleidoscopeTabHelper::CreateForWebContents(web_contents);
#endif // !defined(OS_ANDROID) #endif // BUILDFLAG(ENABLE_KALEIDOSCOPE)
#if BUILDFLAG(ENABLE_OFFLINE_PAGES) #if BUILDFLAG(ENABLE_OFFLINE_PAGES)
offline_pages::OfflinePageTabHelper::CreateForWebContents(web_contents); offline_pages::OfflinePageTabHelper::CreateForWebContents(web_contents);
......
...@@ -104,6 +104,12 @@ ...@@ -104,6 +104,12 @@
#include "ui/web_dialogs/web_dialog_ui.h" #include "ui/web_dialogs/web_dialog_ui.h"
#include "url/gurl.h" #include "url/gurl.h"
#if BUILDFLAG(ENABLE_KALEIDOSCOPE)
#include "chrome/browser/media/kaleidoscope/internal/constants.h"
#include "chrome/browser/media/kaleidoscope/internal/kaleidoscope_ui.h"
#include "media/base/media_switches.h"
#endif // BUILDFLAG(ENABLE_KALEIDOSCOPE)
#if BUILDFLAG(ENABLE_NACL) #if BUILDFLAG(ENABLE_NACL)
#include "chrome/browser/ui/webui/nacl_ui.h" #include "chrome/browser/ui/webui/nacl_ui.h"
#endif #endif
...@@ -129,8 +135,6 @@ ...@@ -129,8 +135,6 @@
#endif // BUILDFLAG(ENABLE_FEED_IN_CHROME) #endif // BUILDFLAG(ENABLE_FEED_IN_CHROME)
#else // defined(OS_ANDROID) #else // defined(OS_ANDROID)
#include "chrome/browser/media/feeds/media_feeds_service.h" #include "chrome/browser/media/feeds/media_feeds_service.h"
#include "chrome/browser/media/kaleidoscope/constants.h"
#include "chrome/browser/media/kaleidoscope/kaleidoscope_ui.h"
#include "chrome/browser/media/router/media_router_feature.h" #include "chrome/browser/media/router/media_router_feature.h"
#include "chrome/browser/ui/ui_features.h" #include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/webui/bookmarks/bookmarks_ui.h" #include "chrome/browser/ui/webui/bookmarks/bookmarks_ui.h"
...@@ -150,7 +154,6 @@ ...@@ -150,7 +154,6 @@
#include "chrome/browser/ui/webui/system_info_ui.h" #include "chrome/browser/ui/webui/system_info_ui.h"
#include "chrome/browser/ui/webui/tab_search/tab_search_ui.h" #include "chrome/browser/ui/webui/tab_search/tab_search_ui.h"
#include "chrome/browser/ui/webui/web_footer_experiment_ui.h" #include "chrome/browser/ui/webui/web_footer_experiment_ui.h"
#include "media/base/media_switches.h"
#endif // defined(OS_ANDROID) #endif // defined(OS_ANDROID)
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
...@@ -745,12 +748,12 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui, ...@@ -745,12 +748,12 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
return &NewWebUI<WelcomeUI>; return &NewWebUI<WelcomeUI>;
#endif #endif
#if !defined(OS_ANDROID) #if BUILDFLAG(ENABLE_KALEIDOSCOPE)
if (base::FeatureList::IsEnabled(media::kKaleidoscope)) { if (base::FeatureList::IsEnabled(media::kKaleidoscope)) {
if (url.host_piece() == kKaleidoscopeUIHost) if (url.host_piece() == kKaleidoscopeUIHost)
return &NewWebUI<KaleidoscopeUI>; return &NewWebUI<KaleidoscopeUI>;
} }
#endif // !defined(OS_ANDROID) #endif // BUILDFLAG(ENABLE_KALEIDOSCOPE)
#if BUILDFLAG(ENABLE_NACL) #if BUILDFLAG(ENABLE_NACL)
if (url.host_piece() == chrome::kChromeUINaClHost) if (url.host_piece() == chrome::kChromeUINaClHost)
return &NewWebUI<NaClUI>; return &NewWebUI<NaClUI>;
......
...@@ -129,7 +129,6 @@ template("chrome_extra_paks") { ...@@ -129,7 +129,6 @@ template("chrome_extra_paks") {
# New paks should be added here by default. # New paks should be added here by default.
sources += [ sources += [
"$root_gen_dir/chrome/bookmarks_resources.pak", "$root_gen_dir/chrome/bookmarks_resources.pak",
"$root_gen_dir/chrome/browser/media/kaleidoscope/kaleidoscope_resources.pak",
"$root_gen_dir/chrome/component_extension_resources.pak", "$root_gen_dir/chrome/component_extension_resources.pak",
"$root_gen_dir/chrome/dev_ui_resources.pak", "$root_gen_dir/chrome/dev_ui_resources.pak",
"$root_gen_dir/chrome/downloads_resources.pak", "$root_gen_dir/chrome/downloads_resources.pak",
...@@ -144,7 +143,6 @@ template("chrome_extra_paks") { ...@@ -144,7 +143,6 @@ template("chrome_extra_paks") {
"$root_gen_dir/headless/headless_lib_resources.pak", "$root_gen_dir/headless/headless_lib_resources.pak",
] ]
deps += [ deps += [
"//chrome/browser/media/kaleidoscope:kaleidoscope_resources",
"//chrome/browser/resources:bookmarks_resources", "//chrome/browser/resources:bookmarks_resources",
"//chrome/browser/resources:component_extension_resources", "//chrome/browser/resources:component_extension_resources",
"//chrome/browser/resources:dev_ui_paks", "//chrome/browser/resources:dev_ui_paks",
...@@ -244,6 +242,10 @@ template("chrome_extra_paks") { ...@@ -244,6 +242,10 @@ template("chrome_extra_paks") {
sources += [ "$root_gen_dir/chrome/tab_strip_resources.pak" ] sources += [ "$root_gen_dir/chrome/tab_strip_resources.pak" ]
deps += [ "//chrome/browser/resources:tab_strip_resources" ] deps += [ "//chrome/browser/resources:tab_strip_resources" ]
} }
if (enable_kaleidoscope) {
sources += [ "$root_gen_dir/chrome/browser/media/kaleidoscope/internal/kaleidoscope_resources.pak" ]
deps += [ "//chrome/browser/media/kaleidoscope/internal:kaleidoscope_resources_grit" ]
}
} }
} }
......
...@@ -3608,7 +3608,6 @@ test("unit_tests") { ...@@ -3608,7 +3608,6 @@ test("unit_tests") {
"../browser/media/feeds/media_feeds_converter_unittest.cc", "../browser/media/feeds/media_feeds_converter_unittest.cc",
"../browser/media/feeds/media_feeds_fetcher_unittest.cc", "../browser/media/feeds/media_feeds_fetcher_unittest.cc",
"../browser/media/feeds/media_feeds_service_unittest.cc", "../browser/media/feeds/media_feeds_service_unittest.cc",
"../browser/media/kaleidoscope/switches_unittest.cc",
"../browser/nearby_sharing/client/nearby_share_api_call_flow_impl_unittest.cc", "../browser/nearby_sharing/client/nearby_share_api_call_flow_impl_unittest.cc",
"../browser/nearby_sharing/fake_nearby_connections_manager.cc", "../browser/nearby_sharing/fake_nearby_connections_manager.cc",
"../browser/nearby_sharing/fake_nearby_connections_manager.h", "../browser/nearby_sharing/fake_nearby_connections_manager.h",
...@@ -3858,6 +3857,10 @@ test("unit_tests") { ...@@ -3858,6 +3857,10 @@ test("unit_tests") {
] ]
} }
if (enable_kaleidoscope) {
deps += [ "../browser/media/kaleidoscope/internal:unit_tests" ]
}
if (enable_offline_pages) { if (enable_offline_pages) {
sources += [ sources += [
"../browser/offline_pages/android/auto_fetch_page_load_watcher_unittest.cc", "../browser/offline_pages/android/auto_fetch_page_load_watcher_unittest.cc",
......
...@@ -206,27 +206,14 @@ ...@@ -206,27 +206,14 @@
# END chrome/browser section. # END chrome/browser section.
# START chrome/ WebUI resources section # START chrome/ WebUI resources section
# Both the kaleidoscope_resources.grd and kaleidoscope_internal_resources.grd "chrome/browser/media/kaleidoscope/internal/kaleidoscope_resources.grd": {
# start with the same id because only one of them is built based on whether
# src-internal is available.
"chrome/browser/media/kaleidoscope/kaleidoscope_resources.grd": {
# Big alignment at start of section.
"META": {"align": 100},
"includes": [2000],
},
"chrome/browser/media/kaleidoscope/kaleidoscope_internal_resources.grd": {
# Big alignment at start of section. # Big alignment at start of section.
"META": {"align": 100}, "META": {"align": 100},
"includes": [2000], "includes": [2000],
}, "messages": [2010],
# The internal version of kaleidoscope_resources.grd will be removed in a
# follow up. It is only here to avoid build breakages.
"chrome/browser/media/kaleidoscope/internal/kaleidoscope_resources.grd": {
"META": {"sizes": {"includes": [50],}}, # Relies on src-internal.
"includes": [2010],
}, },
"chrome/browser/media/kaleidoscope/internal/kaleidoscope_strings.grd": { "chrome/browser/media/kaleidoscope/internal/kaleidoscope_strings.grd": {
"META": {"sizes": {"messages": [50]}, "join": 2}, # Relies on src-internal. "META": {"sizes": {"messages": [50],}}, # Relies on src-internal.
"messages": [2015], "messages": [2015],
}, },
"chrome/browser/resources/bluetooth_internals/resources.grd": { "chrome/browser/resources/bluetooth_internals/resources.grd": {
......
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