| // Copyright 2022 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| module side_panel.mojom; |
| |
| import "skia/public/mojom/skcolor.mojom"; |
| import "url/mojom/url.mojom"; |
| |
| // The background image URL and styling. |
| struct BackgroundImage { |
| // URL to the background image. Can point to untrusted content. |
| url.mojom.Url url; |
| // URL to snapshot of the background image. Can point to untrusted content. |
| url.mojom.Url snapshot_url; |
| // Whether the image is a local resource. |
| bool is_uploaded_image; |
| // Title of the background image. |
| string title; |
| // The main color of the background image. |
| skia.mojom.SkColor? main_color; |
| }; |
| |
| // Additional info for third-party themes. |
| struct ThirdPartyThemeInfo { |
| // ID in the Chrome Web Store. |
| string id; |
| // Human-readable theme name. |
| string name; |
| }; |
| |
| // A generic theme. |
| struct Theme { |
| // The background image. |
| BackgroundImage? background_image; |
| // Whether the user is using a third party theme. |
| ThirdPartyThemeInfo? third_party_theme_info; |
| // Whether the OS is in dark mode. |
| bool system_dark_mode; |
| // The color this theme was calculated from. |
| skia.mojom.SkColor seed_color; |
| // The current theme background color. |
| skia.mojom.SkColor background_color; |
| // The current theme foreground color. If not set, we use the default theme. |
| skia.mojom.SkColor? foreground_color; |
| // The color of the color picker icon. |
| skia.mojom.SkColor color_picker_icon_color; |
| // True if the colors are managed by a policy. |
| bool colors_managed_by_policy; |
| // Selected collection for daily refresh. |
| string? daily_refresh_collection_id; |
| }; |
| |
| struct ChromeColor { |
| // Localized string of the color name. |
| string name; |
| // The color this Chrome color was calculated from. |
| skia.mojom.SkColor seed; |
| // The foreground color. |
| skia.mojom.SkColor background; |
| // The background color. |
| skia.mojom.SkColor foreground; |
| }; |
| |
| // A collection of background images. |
| struct BackgroundCollection { |
| // Collection identifier. |
| string id; |
| // Localized string of the collection name. |
| string label; |
| // URL to a preview image for the collection. Can point to untrusted content. |
| url.mojom.Url preview_image_url; |
| }; |
| |
| // A background image in a collection. |
| struct CollectionImage { |
| // Human readable attributions of the background image. |
| string attribution_1; |
| string attribution_2; |
| // URL associated with the background image. Used for href. |
| url.mojom.Url attribution_url; |
| // URL of image. Can point to untrusted content. |
| url.mojom.Url image_url; |
| // URL to a preview of the image. Can point to untrusted content. |
| url.mojom.Url preview_image_url; |
| }; |
| |
| // Settings associated with a given module. |
| struct ModuleSettings { |
| // A unique identifier associated with a module. |
| string id; |
| // The name associated with a module. |
| string name; |
| // Whether the module is enabled or not. |
| bool enabled; |
| }; |
| |
| // Used by the WebUI page to bootstrap bidirectional communication. |
| interface CustomizeChromePageHandlerFactory { |
| // The WebUI calls this method when the page is first initialized. |
| CreatePageHandler(pending_remote<CustomizeChromePage> page, |
| pending_receiver<CustomizeChromePageHandler> handler); |
| }; |
| |
| // Browser-side handler for requests from WebUI page. |
| interface CustomizeChromePageHandler { |
| // Sets the visibility of NTP tiles and whether custom links are enabled. |
| SetMostVisitedSettings(bool custom_links_enabled, bool shortcuts_visible); |
| |
| // Returns the visibility of NTP tiles and whether custom links are enabled. |
| GetMostVisitedSettings() => (bool custom_links_enabled, |
| bool shortcuts_visible); |
| |
| // Returns the chrome colors used in the customize chrome side panel. |
| GetChromeColors() => (array<ChromeColor> colors); |
| |
| // Returns the collections of background images. |
| GetBackgroundCollections() => (array<BackgroundCollection> collections); |
| |
| // Returns the images of a collection identified by |collection_id|. |
| GetBackgroundImages(string collection_id) => (array<CollectionImage> images); |
| |
| // Triggers a call to |CustomizeChromePage.SetModulesSettings|. |
| UpdateModulesSettings(); |
| |
| // Triggers a call to |CustomizeChromePage.SetTheme()|. |
| UpdateTheme(); |
| |
| // Sets Chrome's theme according to the default color. |
| SetDefaultColor(); |
| |
| // Sets a Chrome theme generated from |seed_color|. |
| SetSeedColor(skia.mojom.SkColor seed_color); |
| |
| // Sets theme to default classic chrome. |
| SetClassicChromeDefaultTheme(); |
| |
| // Choose custom background from local file system. |
| ChooseLocalCustomBackground() => (bool success); |
| |
| // Sets the background image and notifies all NTPs of the change. |
| SetBackgroundImage(string attribution_1, string attribution_2, |
| url.mojom.Url attribution_url, url.mojom.Url image_url, |
| url.mojom.Url thumbnail_url); |
| |
| // Sets collection id for daily refresh. When |collection_id| is empty, the |
| // daily refresh is turned off. |
| SetDailyRefreshCollectionId(string collection_id); |
| |
| // Open Chrome Web Store's theme page in a new tab. |
| OpenChromeWebStore(); |
| |
| // Opens link to Chrome Web Store theme in a new tab. |
| OpenThirdPartyThemePage(string theme_id); |
| |
| // If |visible| the modules will be shown. |
| SetModulesVisible(bool visible); |
| |
| // Disables module with ID `module_id` if `disabled`. Enables otherwise. |
| SetModuleDisabled(string module_id, bool disabled); |
| }; |
| |
| // WebUI-side handler for requests from the browser. |
| interface CustomizeChromePage { |
| // Sets available modules and their associated properties such as id, name, |
| // enabled status, visibility and managed state. |
| SetModulesSettings(array<ModuleSettings> modules_settings, bool managed, |
| bool visible); |
| // Sets the current theme. |
| SetTheme(Theme theme); |
| }; |