diff options
Diffstat (limited to 'chromium/chrome/services/app_service')
5 files changed, 0 insertions, 728 deletions
diff --git a/chromium/chrome/services/app_service/BUILD.gn b/chromium/chrome/services/app_service/BUILD.gn deleted file mode 100644 index 5aa18bbd834..00000000000 --- a/chromium/chrome/services/app_service/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2018 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. - -source_set("lib") { - sources = [ - "app_service_impl.cc", - "app_service_impl.h", - ] - - deps = [ - "//base", - "//components/prefs", - "//content/public/browser", - "//mojo/public/cpp/bindings", - ] - - public_deps = [ - "//chrome/services/app_service/public/cpp:preferred_apps", - "//chrome/services/app_service/public/mojom", - ] -} - -source_set("unit_tests") { - testonly = true - - sources = [ "app_service_impl_unittest.cc" ] - - deps = [ - ":lib", - "//chrome/services/app_service/public/cpp:intents", - "//chrome/services/app_service/public/cpp:preferred_apps", - "//testing/gtest", - ] -} diff --git a/chromium/chrome/services/app_service/public/cpp/BUILD.gn b/chromium/chrome/services/app_service/public/cpp/BUILD.gn deleted file mode 100644 index 3b3fc05ccfe..00000000000 --- a/chromium/chrome/services/app_service/public/cpp/BUILD.gn +++ /dev/null @@ -1,129 +0,0 @@ -# Copyright 2018 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. - -source_set("app_update") { - sources = [ - "app_registry_cache.cc", - "app_registry_cache.h", - "app_update.cc", - "app_update.h", - ] - - public_deps = [ "//chrome/services/app_service/public/mojom" ] -} - -if (is_chromeos) { - source_set("instance_update") { - sources = [ - "instance.cc", - "instance.h", - "instance_registry.cc", - "instance_registry.h", - "instance_update.cc", - "instance_update.h", - ] - deps = [ - "//content/public/browser", - "//skia", - "//ui/aura", - "//ui/compositor", - ] - } -} - -source_set("icon_loader") { - sources = [ - "icon_cache.cc", - "icon_cache.h", - "icon_coalescer.cc", - "icon_coalescer.h", - "icon_loader.cc", - "icon_loader.h", - ] - - public_deps = [ "//chrome/services/app_service/public/mojom" ] -} - -source_set("icon_loader_test_support") { - sources = [ - "stub_icon_loader.cc", - "stub_icon_loader.h", - ] - - deps = [ ":icon_loader" ] -} - -source_set("intents") { - sources = [ - "intent_filter_util.cc", - "intent_filter_util.h", - "intent_util.cc", - "intent_util.h", - ] - - deps = [ - "//base", - "//chrome/services/app_service/public/mojom", - "//components/services/app_service/public/cpp:intent_util", - "//url", - ] -} - -source_set("preferred_apps") { - sources = [ - "preferred_apps_converter.cc", - "preferred_apps_converter.h", - "preferred_apps_list.cc", - "preferred_apps_list.h", - ] - - deps = [ - ":intents", - "//base", - "//chrome/services/app_service/public/mojom", - "//url", - ] -} - -source_set("publisher") { - sources = [ - "publisher_base.cc", - "publisher_base.h", - ] - - deps = [ "//chrome/services/app_service/public/mojom" ] -} - -source_set("unit_tests") { - testonly = true - - sources = [ - "app_registry_cache_unittest.cc", - "app_update_unittest.cc", - "icon_cache_unittest.cc", - "icon_coalescer_unittest.cc", - "intent_test_util.cc", - "intent_test_util.h", - "intent_util_unittest.cc", - "preferred_apps_converter_unittest.cc", - "preferred_apps_list_unittest.cc", - ] - - deps = [ - ":app_update", - ":icon_loader", - ":publisher", - "//content/test:test_support", - "//testing/gtest", - ] - - if (is_chromeos) { - sources += [ - "instance_registry_unittest.cc", - "instance_update_unittest.cc", - ] - - deps += [ ":instance_update" ] - } -} diff --git a/chromium/chrome/services/app_service/public/mojom/BUILD.gn b/chromium/chrome/services/app_service/public/mojom/BUILD.gn deleted file mode 100644 index c9c68e018ce..00000000000 --- a/chromium/chrome/services/app_service/public/mojom/BUILD.gn +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2018 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 = [ "app_service.mojom" ] - - public_deps = [ - ":types", - "//components/services/app_service/public/mojom", - ] -} - -mojom("types") { - sources = [ "types.mojom" ] - - public_deps = [ - "//mojo/public/mojom/base", - "//ui/gfx/image/mojom", - ] -} diff --git a/chromium/chrome/services/app_service/public/mojom/app_service.mojom b/chromium/chrome/services/app_service/public/mojom/app_service.mojom deleted file mode 100644 index 0ff7c93e814..00000000000 --- a/chromium/chrome/services/app_service/public/mojom/app_service.mojom +++ /dev/null @@ -1,227 +0,0 @@ -// Copyright 2018 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 apps.mojom; - -import "chrome/services/app_service/public/mojom/types.mojom"; -import "components/services/app_service/public/mojom/types.mojom"; - -// An intermediary between M app consumers (e.g. app launcher UI, intent -// pickers) and N app providers (also known as app platforms, e.g. Android -// apps, Linux apps and Web apps). It abstracts over platform-specific -// implementations and allow consumers to issue generic queries (e.g. for an -// app's name and icon) that are satisfied by the appropriate provider. -// -// See chrome/services/app_service/README.md. -interface AppService { - // Called by a publisher of apps to register itself and its apps with the App - // Service. - RegisterPublisher(pending_remote<Publisher> publisher, AppType app_type); - - // Called by a consumer that wishes to know about available apps to register - // itself with the App Service. - RegisterSubscriber(pending_remote<Subscriber> subscriber, ConnectOptions? opts); - - // App Icon Factory methods. - LoadIcon( - AppType app_type, - string app_id, - IconKey icon_key, - IconCompression icon_compression, - int32 size_hint_in_dip, - bool allow_placeholder_icon) => (IconValue icon_value); - - // App Runner methods. - Launch( - AppType app_type, - string app_id, - int32 event_flags, - LaunchSource launch_source, - int64 display_id); - - // Launches an app with |app_id| and |file_path| - LaunchAppWithFiles( - AppType app_type, - string app_id, - LaunchContainer container, - int32 event_flags, - LaunchSource launch_source, - FilePaths file_paths); - - // Launches an app with |app_id| and Chrome OS generic |intent| irrespective - // of app platform. - LaunchAppWithIntent( - AppType app_type, - string app_id, - int32 event_flags, - Intent intent, - LaunchSource launch_source, - int64 display_id); - - SetPermission( - AppType app_type, - string app_id, - Permission permission); - - // Directly uninstalls |app_id| without prompting the user. - // |clear_site_data| is available for bookmark apps only. If true, any site - // data associated with the app will be removed.. - // |report_abuse| is available for Chrome Apps only. If true, the app will be - // reported for abuse to the Web Store. - Uninstall( - AppType app_type, - string app_id, - bool clear_site_data, - bool report_abuse); - - // Pauses an app to stop the current running app, and apply the icon effect. - PauseApp( - AppType app_type, - string app_id); - - // Unpauses an app, and recover the icon effect for the app. - UnpauseApps( - AppType app_type, - string app_id); - - // Returns the menu items for an app with |app_id|. - GetMenuModel( - AppType app_type, - string app_id, - MenuType menu_type, - int64 display_id) => (MenuItems menu_items); - - // Opens native settings for the app with |app_id|. - OpenNativeSettings( - AppType app_type, - string app_id); - - // Sets app identified by |app_id| as preferred app for |intent_filter|. - // |intent| is needed to set the preferred app in ARC. - // If the request is |from_publisher|, we would not sync the preferred - // app back to the publisher. - AddPreferredApp( - AppType app_type, - string app_id, - IntentFilter intent_filter, - Intent? intent, - bool from_publisher); - - // Removes all preferred app setting for an |app_id|. - RemovePreferredApp(AppType app_type, string app_id); - - // Resets app identified by |app_id| as preferred app for |intent_filter|. - RemovePreferredAppForFilter( - AppType app_type, - string app_id, - IntentFilter intent_filter); -}; - -interface Publisher { - // App Registry methods. - Connect(pending_remote<Subscriber> subscriber, ConnectOptions? opts); - - // App Icon Factory methods. - LoadIcon( - string app_id, - IconKey icon_key, - IconCompression icon_compression, - int32 size_hint_in_dip, - bool allow_placeholder_icon) => (IconValue icon_value); - - // App Runner methods. - Launch( - string app_id, - int32 event_flags, - LaunchSource launch_source, - int64 display_id); - - // Launches an app with |app_id| and |file_path| - LaunchAppWithFiles( - string app_id, - LaunchContainer container, - int32 event_flags, - LaunchSource launch_source, - FilePaths file_paths); - - // Launches an app with |app_id| and Chrome OS generic |intent| irrespective - // of app platform. - LaunchAppWithIntent( - string app_id, - int32 event_flags, - Intent intent, - LaunchSource launch_source, - int64 display_id); - - SetPermission( - string app_id, - Permission permission); - - // Directly uninstalls |app_id| without prompting the user. - // |clear_site_data| is available for bookmark apps only. If true, any site - // data associated with the app will be removed.. - // |report_abuse| is available for Chrome Apps only. If true, the app will be - // reported for abuse to the Web Store. - Uninstall( - string app_id, - bool clear_site_data, - bool report_abuse); - - // Pauses an app to stop the current running app, and apply the icon effect. - PauseApp( - string app_id); - - // Unpauses an app, and recover the icon effect for the app. - UnpauseApps( - string app_id); - - // Returns the menu items for an app with |app_id|. - GetMenuModel( - string app_id, - MenuType menu_type, - int64 display_id) => (MenuItems menu_items); - - // Opens native settings for the app with |app_id|. - OpenNativeSettings( - string app_id); - - // Indicates that the app identified by |app_id| has been set as a preferred - // app for |intent_filter|, and the |replaced_app_preferences| is the apps - // that are no longer preferred apps for their corresponding |intent_filters|. - // This method is used by the App Service to sync the change to publishers. - // |intent| is needed to set the preferred app in ARC. - OnPreferredAppSet( - string app_id, - IntentFilter intent_filter, - Intent intent, - ReplacedAppPreferences replaced_app_preferences); -}; - -interface Subscriber { - OnApps(array<App> deltas); - - // Binds this to the given receiver (message pipe endpoint), being to Mojo - // interfaces what POSIX's dup is to file descriptors. - // - // See https://groups.google.com/a/chromium.org/d/msg/chromium-mojo/nFhBzGsb5Pg/V7t_8kNRAgAJ - Clone(pending_receiver<Subscriber> receiver); - - // Indicates that the app identified by |app_id| has been set as a preferred - // app for |intent_fitler|. This method is used by the App Service to sync - // the change from one subscriber to the others. - OnPreferredAppSet(string app_id, - IntentFilter intent_filter); - - // Indicates that the app identified by |app_id| is no longer a preferred - // app for |intent_filter|. This method is used by the App Service to sync - // the change to all subscribers. - OnPreferredAppRemoved(string app_id, IntentFilter intent_filter); - - // Initialize the |preferred_apps| in the subscribers from the app service. - InitializePreferredApps(array<PreferredApp> preferred_apps); -}; - -struct ConnectOptions { - // TODO: some way to represent l10n info such as the UI language. -}; diff --git a/chromium/chrome/services/app_service/public/mojom/types.mojom b/chromium/chrome/services/app_service/public/mojom/types.mojom deleted file mode 100644 index 932dfa0266e..00000000000 --- a/chromium/chrome/services/app_service/public/mojom/types.mojom +++ /dev/null @@ -1,314 +0,0 @@ -// Copyright 2018 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 apps.mojom; - -import "mojo/public/mojom/base/file_path.mojom"; -import "mojo/public/mojom/base/time.mojom"; -import "ui/gfx/image/mojom/image.mojom"; - -// Information about an app. See chrome/services/app_service/README.md. -struct App { - AppType app_type; - string app_id; - - // The fields above are mandatory. Everything else below is optional. - - Readiness readiness; - string? name; - string? short_name; - - // The publisher-specific ID for this app, e.g. for Android apps, this field - // contains the Android package name. May be empty if AppId() should be - // considered as the canonical publisher ID. - string? publisher_id; - - string? description; - string? version; - array<string> additional_search_terms; - IconKey? icon_key; - mojo_base.mojom.Time? last_launch_time; - mojo_base.mojom.Time? install_time; - - // This vector must be treated atomically, if there is a permission - // change, the publisher must send through the entire list of permissions. - // Should contain no duplicate IDs. - // If empty during updates, Subscriber can assume no changes. - // There is no guarantee that this is sorted by any criteria. - array<Permission> permissions; - - // Whether the app was installed by sync, policy or as a default app. - InstallSource install_source; - - // Whether the app is an extensions::Extensions where is_platform_app() - // returns true. - OptionalBool is_platform_app; - - // TODO(nigeltao): be more principled, instead of ad hoc show_in_xxx and - // show_in_yyy fields? - OptionalBool recommendable; - OptionalBool searchable; - OptionalBool show_in_launcher; - OptionalBool show_in_search; - OptionalBool show_in_management; - - // Whether the app icon should add the notification badging. - OptionalBool has_badge; - - // Paused apps cannot be launched, and any running apps that become paused - // will be stopped. This is independent of whether or not the app is ready to - // be launched (defined by the Readiness field). - OptionalBool paused; - - // This vector stores all the intent filters defined in this app. Each - // intent filter defines a matching criteria for whether an intent can - // be handled by this app. One app can have multiple intent filters. - array<IntentFilter> intent_filters; - - // When adding new fields, also update the Merge method and other helpers in - // chrome/services/app_service/public/cpp/app_update.* -}; - -struct Permission { - // An AppType-specific value, opaque to the App Service. - // Different publishers (with different AppType's) can - // re-use the same numerical value to mean different things. - uint32 permission_id; - PermissionValueType value_type; - // The semantics of value depends on the value_type. - uint32 value; - // If the permission is managed by an enterprise policy. - bool is_managed; -}; - -// The types of apps available in the registry. -enum AppType { - kUnknown = 0, - kArc, // Android app. - kBuiltIn, // Built-in app. - kCrostini, // Linux (via Crostini) app. - kExtension, // Extension-backed app. - kWeb, // Web app. - kMacNative, // Native Mac app. - kPluginVm, // Plugin VM app. - kLacros, // Lacros app. -}; - -// Whether an app is ready to launch, i.e. installed. -enum Readiness { - kUnknown = 0, - kReady, // Installed and launchable. - kDisabledByBlacklist, // Disabled by SafeBrowsing. - kDisabledByPolicy, // Disabled by admin policy. - kDisabledByUser, // Disabled by explicit user action. - kTerminated, // Renderer process crashed. - kUninstalledByUser, -}; - -// How the app was installed. -enum InstallSource { - kUnknown = 0, - kSystem, // Installed with the system and is considered a part of the OS. - kPolicy, // Installed by policy. - kOem, // Installed by an OEM. - kDefault, // Preinstalled by default, but is not considered a system app. - kSync, // Installed by sync. - kUser, // Installed by user action. -}; - -// Augments a bool to include an 'unknown' value. -enum OptionalBool { - kUnknown = 0, - kFalse, - kTrue, -}; - -struct IconKey { - // A timeline value for icons that do not change. - const uint64 kDoesNotChangeOverTime = 0; - - const int32 kInvalidResourceId = 0; - - // A monotonically increasing number so that, after an icon update, a new - // IconKey, one that is different in terms of field-by-field equality, can be - // broadcast by a Publisher. - // - // The exact value of the number isn't important, only that newer IconKey's - // (those that were created more recently) have a larger timeline than older - // IconKey's. - // - // This is, in some sense, *a* version number, but the field is not called - // "version", to avoid any possible confusion that it encodes *the* app's - // version number, e.g. the "2.3.5" in "FooBar version 2.3.5 is installed". - // - // For example, if an app is disabled for some reason (so that its icon is - // grayed out), this would result in a different timeline even though the - // app's version is unchanged. - uint64 timeline; - // If non-zero (or equivalently, not equal to kInvalidResourceId), the - // compressed icon is compiled into the Chromium binary as a statically - // available, int-keyed resource. - int32 resource_id; - // A bitmask of icon post-processing effects, such as desaturation to gray - // and rounding the corners. - uint32 icon_effects; - - // When adding new fields, also update the IconLoader::Key type in - // chrome/services/app_service/public/cpp/icon_loader.* -}; - -enum IconCompression { - kUnknown, - kUncompressed, - kCompressed, -}; - -struct IconValue { - IconCompression icon_compression; - gfx.mojom.ImageSkia? uncompressed; - array<uint8>? compressed; - bool is_placeholder_icon; -}; - -// Enumeration of possible app launch sources. -// Note the enumeration is used in UMA histogram so entries -// should not be re-ordered or removed. -enum LaunchSource { - kUnknown = 0, - kFromAppListGrid = 1, // Grid of apps, not the search box. - kFromAppListGridContextMenu = 2, // Grid of apps; context menu. - kFromAppListQuery = 3, // Query-dependent results (larger icons). - kFromAppListQueryContextMenu = 4, // Query-dependent results; context menu. - kFromAppListRecommendation = 5, // Query-less recommendations (smaller - // icons). - kFromParentalControls = 6, // Parental Controls Settings Section and - // Per App time notification. - kFromShelf = 7, // Shelf. - kFromFileManager = 8, // FileManager. - kFromLink = 9, // Left-licking on links in the browser. - kFromOmnibox = 10, // Enter URL in the Omnibox in the browser. - kFromChromeInternal = 11, // Chrome internal call. - kFromKeyboard = 12, // Keyboard shortcut for opening app. - kFromOtherApp = 13, // Clicking link in another app or webui. - kFromMenu = 14, // Menu. - kFromInstalledNotification = 15, // Installed notification - kFromTest = 16, // Test - kFromArc = 17, // Arc. -}; - -enum TriState { - kAllow, - kBlock, - kAsk, -}; - -enum PermissionValueType { - kBool, // Permission.value is a Bool (either 0 or 1). - kTriState, // Permission.value is a TriState. -}; - -// MenuItems are used to populate context menus, e.g. in the app list or shelf. -// Note: Some menu item types only support a subset of these item features. -// Please update comments below (MenuItemType -> [fields expected for usage]) -// when anything changed to MenuItemType or MenuItem. -// -// kCommand -> [command_id, string_id]. -// kRadio -> [command_id, string_id, radio_group_id]. -// kSeparator -> [command_id]. -// kSubmenu -> [command_id, string_id, submenu]. -// kArcCommand -> [command_id, shortcut_id, label, image]. -// -struct MenuItems { - array<MenuItem> items; -}; - -struct MenuItem { - MenuItemType type; // The type of the menu item. - int32 command_id; // The menu item command id. - int32 string_id; // The id of the menu item label. - array<MenuItem> submenu; // The optional nested submenu item list. - int32 radio_group_id; // The radio group id. - string shortcut_id; // The shortcut id, may be empty. - string label; // The string label, may be empty. - gfx.mojom.ImageSkia? image; // The image icon, may be null. -}; - -// The types of menu items shown in the app list or shelf. -enum MenuItemType { - kCommand, // Performs an action when selected. - kRadio, // Can be selected/checked among a group of choices. - kSeparator, // Shows a horizontal line separator. - kSubmenu, // Presents a submenu within another menu. - kArcCommand, // Performs an ARC shortcut action when selected. -}; - -// Which component requests context menus, the app list or shelf. -enum MenuType { - kAppList, - kShelf, -}; - -// The intent filter matching condition types. -enum ConditionType { - kScheme, // Matches the URL scheme (e.g. https, tel). - kHost, // Matches the URL host (e.g. www.google.com). - kPattern, // Matches the URL pattern (e.g. /abc/*). -}; - -// The pattern match type for intent filter pattern condition. -enum PatternMatchType { - kNone = 0, - kLiteral, - kPrefix, - kGlob, -}; - -// For pattern type of condition, the value match will be based on the pattern -// match type. If the match_type is kNone, then an exact match with the value -// will be required. -struct ConditionValue { - string value; - PatternMatchType match_type; // This will be None for non pattern conditions. -}; - -// The condition for an intent filter. It matches if the intent contains this -// condition type and the corresponding value matches with any of the -// condition_values. -struct Condition { - ConditionType condition_type; - array<ConditionValue> condition_values; -}; - -// An intent filter is defined by an app, and contains a list of conditions that -// an intent needs to match. If all conditions match, then this intent filter -// matches against an intent. -struct IntentFilter { - array<Condition> conditions; -}; - -// Action and resource handling request. This includes the scheme and URL at -// the moment, and will be extended to handle MIME type and file extensions in -// the future. -struct Intent { - string? scheme; // URL scheme. e.g. https. - string? host; // URL host. e.g. www.google.com. - string? port; // URL host. e.g. 8080. - string? path; // URL path. e.g. /abc. -}; - -// Represents a group of |app_ids| that is no longer preferred app of their -// corresponding |intent_filters|. -struct ReplacedAppPreferences { - map<string, array<IntentFilter>> replaced_preference; -}; - -// The preferred app represents by |app_id| for |intent_fitler|. -struct PreferredApp { - IntentFilter intent_filter; - string app_id; -}; - -struct FilePaths { - array<mojo_base.mojom.FilePath> file_paths; -}; |