diff options
Diffstat (limited to 'chromium/chrome/browser/media/kaleidoscope')
6 files changed, 148 insertions, 0 deletions
diff --git a/chromium/chrome/browser/media/kaleidoscope/BUILD.gn b/chromium/chrome/browser/media/kaleidoscope/BUILD.gn new file mode 100644 index 00000000000..45446236046 --- /dev/null +++ b/chromium/chrome/browser/media/kaleidoscope/BUILD.gn @@ -0,0 +1,44 @@ +# 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", + ] + } +} diff --git a/chromium/chrome/browser/media/kaleidoscope/kaleidoscope_internal_resources.grd b/chromium/chrome/browser/media/kaleidoscope/kaleidoscope_internal_resources.grd new file mode 100644 index 00000000000..8ca771da653 --- /dev/null +++ b/chromium/chrome/browser/media/kaleidoscope/kaleidoscope_internal_resources.grd @@ -0,0 +1,31 @@ +<?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> diff --git a/chromium/chrome/browser/media/kaleidoscope/kaleidoscope_resources.grd b/chromium/chrome/browser/media/kaleidoscope/kaleidoscope_resources.grd new file mode 100644 index 00000000000..72d8ab5339e --- /dev/null +++ b/chromium/chrome/browser/media/kaleidoscope/kaleidoscope_resources.grd @@ -0,0 +1,14 @@ +<?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> diff --git a/chromium/chrome/browser/media/kaleidoscope/mojom/BUILD.gn b/chromium/chrome/browser/media/kaleidoscope/mojom/BUILD.gn new file mode 100644 index 00000000000..e3ce1eb00b5 --- /dev/null +++ b/chromium/chrome/browser/media/kaleidoscope/mojom/BUILD.gn @@ -0,0 +1,11 @@ +# 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" ] +} diff --git a/chromium/chrome/browser/media/kaleidoscope/mojom/kaleidoscope.mojom b/chromium/chrome/browser/media/kaleidoscope/mojom/kaleidoscope.mojom new file mode 100644 index 00000000000..779ef7edf33 --- /dev/null +++ b/chromium/chrome/browser/media/kaleidoscope/mojom/kaleidoscope.mojom @@ -0,0 +1,30 @@ +// 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); +}; diff --git a/chromium/chrome/browser/media/kaleidoscope/test/proto/BUILD.gn b/chromium/chrome/browser/media/kaleidoscope/test/proto/BUILD.gn new file mode 100644 index 00000000000..48dedc2a124 --- /dev/null +++ b/chromium/chrome/browser/media/kaleidoscope/test/proto/BUILD.gn @@ -0,0 +1,18 @@ +# 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("//third_party/closure_compiler/compile_js.gni") +import("//third_party/protobuf/proto_library.gni") + +proto_library("proto") { + sources = [ "test.proto" ] + + generate_javascript = true +} + +js_library("test") { + sources = [] + + deps = [ ":proto_js" ] +} |