[AUTO][FILECONTROL] - version 128.0.6613.114 (#1408)
[AUTO][FILECONTROL] - version 128.0.6613.114
This commit is contained in:
@@ -1 +1 @@
|
||||
128.0.6613.88
|
||||
128.0.6613.114
|
||||
|
||||
+1419
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,273 @@
|
||||
// Copyright 2020 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "android_webview/browser/aw_field_trials.h"
|
||||
|
||||
#include "android_webview/common/aw_switches.h"
|
||||
#include "base/base_paths_android.h"
|
||||
#include "base/check.h"
|
||||
#include "base/feature_list.h"
|
||||
#include "base/memory/raw_ref.h"
|
||||
#include "base/metrics/field_trial.h"
|
||||
#include "base/metrics/field_trial_params.h"
|
||||
#include "base/metrics/persistent_histogram_allocator.h"
|
||||
#include "base/path_service.h"
|
||||
#include "components/history/core/browser/features.h"
|
||||
#include "components/metrics/persistent_histograms.h"
|
||||
#include "components/permissions/features.h"
|
||||
#include "components/safe_browsing/core/common/features.h"
|
||||
#include "components/translate/core/common/translate_util.h"
|
||||
#include "components/viz/common/features.h"
|
||||
#include "content/public/common/content_features.h"
|
||||
#include "gpu/config/gpu_finch_features.h"
|
||||
#include "media/base/media_switches.h"
|
||||
#include "mojo/public/cpp/bindings/features.h"
|
||||
#include "net/base/features.h"
|
||||
#include "services/network/public/cpp/features.h"
|
||||
#include "third_party/blink/public/common/features.h"
|
||||
#include "ui/android/ui_android_features.h"
|
||||
#include "ui/gl/gl_features.h"
|
||||
|
||||
namespace {
|
||||
|
||||
class AwFeatureOverrides {
|
||||
public:
|
||||
explicit AwFeatureOverrides(base::FeatureList& feature_list)
|
||||
: feature_list_(feature_list) {}
|
||||
|
||||
AwFeatureOverrides(const AwFeatureOverrides& other) = delete;
|
||||
AwFeatureOverrides& operator=(const AwFeatureOverrides& other) = delete;
|
||||
|
||||
~AwFeatureOverrides() {
|
||||
for (const auto& field_trial_override : field_trial_overrides_) {
|
||||
feature_list_->RegisterFieldTrialOverride(
|
||||
field_trial_override.feature->name,
|
||||
field_trial_override.override_state,
|
||||
field_trial_override.field_trial);
|
||||
}
|
||||
feature_list_->RegisterExtraFeatureOverrides(std::move(overrides_));
|
||||
}
|
||||
|
||||
// Enable a feature with WebView-specific override.
|
||||
void EnableFeature(const base::Feature& feature) {
|
||||
overrides_.emplace_back(
|
||||
std::cref(feature),
|
||||
base::FeatureList::OverrideState::OVERRIDE_ENABLE_FEATURE);
|
||||
}
|
||||
|
||||
// Disable a feature with WebView-specific override.
|
||||
void DisableFeature(const base::Feature& feature) {
|
||||
overrides_.emplace_back(
|
||||
std::cref(feature),
|
||||
base::FeatureList::OverrideState::OVERRIDE_DISABLE_FEATURE);
|
||||
}
|
||||
|
||||
// Enable or disable a feature with a field trial. This can be used for
|
||||
// setting feature parameters.
|
||||
void OverrideFeatureWithFieldTrial(
|
||||
const base::Feature& feature,
|
||||
base::FeatureList::OverrideState override_state,
|
||||
base::FieldTrial* field_trial) {
|
||||
field_trial_overrides_.emplace_back(FieldTrialOverride{
|
||||
.feature = raw_ref(feature),
|
||||
.override_state = override_state,
|
||||
.field_trial = field_trial,
|
||||
});
|
||||
}
|
||||
|
||||
private:
|
||||
struct FieldTrialOverride {
|
||||
raw_ref<const base::Feature> feature;
|
||||
base::FeatureList::OverrideState override_state;
|
||||
raw_ptr<base::FieldTrial> field_trial;
|
||||
};
|
||||
|
||||
base::raw_ref<base::FeatureList> feature_list_;
|
||||
std::vector<base::FeatureList::FeatureOverrideInfo> overrides_;
|
||||
std::vector<FieldTrialOverride> field_trial_overrides_;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
void AwFieldTrials::OnVariationsSetupComplete() {
|
||||
// Persistent histograms must be enabled ASAP, but depends on Features.
|
||||
base::FilePath metrics_dir;
|
||||
if (base::PathService::Get(base::DIR_ANDROID_APP_DATA, &metrics_dir)) {
|
||||
InstantiatePersistentHistogramsWithFeaturesAndCleanup(metrics_dir);
|
||||
} else {
|
||||
NOTREACHED_IN_MIGRATION();
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(crbug.com/40271903): Consider to migrate all WebView feature overrides
|
||||
// from the AwMainDelegate to the new mechanism here.
|
||||
void AwFieldTrials::RegisterFeatureOverrides(base::FeatureList* feature_list) {
|
||||
if (!feature_list) {
|
||||
return;
|
||||
}
|
||||
AwFeatureOverrides aw_feature_overrides(*feature_list);
|
||||
|
||||
// Disable third-party storage partitioning on WebView.
|
||||
aw_feature_overrides.DisableFeature(
|
||||
net::features::kThirdPartyStoragePartitioning);
|
||||
|
||||
// Disable the passthrough on WebView.
|
||||
aw_feature_overrides.DisableFeature(
|
||||
::features::kDefaultPassthroughCommandDecoder);
|
||||
|
||||
// HDR does not support webview yet. See crbug.com/1493153 for an explanation.
|
||||
aw_feature_overrides.DisableFeature(ui::kAndroidHDR);
|
||||
|
||||
// Disable Reducing User Agent minor version on WebView.
|
||||
aw_feature_overrides.DisableFeature(
|
||||
blink::features::kReduceUserAgentMinorVersion);
|
||||
|
||||
// Disable fenced frames on WebView.
|
||||
aw_feature_overrides.DisableFeature(blink::features::kFencedFrames);
|
||||
|
||||
// Disable FLEDGE on WebView.
|
||||
aw_feature_overrides.DisableFeature(blink::features::kAdInterestGroupAPI);
|
||||
aw_feature_overrides.DisableFeature(blink::features::kFledge);
|
||||
|
||||
// Disable low latency overlay for WebView. There is currently no plan to
|
||||
// enable these optimizations in WebView though they are not fundamentally
|
||||
// impossible.
|
||||
aw_feature_overrides.DisableFeature(
|
||||
blink::features::kLowLatencyCanvas2dImageChromium);
|
||||
aw_feature_overrides.DisableFeature(
|
||||
blink::features::kLowLatencyWebGLImageChromium);
|
||||
|
||||
// Disable Shared Storage on WebView.
|
||||
aw_feature_overrides.DisableFeature(blink::features::kSharedStorageAPI);
|
||||
aw_feature_overrides.DisableFeature(blink::features::kSharedStorageAPIM125);
|
||||
|
||||
// Disable scrollbar-color on WebView.
|
||||
aw_feature_overrides.DisableFeature(blink::features::kScrollbarColor);
|
||||
|
||||
// Disable scrollbar-width on WebView.
|
||||
aw_feature_overrides.DisableFeature(blink::features::kScrollbarWidth);
|
||||
|
||||
// Disable Populating the VisitedLinkDatabase on WebView.
|
||||
aw_feature_overrides.DisableFeature(history::kPopulateVisitedLinkDatabase);
|
||||
|
||||
// WebView uses kWebViewVulkan to control vulkan. Pre-emptively disable
|
||||
// kVulkan in case it becomes enabled by default.
|
||||
aw_feature_overrides.DisableFeature(::features::kVulkan);
|
||||
|
||||
aw_feature_overrides.DisableFeature(::features::kWebPayments);
|
||||
aw_feature_overrides.DisableFeature(::features::kServiceWorkerPaymentApps);
|
||||
|
||||
// WebView does not support overlay fullscreen yet for video overlays.
|
||||
aw_feature_overrides.DisableFeature(media::kOverlayFullscreenVideo);
|
||||
|
||||
// WebView does not support EME persistent license yet, because it's not
|
||||
// clear on how user can remove persistent media licenses from UI.
|
||||
aw_feature_overrides.DisableFeature(media::kMediaDrmPersistentLicense);
|
||||
|
||||
aw_feature_overrides.DisableFeature(::features::kBackgroundFetch);
|
||||
|
||||
// SurfaceControl is controlled by kWebViewSurfaceControl flag.
|
||||
aw_feature_overrides.DisableFeature(::features::kAndroidSurfaceControl);
|
||||
|
||||
// TODO(crbug.com/40627649): WebOTP is not yet supported on
|
||||
// WebView.
|
||||
aw_feature_overrides.DisableFeature(::features::kWebOTP);
|
||||
|
||||
// TODO(crbug.com/40652382): WebXR is not yet supported on WebView.
|
||||
aw_feature_overrides.DisableFeature(::features::kWebXr);
|
||||
|
||||
// TODO(crbug.com/40831925): Digital Goods API is not yet supported
|
||||
// on WebView.
|
||||
aw_feature_overrides.DisableFeature(::features::kDigitalGoodsApi);
|
||||
|
||||
aw_feature_overrides.DisableFeature(::features::kDynamicColorGamut);
|
||||
|
||||
// COOP is not supported on WebView yet. See:
|
||||
// https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/XBKAGb2_7uAi.
|
||||
aw_feature_overrides.DisableFeature(
|
||||
network::features::kCrossOriginOpenerPolicy);
|
||||
|
||||
aw_feature_overrides.DisableFeature(::features::kInstalledApp);
|
||||
|
||||
aw_feature_overrides.DisableFeature(::features::kPeriodicBackgroundSync);
|
||||
|
||||
// Disabled until viz scheduling can be improved.
|
||||
aw_feature_overrides.DisableFeature(
|
||||
::features::kUseSurfaceLayerForVideoDefault);
|
||||
|
||||
// Disable dr-dc on webview.
|
||||
aw_feature_overrides.DisableFeature(::features::kEnableDrDc);
|
||||
|
||||
// TODO(crbug.com/40703318): Web Bluetooth is not yet supported on WebView.
|
||||
aw_feature_overrides.DisableFeature(::features::kWebBluetooth);
|
||||
|
||||
// TODO(crbug.com/41441927): WebUSB is not yet supported on WebView.
|
||||
aw_feature_overrides.DisableFeature(::features::kWebUsb);
|
||||
|
||||
// Disable TFLite based language detection on webview until webview supports
|
||||
// ML model delivery via Optimization Guide component.
|
||||
// TODO(crbug.com/40819484): Enable the feature on Webview.
|
||||
aw_feature_overrides.DisableFeature(
|
||||
::translate::kTFLiteLanguageDetectionEnabled);
|
||||
|
||||
// Disable key pinning enforcement on webview.
|
||||
aw_feature_overrides.DisableFeature(
|
||||
net::features::kStaticKeyPinningEnforcement);
|
||||
|
||||
// FedCM is not yet supported on WebView.
|
||||
aw_feature_overrides.DisableFeature(::features::kFedCm);
|
||||
|
||||
// TODO(crbug.com/40272633): Web MIDI permission prompt for all usage.
|
||||
aw_feature_overrides.DisableFeature(blink::features::kBlockMidiByDefault);
|
||||
|
||||
// Disable device posture API as the framework implementation causes
|
||||
// AwContents to leak in apps that don't call destroy().
|
||||
aw_feature_overrides.DisableFeature(blink::features::kDevicePosture);
|
||||
aw_feature_overrides.DisableFeature(blink::features::kViewportSegments);
|
||||
|
||||
// New Safe Browsing API is still being rolled out on WebView.
|
||||
aw_feature_overrides.DisableFeature(
|
||||
safe_browsing::kSafeBrowsingNewGmsApiForBrowseUrlDatabaseCheck);
|
||||
|
||||
// PaintHolding for OOPIFs. This should be a no-op since WebView doesn't use
|
||||
// site isolation but field trial testing doesn't indicate that. Revisit when
|
||||
// enabling site isolation. See crbug.com/356170748.
|
||||
aw_feature_overrides.DisableFeature(blink::features::kPaintHoldingForIframes);
|
||||
|
||||
if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kDebugBsa)) {
|
||||
// Feature parameters can only be set via a field trial.
|
||||
const char kTrialName[] = "StudyDebugBsa";
|
||||
const char kGroupName[] = "GroupDebugBsa";
|
||||
base::FieldTrial* field_trial =
|
||||
base::FieldTrialList::CreateFieldTrial(kTrialName, kGroupName);
|
||||
// If field_trial is null, there was some unexpected name conflict.
|
||||
CHECK(field_trial);
|
||||
base::FieldTrialParams params;
|
||||
params.emplace(net::features::kIpPrivacyTokenServer.name,
|
||||
"https://staging-phosphor-pa.sandbox.googleapis.com");
|
||||
base::AssociateFieldTrialParams(kTrialName, kGroupName, params);
|
||||
aw_feature_overrides.OverrideFeatureWithFieldTrial(
|
||||
net::features::kEnableIpProtectionProxy,
|
||||
base::FeatureList::OverrideState::OVERRIDE_ENABLE_FEATURE, field_trial);
|
||||
aw_feature_overrides.EnableFeature(network::features::kMaskedDomainList);
|
||||
}
|
||||
|
||||
// Delete Incidental Party State (DIPS) feature is not yet supported on
|
||||
// WebView.
|
||||
// TODO(b/344852824): Enable the feature for WebView
|
||||
aw_feature_overrides.DisableFeature(::features::kDIPS);
|
||||
|
||||
// Async Safe Browsing check will be rolled out together with
|
||||
// kHashPrefixRealTimeLookups on WebView.
|
||||
aw_feature_overrides.DisableFeature(
|
||||
safe_browsing::kSafeBrowsingAsyncRealTimeCheck);
|
||||
|
||||
// WebView does not currently support the Permissions API (crbug.com/490120)
|
||||
aw_feature_overrides.DisableFeature(::features::kWebPermissionsApi);
|
||||
|
||||
// TODO(crbug.com/356827071): Enable the feature for WebView.
|
||||
// Disable PlzDedicatedWorker as a workaround for crbug.com/356827071.
|
||||
// Otherwise, importScripts fails on WebView.
|
||||
aw_feature_overrides.DisableFeature(blink::features::kPlzDedicatedWorker);
|
||||
}
|
||||
+1363
File diff suppressed because it is too large
Load Diff
Executable
+1752
File diff suppressed because it is too large
Load Diff
+1956
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+2722
File diff suppressed because it is too large
Load Diff
+840
@@ -0,0 +1,840 @@
|
||||
// Copyright 2014 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "chrome/browser/ui/tab_helpers.h"
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/feature_list.h"
|
||||
#include "base/time/default_tick_clock.h"
|
||||
#include "base/trace_event/trace_event.h"
|
||||
#include "build/build_config.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
|
||||
#include "chrome/browser/breadcrumbs/breadcrumb_manager_tab_helper.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "chrome/browser/buildflags.h"
|
||||
#include "chrome/browser/captive_portal/captive_portal_service_factory.h"
|
||||
#include "chrome/browser/chained_back_navigation_tracker.h"
|
||||
#include "chrome/browser/chrome_content_browser_client.h"
|
||||
#include "chrome/browser/commerce/shopping_service_factory.h"
|
||||
#include "chrome/browser/complex_tasks/task_tab_helper.h"
|
||||
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
|
||||
#include "chrome/browser/content_settings/mixed_content_settings_tab_helper.h"
|
||||
#include "chrome/browser/content_settings/page_specific_content_settings_delegate.h"
|
||||
#include "chrome/browser/content_settings/sound_content_setting_observer.h"
|
||||
#include "chrome/browser/dips/dips_bounce_detector.h"
|
||||
#include "chrome/browser/dips/dips_service.h"
|
||||
#include "chrome/browser/enterprise/data_protection/data_protection_navigation_controller.h"
|
||||
#include "chrome/browser/external_protocol/external_protocol_observer.h"
|
||||
#include "chrome/browser/favicon/favicon_utils.h"
|
||||
#include "chrome/browser/file_system_access/file_system_access_features.h"
|
||||
#include "chrome/browser/file_system_access/file_system_access_permission_request_manager.h"
|
||||
#include "chrome/browser/file_system_access/file_system_access_tab_helper.h"
|
||||
#include "chrome/browser/fingerprinting_protection/chrome_fingerprinting_protection_web_contents_helper_factory.h"
|
||||
#include "chrome/browser/history/history_tab_helper.h"
|
||||
#include "chrome/browser/history/top_sites_factory.h"
|
||||
#include "chrome/browser/history_clusters/history_clusters_tab_helper.h"
|
||||
#include "chrome/browser/history_embeddings/history_embeddings_tab_helper.h"
|
||||
#include "chrome/browser/image_fetcher/image_fetcher_service_factory.h"
|
||||
#include "chrome/browser/login_detection/login_detection_tab_helper.h"
|
||||
#include "chrome/browser/lookalikes/safety_tip_web_contents_observer.h"
|
||||
#include "chrome/browser/media/media_engagement_service.h"
|
||||
#include "chrome/browser/metrics/desktop_session_duration/desktop_session_duration_observer.h"
|
||||
#include "chrome/browser/navigation_predictor/navigation_predictor_preconnect_client.h"
|
||||
#include "chrome/browser/net/net_error_tab_helper.h"
|
||||
#include "chrome/browser/optimization_guide/optimization_guide_keyed_service.h"
|
||||
#include "chrome/browser/optimization_guide/optimization_guide_keyed_service_factory.h"
|
||||
#include "chrome/browser/optimization_guide/optimization_guide_web_contents_observer.h"
|
||||
#include "chrome/browser/page_content_annotations/page_content_annotations_service_factory.h"
|
||||
#include "chrome/browser/page_content_annotations/page_content_annotations_web_contents_observer.h"
|
||||
#include "chrome/browser/page_info/about_this_site_tab_helper.h"
|
||||
#include "chrome/browser/page_info/page_info_features.h"
|
||||
#include "chrome/browser/page_load_metrics/page_load_metrics_initialize.h"
|
||||
#include "chrome/browser/password_manager/chrome_password_manager_client.h"
|
||||
#include "chrome/browser/permissions/one_time_permissions_tracker_helper.h"
|
||||
#include "chrome/browser/predictors/loading_predictor_factory.h"
|
||||
#include "chrome/browser/predictors/loading_predictor_tab_helper.h"
|
||||
#include "chrome/browser/preloading/prefetch/no_state_prefetch/no_state_prefetch_manager_factory.h"
|
||||
#include "chrome/browser/preloading/prefetch/no_state_prefetch/no_state_prefetch_tab_helper.h"
|
||||
#include "chrome/browser/privacy_sandbox/tracking_protection_settings_factory.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "chrome/browser/profiles/profile_key.h"
|
||||
#include "chrome/browser/resource_coordinator/tab_helper.h"
|
||||
#include "chrome/browser/safe_browsing/chrome_password_reuse_detection_manager_client.h"
|
||||
#include "chrome/browser/safe_browsing/chrome_safe_browsing_tab_observer_delegate.h"
|
||||
#include "chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager_factory.h"
|
||||
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
|
||||
#include "chrome/browser/safe_browsing/tailored_security/tailored_security_service_factory.h"
|
||||
#include "chrome/browser/safe_browsing/tailored_security/tailored_security_url_observer.h"
|
||||
#include "chrome/browser/safe_browsing/trigger_creator.h"
|
||||
#include "chrome/browser/sessions/session_tab_helper_factory.h"
|
||||
#include "chrome/browser/ssl/chrome_security_blocking_page_factory.h"
|
||||
#include "chrome/browser/ssl/connection_help_tab_helper.h"
|
||||
#include "chrome/browser/ssl/https_only_mode_tab_helper.h"
|
||||
#include "chrome/browser/ssl/security_state_tab_helper.h"
|
||||
#include "chrome/browser/storage_access_api/storage_access_api_service_factory.h"
|
||||
#include "chrome/browser/storage_access_api/storage_access_api_service_impl.h"
|
||||
#include "chrome/browser/storage_access_api/storage_access_api_tab_helper.h"
|
||||
#include "chrome/browser/subresource_filter/chrome_content_subresource_filter_web_contents_helper_factory.h"
|
||||
#include "chrome/browser/supervised_user/supervised_user_navigation_observer.h"
|
||||
#include "chrome/browser/sync/sessions/sync_sessions_router_tab_helper.h"
|
||||
#include "chrome/browser/sync/sessions/sync_sessions_web_contents_router_factory.h"
|
||||
#include "chrome/browser/tab_contents/navigation_metrics_recorder.h"
|
||||
#include "chrome/browser/tpcd/heuristics/opener_heuristic_tab_helper.h"
|
||||
#include "chrome/browser/tpcd/heuristics/redirect_heuristic_tab_helper.h"
|
||||
#include "chrome/browser/tpcd/http_error_observer/http_error_tab_helper.h"
|
||||
#include "chrome/browser/tpcd/metadata/devtools_observer.h"
|
||||
#include "chrome/browser/tpcd/support/validity_service.h"
|
||||
#include "chrome/browser/translate/chrome_translate_client.h"
|
||||
#include "chrome/browser/trusted_vault/trusted_vault_encryption_keys_tab_helper.h"
|
||||
#include "chrome/browser/ui/autofill/autofill_client_provider.h"
|
||||
#include "chrome/browser/ui/autofill/autofill_client_provider_factory.h"
|
||||
#include "chrome/browser/ui/find_bar/find_bar_state.h"
|
||||
#include "chrome/browser/ui/focus_tab_after_navigation_helper.h"
|
||||
#include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h"
|
||||
#include "chrome/browser/ui/performance_controls/memory_saver_chip_tab_helper.h"
|
||||
#include "chrome/browser/ui/performance_controls/tab_resource_usage_tab_helper.h"
|
||||
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
|
||||
#include "chrome/browser/ui/privacy_sandbox/privacy_sandbox_prompt_helper.h"
|
||||
#include "chrome/browser/ui/recently_audible_helper.h"
|
||||
#include "chrome/browser/ui/safety_hub/unused_site_permissions_service.h"
|
||||
#include "chrome/browser/ui/safety_hub/unused_site_permissions_service_factory.h"
|
||||
#include "chrome/browser/ui/search_engines/search_engine_tab_helper.h"
|
||||
#include "chrome/browser/ui/tab_contents/core_tab_helper.h"
|
||||
#include "chrome/browser/ui/tab_dialogs.h"
|
||||
#include "chrome/browser/ui/tab_ui_helper.h"
|
||||
#include "chrome/browser/ui/thumbnails/thumbnail_tab_helper.h"
|
||||
#include "chrome/browser/ui/views/side_panel/companion/companion_utils.h"
|
||||
#include "chrome/browser/v8_compile_hints/v8_compile_hints_tab_helper.h"
|
||||
#include "chrome/browser/vr/vr_tab_helper.h"
|
||||
#include "chrome/common/buildflags.h"
|
||||
#include "chrome/common/chrome_features.h"
|
||||
#include "chrome/common/chrome_isolated_world_ids.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "components/autofill/content/browser/content_autofill_client.h"
|
||||
#include "components/autofill/content/browser/content_autofill_driver_factory.h"
|
||||
#include "components/autofill/core/browser/browser_autofill_manager.h"
|
||||
#include "components/blocked_content/popup_blocker_tab_helper.h"
|
||||
#include "components/blocked_content/popup_opener_tab_helper.h"
|
||||
#include "components/breadcrumbs/core/breadcrumbs_status.h"
|
||||
#include "components/browsing_topics/browsing_topics_redirect_observer.h"
|
||||
#include "components/captive_portal/core/buildflags.h"
|
||||
#include "components/client_hints/browser/client_hints_web_contents_observer.h"
|
||||
#include "components/commerce/content/browser/commerce_tab_helper.h"
|
||||
#include "components/commerce/core/commerce_feature_list.h"
|
||||
#include "components/compose/buildflags.h"
|
||||
#include "components/content_settings/browser/page_specific_content_settings.h"
|
||||
#include "components/dom_distiller/core/dom_distiller_features.h"
|
||||
#include "components/download/content/factory/navigation_monitor_factory.h"
|
||||
#include "components/download/content/public/download_navigation_observer.h"
|
||||
#include "components/enterprise/buildflags/buildflags.h"
|
||||
#include "components/feed/buildflags.h"
|
||||
#include "components/fingerprinting_protection_filter/common/fingerprinting_protection_filter_features.h"
|
||||
#include "components/history/content/browser/web_contents_top_sites_observer.h"
|
||||
#include "components/history/core/browser/top_sites.h"
|
||||
#include "components/infobars/content/content_infobar_manager.h"
|
||||
#include "components/javascript_dialogs/tab_modal_dialog_manager.h"
|
||||
#include "components/metrics/content/metrics_services_web_contents_observer.h"
|
||||
#include "components/metrics_services_manager/metrics_services_manager.h"
|
||||
#include "components/no_state_prefetch/browser/no_state_prefetch_manager.h"
|
||||
#include "components/offline_pages/buildflags/buildflags.h"
|
||||
#include "components/optimization_guide/core/optimization_guide_features.h"
|
||||
#include "components/page_info/core/features.h"
|
||||
#include "components/password_manager/core/browser/password_manager.h"
|
||||
#include "components/performance_manager/embedder/performance_manager_registry.h"
|
||||
#include "components/performance_manager/public/features.h"
|
||||
#include "components/permissions/features.h"
|
||||
#include "components/permissions/permission_recovery_success_rate_tracker.h"
|
||||
#include "components/permissions/permission_request_manager.h"
|
||||
#include "components/safe_browsing/content/browser/async_check_tracker.h"
|
||||
#include "components/safe_browsing/content/browser/safe_browsing_navigation_observer.h"
|
||||
#include "components/safe_browsing/content/browser/safe_browsing_tab_observer.h"
|
||||
#include "components/safe_browsing/core/common/features.h"
|
||||
#include "components/search/ntp_features.h"
|
||||
#include "components/site_engagement/content/site_engagement_helper.h"
|
||||
#include "components/site_engagement/content/site_engagement_service.h"
|
||||
#include "components/tracing/common/tracing_switches.h"
|
||||
#include "components/ukm/content/source_url_recorder.h"
|
||||
#include "components/user_notes/user_notes_features.h"
|
||||
#include "components/webapps/browser/installable/installable_manager.h"
|
||||
#include "components/webapps/browser/installable/ml_installability_promoter.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "extensions/buildflags/buildflags.h"
|
||||
#include "media/base/media_switches.h"
|
||||
#include "pdf/buildflags.h"
|
||||
#include "ppapi/buildflags/buildflags.h"
|
||||
#include "printing/buildflags/buildflags.h"
|
||||
#include "rlz/buildflags/buildflags.h"
|
||||
#include "ui/accessibility/accessibility_features.h"
|
||||
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "chrome/browser/android/oom_intervention/oom_intervention_tab_helper.h"
|
||||
#include "chrome/browser/android/persisted_tab_data/sensitivity_persisted_tab_data_android.h"
|
||||
#include "chrome/browser/android/policy/policy_auditor_bridge.h"
|
||||
#include "chrome/browser/banners/android/chrome_app_banner_manager_android.h"
|
||||
#include "chrome/browser/content_settings/request_desktop_site_web_contents_observer_android.h"
|
||||
#include "chrome/browser/dips/dips_navigation_flow_detector.h"
|
||||
#include "chrome/browser/facilitated_payments/ui/chrome_facilitated_payments_client.h"
|
||||
#include "chrome/browser/fast_checkout/fast_checkout_tab_helper.h"
|
||||
#include "chrome/browser/flags/android/chrome_feature_list.h"
|
||||
#include "chrome/browser/plugins/plugin_observer_android.h"
|
||||
#include "chrome/browser/ui/android/context_menu_helper.h"
|
||||
#include "chrome/browser/ui/javascript_dialogs/javascript_tab_modal_dialog_manager_delegate_android.h"
|
||||
#include "components/facilitated_payments/core/features/features.h"
|
||||
#include "components/webapps/browser/android/app_banner_manager_android.h"
|
||||
#include "content/public/common/content_features.h"
|
||||
#else
|
||||
#include "chrome/browser/banners/app_banner_manager_desktop.h"
|
||||
#include "chrome/browser/companion/core/features.h"
|
||||
#include "chrome/browser/picture_in_picture/auto_picture_in_picture_tab_helper.h"
|
||||
#include "chrome/browser/preloading/prefetch/zero_suggest_prefetch/zero_suggest_prefetch_tab_helper.h"
|
||||
#include "chrome/browser/tab_contents/form_interaction_tab_helper.h"
|
||||
#include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
|
||||
#include "chrome/browser/ui/commerce/commerce_ui_tab_helper.h"
|
||||
#include "chrome/browser/ui/intent_picker_tab_helper.h"
|
||||
#include "chrome/browser/ui/javascript_dialogs/javascript_tab_modal_dialog_manager_delegate_desktop.h"
|
||||
#include "chrome/browser/ui/sad_tab_helper.h"
|
||||
#include "chrome/browser/ui/search/search_tab_helper.h"
|
||||
#include "chrome/browser/ui/search_engine_choice/search_engine_choice_tab_helper.h"
|
||||
#include "chrome/browser/ui/views/side_panel/companion/companion_tab_helper.h"
|
||||
#include "chrome/browser/ui/views/side_panel/companion/exps_registration_success_observer.h"
|
||||
#include "chrome/browser/ui/views/side_panel/history_clusters/history_clusters_tab_helper.h"
|
||||
#include "chrome/browser/ui/views/side_panel/read_anything/read_anything_tab_helper.h"
|
||||
#include "chrome/browser/ui/sync/browser_synced_tab_delegate.h"
|
||||
#include "chrome/browser/ui/ui_features.h"
|
||||
#include "chrome/browser/ui/uma_browsing_activity_observer.h"
|
||||
#include "components/commerce/content/browser/hint/commerce_hint_tab_helper.h"
|
||||
#include "components/image_fetcher/core/image_fetcher_service.h"
|
||||
#include "components/omnibox/browser/omnibox_field_trial.h"
|
||||
#include "components/web_modal/web_contents_modal_dialog_manager.h"
|
||||
#include "components/zoom/zoom_controller.h"
|
||||
#include "third_party/blink/public/common/features.h"
|
||||
#endif // BUILDFLAG(IS_ANDROID)
|
||||
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
#include "chrome/browser/ui/side_search/side_search_tab_contents_helper.h"
|
||||
#include "chrome/browser/ui/side_search/side_search_utils.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
#include "chrome/browser/ash/boot_times_recorder_tab_helper.h"
|
||||
#include "chrome/browser/ash/growth/campaigns_manager_session_tab_helper.h"
|
||||
#include "chrome/browser/ui/ash/google_one_offer_iph_tab_helper.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS_LACROS)
|
||||
#include "chrome/browser/lacros/web_contents_can_go_back_observer.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS)
|
||||
#include "chrome/browser/chromeos/container_app/container_app_tab_helper.h"
|
||||
#include "chrome/browser/chromeos/cros_apps/cros_apps_tab_helper.h"
|
||||
#include "chrome/browser/chromeos/mahi/mahi_tab_helper.h"
|
||||
#include "chrome/browser/chromeos/policy/dlp/dlp_content_tab_helper.h"
|
||||
#include "chrome/browser/chromeos/printing/print_preview/printing_init_cros.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
|
||||
BUILDFLAG(IS_CHROMEOS)
|
||||
#include "chrome/browser/ui/blocked_content/framebust_block_tab_helper.h"
|
||||
#include "chrome/browser/ui/browser_finder.h"
|
||||
#include "chrome/browser/ui/hats/hats_helper.h"
|
||||
#include "chrome/browser/ui/shared_highlighting/shared_highlighting_promo.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
#include "chrome/browser/font_prewarmer_tab_helper.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION)
|
||||
#include "components/captive_portal/content/captive_portal_tab_helper.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
#include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h"
|
||||
#include "chrome/browser/extensions/navigation_extension_enabler.h"
|
||||
#include "chrome/browser/extensions/tab_helper.h"
|
||||
#include "chrome/browser/ui/extensions/extension_side_panel_utils.h"
|
||||
#include "chrome/browser/ui/web_applications/web_app_metrics.h"
|
||||
#include "chrome/browser/ui/web_applications/web_app_metrics_tab_helper.h"
|
||||
#include "chrome/browser/web_applications/policy/pre_redirection_url_observer.h"
|
||||
#include "chrome/browser/web_applications/web_app_tab_helper.h"
|
||||
#include "chrome/browser/web_applications/web_app_utils.h"
|
||||
#include "extensions/browser/view_type_utils.h"
|
||||
#include "extensions/common/extension_features.h"
|
||||
#include "extensions/common/mojom/view_type.mojom.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_OFFLINE_PAGES)
|
||||
#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/recent_tab_helper.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_PLUGINS)
|
||||
#include "chrome/browser/plugins/plugin_observer.h"
|
||||
#include "chrome/browser/ui/hung_plugin_tab_helper.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_PRINTING)
|
||||
#include "chrome/browser/printing/printing_init.h"
|
||||
#endif
|
||||
|
||||
|
||||
#if !BUILDFLAG(IS_ANDROID)
|
||||
#include "chrome/browser/privacy_sandbox/tracking_protection_notice_service.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_COMPOSE)
|
||||
#include "chrome/browser/compose/chrome_compose_client.h"
|
||||
#include "chrome/browser/compose/compose_enabling.h"
|
||||
#include "components/compose/buildflags.h"
|
||||
#include "components/compose/core/browser/compose_features.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_RLZ)
|
||||
#include "chrome/browser/rlz/chrome_rlz_tracker_web_contents_observer.h"
|
||||
#endif
|
||||
|
||||
using content::WebContents;
|
||||
|
||||
namespace {
|
||||
|
||||
const char kTabContentsAttachedTabHelpersUserDataKey[] =
|
||||
"TabContentsAttachedTabHelpers";
|
||||
|
||||
} // namespace
|
||||
|
||||
// static
|
||||
// WARNING: Do not use this class for desktop chrome. Use TabFeatures instead.
|
||||
// See
|
||||
// https://chromium.googlesource.com/chromium/src/+/main/docs/chrome_browser_design_principles.md
|
||||
void TabHelpers::AttachTabHelpers(WebContents* web_contents) {
|
||||
// If already adopted, nothing to be done.
|
||||
base::SupportsUserData::Data* adoption_tag =
|
||||
web_contents->GetUserData(&kTabContentsAttachedTabHelpersUserDataKey);
|
||||
if (adoption_tag) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Mark as adopted.
|
||||
web_contents->SetUserData(&kTabContentsAttachedTabHelpersUserDataKey,
|
||||
std::make_unique<base::SupportsUserData::Data>());
|
||||
|
||||
// Create all the tab helpers.
|
||||
|
||||
// SessionTabHelper comes first because it sets up the tab ID, and other
|
||||
// helpers may rely on that.
|
||||
CreateSessionServiceTabHelper(web_contents);
|
||||
|
||||
#if !BUILDFLAG(IS_ANDROID)
|
||||
// ZoomController comes before common tab helpers since ChromeAutofillClient
|
||||
// may want to register as a ZoomObserver with it.
|
||||
zoom::ZoomController::CreateForWebContents(web_contents);
|
||||
#endif
|
||||
|
||||
// infobars::ContentInfoBarManager comes before common tab helpers since
|
||||
// ChromeSubresourceFilterClient has it as a dependency.
|
||||
infobars::ContentInfoBarManager::CreateForWebContents(web_contents);
|
||||
|
||||
// `PageSpecificContentSettings` (PSCS) needs to come before
|
||||
// `DIPSWebContentsObserver` for this latter to be correctly added to the PSCS
|
||||
// observer list.
|
||||
content_settings::PageSpecificContentSettings::CreateForWebContents(
|
||||
web_contents,
|
||||
std::make_unique<chrome::PageSpecificContentSettingsDelegate>(
|
||||
web_contents));
|
||||
|
||||
// RedirectChainDetector comes before common tab helpers since
|
||||
// DIPSWebContentsObserver has it as a dependency.
|
||||
RedirectChainDetector::CreateForWebContents(web_contents);
|
||||
|
||||
Profile* profile =
|
||||
Profile::FromBrowserContext(web_contents->GetBrowserContext());
|
||||
|
||||
// --- Section 1: Common tab helpers ---
|
||||
if (page_info::IsAboutThisSiteAsyncFetchingEnabled()
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
|| page_info::IsPersistentSidePanelEntryFeatureEnabled()
|
||||
#endif
|
||||
) {
|
||||
if (auto* optimization_guide_decider =
|
||||
OptimizationGuideKeyedServiceFactory::GetForProfile(profile)) {
|
||||
AboutThisSiteTabHelper::CreateForWebContents(web_contents,
|
||||
optimization_guide_decider);
|
||||
}
|
||||
}
|
||||
autofill::AutofillClientProvider& autofill_client_provider =
|
||||
autofill::AutofillClientProviderFactory::GetForProfile(profile);
|
||||
autofill_client_provider.CreateClientForWebContents(web_contents);
|
||||
if (breadcrumbs::IsEnabled(g_browser_process->local_state())) {
|
||||
BreadcrumbManagerTabHelper::CreateForWebContents(web_contents);
|
||||
}
|
||||
browsing_topics::BrowsingTopicsRedirectObserver::MaybeCreateForWebContents(
|
||||
web_contents);
|
||||
chrome::ChainedBackNavigationTracker::CreateForWebContents(web_contents);
|
||||
chrome_browser_net::NetErrorTabHelper::CreateForWebContents(web_contents);
|
||||
if (!autofill_client_provider.uses_platform_autofill()) {
|
||||
ChromePasswordManagerClient::CreateForWebContents(web_contents);
|
||||
}
|
||||
ChromePasswordReuseDetectionManagerClient::CreateForWebContents(web_contents);
|
||||
CreateSubresourceFilterWebContentsHelper(web_contents);
|
||||
#if BUILDFLAG(ENABLE_RLZ)
|
||||
ChromeRLZTrackerWebContentsObserver::CreateForWebContentsIfNeeded(
|
||||
web_contents);
|
||||
#endif
|
||||
ChromeTranslateClient::CreateForWebContents(web_contents);
|
||||
client_hints::ClientHintsWebContentsObserver::CreateForWebContents(
|
||||
web_contents);
|
||||
commerce::CommerceTabHelper::CreateForWebContents(
|
||||
web_contents, profile->IsOffTheRecord(),
|
||||
commerce::ShoppingServiceFactory::GetForBrowserContext(profile),
|
||||
ISOLATED_WORLD_ID_CHROME_INTERNAL);
|
||||
ConnectionHelpTabHelper::CreateForWebContents(web_contents);
|
||||
CoreTabHelper::CreateForWebContents(web_contents);
|
||||
DIPSWebContentsObserver::MaybeCreateForWebContents(web_contents);
|
||||
ExternalProtocolObserver::CreateForWebContents(web_contents);
|
||||
favicon::CreateContentFaviconDriverForWebContents(web_contents);
|
||||
FileSystemAccessPermissionRequestManager::CreateForWebContents(web_contents);
|
||||
FileSystemAccessTabHelper::CreateForWebContents(web_contents);
|
||||
FindBarState::ConfigureWebContents(web_contents);
|
||||
if (base::FeatureList::IsEnabled(fingerprinting_protection_filter::features::
|
||||
kEnableFingerprintingProtectionFilter)) {
|
||||
// TODO(https://crbug.com/40280666): Move this to TabFeatures.
|
||||
CreateFingerprintingProtectionWebContentsHelper(
|
||||
web_contents, profile->GetPrefs(),
|
||||
TrackingProtectionSettingsFactory::GetForProfile(profile));
|
||||
}
|
||||
download::DownloadNavigationObserver::CreateForWebContents(
|
||||
web_contents,
|
||||
download::NavigationMonitorFactory::GetForKey(profile->GetProfileKey()));
|
||||
history::WebContentsTopSitesObserver::CreateForWebContents(
|
||||
web_contents, TopSitesFactory::GetForProfile(profile).get());
|
||||
HistoryTabHelper::CreateForWebContents(web_contents);
|
||||
HistoryClustersTabHelper::CreateForWebContents(web_contents);
|
||||
HistoryEmbeddingsTabHelper::CreateForWebContents(web_contents);
|
||||
HttpsOnlyModeTabHelper::CreateForWebContents(web_contents);
|
||||
webapps::InstallableManager::CreateForWebContents(web_contents);
|
||||
login_detection::LoginDetectionTabHelper::MaybeCreateForWebContents(
|
||||
web_contents);
|
||||
if (MediaEngagementService::IsEnabled()) {
|
||||
MediaEngagementService::CreateWebContentsObserver(web_contents);
|
||||
}
|
||||
if (auto* metrics_services_manager =
|
||||
g_browser_process->GetMetricsServicesManager()) {
|
||||
metrics::MetricsServicesWebContentsObserver::CreateForWebContents(
|
||||
web_contents, metrics_services_manager->GetOnDidStartLoadingCb(),
|
||||
metrics_services_manager->GetOnDidStopLoadingCb(),
|
||||
metrics_services_manager->GetOnRendererUnresponsiveCb());
|
||||
}
|
||||
MixedContentSettingsTabHelper::CreateForWebContents(web_contents);
|
||||
NavigationMetricsRecorder::CreateForWebContents(web_contents);
|
||||
NavigationPredictorPreconnectClient::CreateForWebContents(web_contents);
|
||||
OpenerHeuristicTabHelper::CreateForWebContents(web_contents);
|
||||
if (optimization_guide::features::IsOptimizationHintsEnabled()) {
|
||||
OptimizationGuideWebContentsObserver::CreateForWebContents(web_contents);
|
||||
}
|
||||
page_content_annotations::PageContentAnnotationsService*
|
||||
page_content_annotations_service =
|
||||
PageContentAnnotationsServiceFactory::GetForProfile(profile);
|
||||
if (page_content_annotations_service) {
|
||||
page_content_annotations::PageContentAnnotationsWebContentsObserver::
|
||||
CreateForWebContents(web_contents);
|
||||
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
// If enabled, save sensitivity data for each non-incognito non-custom
|
||||
// android tab
|
||||
// TODO(crbug.com/40276584): Consider moving check conditions or the
|
||||
// registration logic to sensitivity_persisted_tab_data_android.*
|
||||
if (!profile->IsOffTheRecord()) {
|
||||
if (auto* tab = TabAndroid::FromWebContents(web_contents);
|
||||
(tab && !tab->IsCustomTab())) {
|
||||
SensitivityPersistedTabDataAndroid::From(
|
||||
tab,
|
||||
base::BindOnce(
|
||||
[](page_content_annotations::PageContentAnnotationsService*
|
||||
page_content_annotations_service,
|
||||
PersistedTabDataAndroid* persisted_tab_data) {
|
||||
auto* sensitivity_persisted_tab_data_android =
|
||||
static_cast<SensitivityPersistedTabDataAndroid*>(
|
||||
persisted_tab_data);
|
||||
sensitivity_persisted_tab_data_android->RegisterPCAService(
|
||||
page_content_annotations_service);
|
||||
},
|
||||
page_content_annotations_service));
|
||||
}
|
||||
}
|
||||
#endif // BUILDFLAG(IS_ANDROID)
|
||||
}
|
||||
chrome::InitializePageLoadMetricsForWebContents(web_contents);
|
||||
if (auto* pm_registry =
|
||||
performance_manager::PerformanceManagerRegistry::GetInstance()) {
|
||||
pm_registry->SetPageType(web_contents, performance_manager::PageType::kTab);
|
||||
}
|
||||
permissions::PermissionRequestManager::CreateForWebContents(web_contents);
|
||||
permissions::PermissionRecoverySuccessRateTracker::CreateForWebContents(
|
||||
web_contents);
|
||||
// The PopupBlockerTabHelper has an implicit dependency on
|
||||
// ChromeSubresourceFilterClient being available in its constructor.
|
||||
blocked_content::PopupBlockerTabHelper::CreateForWebContents(web_contents);
|
||||
blocked_content::PopupOpenerTabHelper::CreateForWebContents(
|
||||
web_contents, base::DefaultTickClock::GetInstance(),
|
||||
HostContentSettingsMapFactory::GetForProfile(profile));
|
||||
if (predictors::LoadingPredictorFactory::GetForProfile(profile)) {
|
||||
predictors::LoadingPredictorTabHelper::CreateForWebContents(web_contents);
|
||||
}
|
||||
PrefsTabHelper::CreateForWebContents(web_contents);
|
||||
prerender::NoStatePrefetchTabHelper::CreateForWebContents(web_contents);
|
||||
RecentlyAudibleHelper::CreateForWebContents(web_contents);
|
||||
RedirectHeuristicTabHelper::CreateForWebContents(web_contents);
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
RequestDesktopSiteWebContentsObserverAndroid::CreateForWebContents(
|
||||
web_contents);
|
||||
#endif // BUILDFLAG(IS_ANDROID)
|
||||
// TODO(siggi): Remove this once the Resource Coordinator refactoring is done.
|
||||
// See https://crbug.com/910288.
|
||||
resource_coordinator::ResourceCoordinatorTabHelper::CreateForWebContents(
|
||||
web_contents);
|
||||
safe_browsing::SafeBrowsingNavigationObserver::MaybeCreateForWebContents(
|
||||
web_contents, HostContentSettingsMapFactory::GetForProfile(profile),
|
||||
safe_browsing::SafeBrowsingNavigationObserverManagerFactory::
|
||||
GetForBrowserContext(profile),
|
||||
profile->GetPrefs(), g_browser_process->safe_browsing_service());
|
||||
if (base::FeatureList::IsEnabled(
|
||||
safe_browsing::kTailoredSecurityIntegration)) {
|
||||
safe_browsing::TailoredSecurityUrlObserver::CreateForWebContents(
|
||||
web_contents,
|
||||
safe_browsing::TailoredSecurityServiceFactory::GetForProfile(profile));
|
||||
}
|
||||
if (base::FeatureList::IsEnabled(
|
||||
safe_browsing::kSafeBrowsingAsyncRealTimeCheck) &&
|
||||
g_browser_process->safe_browsing_service()) {
|
||||
safe_browsing::AsyncCheckTracker::CreateForWebContents(
|
||||
web_contents, g_browser_process->safe_browsing_service()->ui_manager());
|
||||
}
|
||||
// SafeBrowsingTabObserver creates a ClientSideDetectionHost, which observes
|
||||
// events from PermissionRequestManager and AsyncCheckTracker in its
|
||||
// constructor. Therefore, PermissionRequestManager and AsyncCheckTracker need
|
||||
// to be created before SafeBrowsingTabObserver is created.
|
||||
safe_browsing::SafeBrowsingTabObserver::CreateForWebContents(
|
||||
web_contents,
|
||||
std::make_unique<safe_browsing::ChromeSafeBrowsingTabObserverDelegate>());
|
||||
safe_browsing::TriggerCreator::MaybeCreateTriggersForWebContents(
|
||||
profile, web_contents);
|
||||
SafetyTipWebContentsObserver::CreateForWebContents(web_contents);
|
||||
SearchEngineTabHelper::CreateForWebContents(web_contents);
|
||||
SecurityStateTabHelper::CreateForWebContents(web_contents);
|
||||
if (site_engagement::SiteEngagementService::IsEnabled()) {
|
||||
site_engagement::SiteEngagementService::Helper::CreateForWebContents(
|
||||
web_contents,
|
||||
prerender::NoStatePrefetchManagerFactory::GetForBrowserContext(
|
||||
profile));
|
||||
}
|
||||
SoundContentSettingObserver::CreateForWebContents(web_contents);
|
||||
StorageAccessAPITabHelper::CreateForWebContents(
|
||||
web_contents, StorageAccessAPIServiceFactory::GetForBrowserContext(
|
||||
web_contents->GetBrowserContext()));
|
||||
// Do not create for Incognito mode.
|
||||
if (!profile->IsOffTheRecord()) {
|
||||
SupervisedUserNavigationObserver::CreateForWebContents(web_contents);
|
||||
}
|
||||
HttpErrorTabHelper::CreateForWebContents(web_contents);
|
||||
sync_sessions::SyncSessionsRouterTabHelper::CreateForWebContents(
|
||||
web_contents,
|
||||
sync_sessions::SyncSessionsWebContentsRouterFactory::GetForProfile(
|
||||
profile));
|
||||
TabUIHelper::CreateForWebContents(web_contents);
|
||||
tasks::TaskTabHelper::CreateForWebContents(web_contents);
|
||||
tpcd::metadata::TpcdMetadataDevtoolsObserver::CreateForWebContents(
|
||||
web_contents);
|
||||
tpcd::trial::ValidityService::MaybeCreateForWebContents(web_contents);
|
||||
TrustedVaultEncryptionKeysTabHelper::CreateForWebContents(web_contents);
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
if (base::FeatureList::IsEnabled(features::kSafetyHub)) {
|
||||
auto* service = UnusedSitePermissionsServiceFactory::GetForProfile(profile);
|
||||
if (service) {
|
||||
UnusedSitePermissionsService::TabHelper::CreateForWebContents(
|
||||
web_contents, service);
|
||||
}
|
||||
}
|
||||
#else // BUILDFLAG(IS_ANDROID)
|
||||
auto* service = UnusedSitePermissionsServiceFactory::GetForProfile(profile);
|
||||
if (service) {
|
||||
UnusedSitePermissionsService::TabHelper::CreateForWebContents(web_contents,
|
||||
service);
|
||||
}
|
||||
#endif // BUILDFLAG(IS_ANDROID)
|
||||
ukm::InitializeSourceUrlRecorderForWebContents(web_contents);
|
||||
v8_compile_hints::V8CompileHintsTabHelper::MaybeCreateForWebContents(
|
||||
web_contents);
|
||||
vr::VrTabHelper::CreateForWebContents(web_contents);
|
||||
OneTimePermissionsTrackerHelper::CreateForWebContents(web_contents);
|
||||
|
||||
// NO! Do not just add your tab helper here. This is a large alphabetized
|
||||
// block; please insert your tab helper above in alphabetical order.
|
||||
|
||||
// --- Section 2: Platform-specific tab helpers ---
|
||||
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
DipsNavigationFlowDetector::MaybeCreateForWebContents(web_contents);
|
||||
webapps::MLInstallabilityPromoter::CreateForWebContents(web_contents);
|
||||
{
|
||||
// Remove after fixing https://crbug/905919
|
||||
TRACE_EVENT0("browser", "AppBannerManagerAndroid::CreateForWebContents");
|
||||
webapps::AppBannerManagerAndroid::CreateForWebContents(
|
||||
web_contents, std::make_unique<webapps::ChromeAppBannerManagerAndroid>(
|
||||
*web_contents));
|
||||
}
|
||||
ContextMenuHelper::CreateForWebContents(web_contents);
|
||||
FastCheckoutTabHelper::CreateForWebContents(web_contents);
|
||||
|
||||
javascript_dialogs::TabModalDialogManager::CreateForWebContents(
|
||||
web_contents,
|
||||
std::make_unique<JavaScriptTabModalDialogManagerDelegateAndroid>(
|
||||
web_contents));
|
||||
if (OomInterventionTabHelper::IsEnabled()) {
|
||||
OomInterventionTabHelper::CreateForWebContents(web_contents);
|
||||
}
|
||||
PolicyAuditorBridge::CreateForWebContents(web_contents);
|
||||
PluginObserverAndroid::CreateForWebContents(web_contents);
|
||||
|
||||
if (base::FeatureList::IsEnabled(
|
||||
payments::facilitated::kEnablePixDetection)) {
|
||||
if (auto* optimization_guide_decider =
|
||||
OptimizationGuideKeyedServiceFactory::GetForProfile(profile)) {
|
||||
ChromeFacilitatedPaymentsClient::CreateForWebContents(
|
||||
web_contents, optimization_guide_decider);
|
||||
}
|
||||
}
|
||||
#else // BUILDFLAG(IS_ANDROID)
|
||||
if (web_app::AreWebAppsUserInstallable(profile)) {
|
||||
webapps::MLInstallabilityPromoter::CreateForWebContents(web_contents);
|
||||
webapps::AppBannerManagerDesktop::CreateForWebContents(web_contents);
|
||||
}
|
||||
if (base::FeatureList::IsEnabled(
|
||||
blink::features::kMediaSessionEnterPictureInPicture)) {
|
||||
AutoPictureInPictureTabHelper::CreateForWebContents(web_contents);
|
||||
}
|
||||
BookmarkTabHelper::CreateForWebContents(web_contents);
|
||||
BrowserSyncedTabDelegate::CreateForWebContents(web_contents);
|
||||
FocusTabAfterNavigationHelper::CreateForWebContents(web_contents);
|
||||
FormInteractionTabHelper::CreateForWebContents(web_contents);
|
||||
FramebustBlockTabHelper::CreateForWebContents(web_contents);
|
||||
IntentPickerTabHelper::CreateForWebContents(web_contents);
|
||||
#if BUILDFLAG(ENTERPRISE_WATERMARK)
|
||||
enterprise_data_protection::DataProtectionNavigationController::
|
||||
MaybeCreateForWebContents(web_contents);
|
||||
#endif
|
||||
javascript_dialogs::TabModalDialogManager::CreateForWebContents(
|
||||
web_contents,
|
||||
std::make_unique<JavaScriptTabModalDialogManagerDelegateDesktop>(
|
||||
web_contents));
|
||||
ManagePasswordsUIController::CreateForWebContents(web_contents);
|
||||
if (PrivacySandboxPromptHelper::ProfileRequiresPrompt(profile)) {
|
||||
PrivacySandboxPromptHelper::CreateForWebContents(web_contents);
|
||||
}
|
||||
|
||||
if (SearchEngineChoiceTabHelper::IsHelperNeeded()) {
|
||||
SearchEngineChoiceTabHelper::CreateForWebContents(web_contents);
|
||||
}
|
||||
|
||||
SadTabHelper::CreateForWebContents(web_contents);
|
||||
SearchTabHelper::CreateForWebContents(web_contents);
|
||||
TabDialogs::CreateForWebContents(web_contents);
|
||||
if (privacy_sandbox::TrackingProtectionNoticeService::TabHelper::
|
||||
IsHelperNeeded(profile)) {
|
||||
privacy_sandbox::TrackingProtectionNoticeService::TabHelper::
|
||||
CreateForWebContents(web_contents);
|
||||
}
|
||||
MemorySaverChipTabHelper::CreateForWebContents(web_contents);
|
||||
TabResourceUsageTabHelper::CreateForWebContents(web_contents);
|
||||
if (base::FeatureList::IsEnabled(features::kTabHoverCardImages) ||
|
||||
base::FeatureList::IsEnabled(features::kWebUITabStrip)) {
|
||||
ThumbnailTabHelper::CreateForWebContents(web_contents);
|
||||
}
|
||||
chrome::UMABrowsingActivityObserver::TabHelper::CreateForWebContents(
|
||||
web_contents);
|
||||
web_modal::WebContentsModalDialogManager::CreateForWebContents(web_contents);
|
||||
if (OmniboxFieldTrial::IsZeroSuggestPrefetchingEnabled()) {
|
||||
ZeroSuggestPrefetchTabHelper::CreateForWebContents(web_contents);
|
||||
}
|
||||
if (commerce::isContextualConsentEnabled()) {
|
||||
commerce_hint::CommerceHintTabHelper::CreateForWebContents(web_contents);
|
||||
}
|
||||
if (base::FeatureList::IsEnabled(ntp_features::kNtpHistoryClustersModule)) {
|
||||
side_panel::HistoryClustersTabHelper::CreateForWebContents(web_contents);
|
||||
}
|
||||
if (companion::IsCompanionFeatureEnabled()) {
|
||||
companion::CompanionTabHelper::CreateForWebContents(web_contents);
|
||||
}
|
||||
if (features::IsReadAnythingLocalSidePanelEnabled()) {
|
||||
ReadAnythingTabHelper::CreateForWebContents(web_contents);
|
||||
}
|
||||
if (base::FeatureList::IsEnabled(
|
||||
companion::features::internal::
|
||||
kCompanionEnabledByObservingExpsNavigations)) {
|
||||
companion::ExpsRegistrationSuccessObserver::CreateForWebContents(
|
||||
web_contents);
|
||||
}
|
||||
#endif // BUILDFLAG(IS_ANDROID)
|
||||
|
||||
#if BUILDFLAG(ENABLE_COMPOSE)
|
||||
// We need to create the ChromeComposeClient to listen for the feature
|
||||
// being turned on, even if it is not enabled yet.
|
||||
if (!profile->IsOffTheRecord()) {
|
||||
ChromeComposeClient::CreateForWebContents(web_contents);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
GoogleOneOfferIphTabHelper::CreateForWebContents(web_contents);
|
||||
// Do not create for Incognito mode.
|
||||
if (!profile->IsOffTheRecord()) {
|
||||
CampaignsManagerSessionTabHelper::CreateForWebContents(web_contents);
|
||||
}
|
||||
ash::BootTimesRecorderTabHelper::MaybeCreateForWebContents(web_contents);
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS_LACROS)
|
||||
WebContentsCanGoBackObserver::CreateForWebContents(web_contents);
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS)
|
||||
ContainerAppTabHelper::MaybeCreateForWebContents(web_contents);
|
||||
CrosAppsTabHelper::MaybeCreateForWebContents(web_contents);
|
||||
mahi::MahiTabHelper::MaybeCreateForWebContents(web_contents);
|
||||
policy::DlpContentTabHelper::MaybeCreateForWebContents(web_contents);
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
webapps::PreRedirectionURLObserver::CreateForWebContents(web_contents);
|
||||
#endif
|
||||
|
||||
// TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
|
||||
// of lacros-chrome is complete.
|
||||
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
|
||||
(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
|
||||
metrics::DesktopSessionDurationObserver::CreateForWebContents(web_contents);
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
|
||||
BUILDFLAG(IS_CHROMEOS)
|
||||
if (base::FeatureList::IsEnabled(
|
||||
features::kHappinessTrackingSurveysForDesktopDemo) ||
|
||||
base::FeatureList::IsEnabled(features::kTrustSafetySentimentSurvey) ||
|
||||
base::FeatureList::IsEnabled(features::kTrustSafetySentimentSurveyV2) ||
|
||||
base::FeatureList::IsEnabled(performance_manager::features::
|
||||
kPerformanceControlsPerformanceSurvey) ||
|
||||
base::FeatureList::IsEnabled(
|
||||
performance_manager::features::
|
||||
kPerformanceControlsBatteryPerformanceSurvey) ||
|
||||
base::FeatureList::IsEnabled(
|
||||
performance_manager::features::
|
||||
kPerformanceControlsMemorySaverOptOutSurvey) ||
|
||||
base::FeatureList::IsEnabled(
|
||||
performance_manager::features::
|
||||
kPerformanceControlsBatterySaverOptOutSurvey)) {
|
||||
HatsHelper::CreateForWebContents(web_contents);
|
||||
}
|
||||
SharedHighlightingPromo::CreateForWebContents(web_contents);
|
||||
|
||||
if (!profile->IsIncognitoProfile()) {
|
||||
// TODO(crbug.com/40863325): Consider using the in-memory cache instead.
|
||||
commerce::CommerceUiTabHelper::CreateForWebContents(
|
||||
web_contents,
|
||||
commerce::ShoppingServiceFactory::GetForBrowserContext(profile),
|
||||
BookmarkModelFactory::GetForBrowserContext(profile),
|
||||
ImageFetcherServiceFactory::GetForKey(profile->GetProfileKey())
|
||||
->GetImageFetcher(image_fetcher::ImageFetcherConfig::kNetworkOnly));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
FontPrewarmerTabHelper::CreateForWebContents(web_contents);
|
||||
#endif
|
||||
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
if (IsSideSearchEnabled(profile)) {
|
||||
SideSearchTabContentsHelper::CreateForWebContents(web_contents);
|
||||
}
|
||||
#endif
|
||||
|
||||
// --- Section 3: Feature tab helpers behind BUILDFLAGs ---
|
||||
// NOT for "if enabled"; put those in section 1.
|
||||
|
||||
#if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION)
|
||||
captive_portal::CaptivePortalTabHelper::CreateForWebContents(
|
||||
web_contents, CaptivePortalServiceFactory::GetForProfile(profile),
|
||||
base::BindRepeating(
|
||||
&ChromeSecurityBlockingPageFactory::OpenLoginTabForWebContents,
|
||||
web_contents, false));
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
extensions::SetViewType(web_contents,
|
||||
extensions::mojom::ViewType::kTabContents);
|
||||
|
||||
extensions::TabHelper::CreateForWebContents(web_contents);
|
||||
extensions::NavigationExtensionEnabler::CreateForWebContents(web_contents);
|
||||
|
||||
if (base::FeatureList::IsEnabled(
|
||||
extensions_features::kExtensionSidePanelIntegration)) {
|
||||
extensions::side_panel_util::CreateSidePanelManagerForWebContents(
|
||||
profile, web_contents);
|
||||
}
|
||||
|
||||
extensions::WebNavigationTabObserver::CreateForWebContents(web_contents);
|
||||
if (web_app::AreWebAppsEnabled(profile)) {
|
||||
web_app::WebAppTabHelper::CreateForWebContents(web_contents);
|
||||
}
|
||||
// Note WebAppMetricsTabHelper must be created after AppBannerManager.
|
||||
if (web_app::WebAppMetricsTabHelper::IsEnabled(web_contents)) {
|
||||
web_app::WebAppMetricsTabHelper::CreateForWebContents(web_contents);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_OFFLINE_PAGES)
|
||||
offline_pages::OfflinePageTabHelper::CreateForWebContents(web_contents);
|
||||
offline_pages::RecentTabHelper::CreateForWebContents(web_contents);
|
||||
offline_pages::AutoFetchPageLoadWatcher::CreateForWebContents(web_contents);
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_PLUGINS)
|
||||
HungPluginTabHelper::CreateForWebContents(web_contents);
|
||||
PluginObserver::CreateForWebContents(web_contents);
|
||||
#endif
|
||||
|
||||
// Only enable ChromeOS print preview if `kPrintPreviewCrosPrimary` is enabled
|
||||
// and is a ChromeOS build. Otherwise instantiate browser print preview.
|
||||
#if BUILDFLAG(ENABLE_PRINTING) && BUILDFLAG(IS_CHROMEOS)
|
||||
if (base::FeatureList::IsEnabled(::features::kPrintPreviewCrosPrimary)) {
|
||||
chromeos::printing::InitializePrintingForWebContents(web_contents);
|
||||
} else {
|
||||
printing::InitializePrintingForWebContents(web_contents);
|
||||
}
|
||||
#elif BUILDFLAG(ENABLE_PRINTING)
|
||||
printing::InitializePrintingForWebContents(web_contents);
|
||||
#endif
|
||||
|
||||
// --- Section 4: The warning ---
|
||||
|
||||
// NONO NO NONONO !
|
||||
// NO NO NO NO NO !
|
||||
// NO NO NO NO NO !
|
||||
// NO NO NO NO NO !
|
||||
// NO NONO NONONO !
|
||||
|
||||
// Do NOT just drop your tab helpers here! There are three sections above (1.
|
||||
// All platforms, 2. Some platforms, 3. Behind BUILDFLAGs). Each is in rough
|
||||
// alphabetical order. PLEASE PLEASE PLEASE add your flag to the correct
|
||||
// section in the correct order.
|
||||
|
||||
// This is common code for all of us. PLEASE DO YOUR PART to keep it tidy and
|
||||
// organized.
|
||||
}
|
||||
Executable
+120
@@ -0,0 +1,120 @@
|
||||
// Copyright 2019 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "chrome/browser/ui/webui/chrome_content_browser_client_webui_part.h"
|
||||
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "chrome/common/pref_names.h"
|
||||
#include "chrome/common/webui_url_constants.h"
|
||||
#include "components/prefs/pref_service.h"
|
||||
#include "content/public/browser/navigation_entry.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "third_party/blink/public/common/web_preferences/web_preferences.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// Returns whether any prefs were changed.
|
||||
bool CopyFontPrefs(const blink::web_pref::WebPreferences& source,
|
||||
blink::web_pref::WebPreferences* destination) {
|
||||
bool changed = false;
|
||||
changed |= destination->default_font_size != source.default_font_size;
|
||||
changed |=
|
||||
destination->default_fixed_font_size != source.default_fixed_font_size;
|
||||
changed |= destination->minimum_font_size != source.minimum_font_size;
|
||||
changed |= destination->minimum_logical_font_size !=
|
||||
source.minimum_logical_font_size;
|
||||
|
||||
if (!changed) {
|
||||
return false;
|
||||
}
|
||||
|
||||
destination->default_font_size = source.default_font_size;
|
||||
destination->default_fixed_font_size = source.default_fixed_font_size;
|
||||
destination->minimum_font_size = source.minimum_font_size;
|
||||
destination->minimum_logical_font_size = source.minimum_logical_font_size;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Returns the visible URL or GURL() if unavailable.
|
||||
GURL GetVisibleURL(content::WebContents* web_contents) {
|
||||
if (!web_contents) {
|
||||
return GURL();
|
||||
}
|
||||
|
||||
content::NavigationEntry* entry =
|
||||
web_contents->GetController().GetVisibleEntry();
|
||||
return entry ? entry->GetURL() : GURL();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
ChromeContentBrowserClientWebUiPart::ChromeContentBrowserClientWebUiPart() =
|
||||
default;
|
||||
ChromeContentBrowserClientWebUiPart::~ChromeContentBrowserClientWebUiPart() =
|
||||
default;
|
||||
|
||||
void ChromeContentBrowserClientWebUiPart::OverrideWebkitPrefs(
|
||||
content::WebContents* web_contents,
|
||||
blink::web_pref::WebPreferences* web_prefs) {
|
||||
// This logic is invoked at startup, and anytime the default prefs change.
|
||||
GURL url = GetVisibleURL(web_contents);
|
||||
|
||||
if (!url.SchemeIs(content::kChromeUIScheme)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Use default font sizes for WebUi.
|
||||
blink::web_pref::WebPreferences default_prefs;
|
||||
CopyFontPrefs(/*source=*/default_prefs, /*destination=*/web_prefs);
|
||||
|
||||
#if BUILDFLAG(ENABLE_WEBUI_TAB_STRIP)
|
||||
// Set some non-font prefs for webui tabstrip. The tabstrip renderer is never
|
||||
// navigated to or from, so we don't need to replicate this logic in
|
||||
// OverrideWebPreferencesAfterNavigation.
|
||||
if (url.host_piece() == chrome::kChromeUITabStripHost) {
|
||||
web_prefs->touch_drag_drop_enabled = true;
|
||||
web_prefs->touch_dragend_context_menu = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool ChromeContentBrowserClientWebUiPart::OverrideWebPreferencesAfterNavigation(
|
||||
content::WebContents* web_contents,
|
||||
blink::web_pref::WebPreferences* web_prefs) {
|
||||
// This logic is invoked once on each navigation.
|
||||
|
||||
GURL url = GetVisibleURL(web_contents);
|
||||
if (!url.is_valid()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Extensions are handled by ChromeContentBrowserClientExtensionsPart.
|
||||
const GURL& site_url =
|
||||
web_contents->GetPrimaryMainFrame()->GetSiteInstance()->GetSiteURL();
|
||||
if (site_url.SchemeIs(extensions::kExtensionScheme)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
blink::web_pref::WebPreferences web_prefs_source;
|
||||
if (url.SchemeIs(content::kChromeUIScheme)) {
|
||||
// Use default prefs for WebUi. Not further modifications necessary for
|
||||
// web_prefs_source.
|
||||
} else {
|
||||
// Use profile prefs for normal websites.
|
||||
Profile* profile =
|
||||
Profile::FromBrowserContext(web_contents->GetBrowserContext());
|
||||
PrefService* prefs = profile->GetPrefs();
|
||||
web_prefs_source.default_font_size =
|
||||
prefs->GetInteger(prefs::kWebKitDefaultFontSize);
|
||||
web_prefs_source.default_fixed_font_size =
|
||||
prefs->GetInteger(prefs::kWebKitDefaultFixedFontSize);
|
||||
web_prefs_source.minimum_font_size =
|
||||
prefs->GetInteger(prefs::kWebKitMinimumFontSize);
|
||||
web_prefs_source.minimum_logical_font_size =
|
||||
prefs->GetInteger(prefs::kWebKitMinimumLogicalFontSize);
|
||||
}
|
||||
return CopyFontPrefs(web_prefs_source, web_prefs);
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// Copyright 2023 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// API which provides support for ChromeOS Accessibility features in the
|
||||
// browser.
|
||||
|
||||
[platforms=("chromeos", "lacros"),
|
||||
implemented_in="chrome/browser/chromeos/extensions/accessibility_service_private.h"]
|
||||
|
||||
namespace accessibilityServicePrivate {
|
||||
callback VoidCallback = void();
|
||||
|
||||
interface Functions {
|
||||
// Called when Select to Speak in ChromeOS should speak the current
|
||||
// text selection; fired when the context menu option was clicked in
|
||||
// a selection context.
|
||||
static void speakSelectedText(
|
||||
optional VoidCallback callback);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Called when Select to Speak in ChromeOS wants a clipboard copy
|
||||
// event to be performed on the active and focused tab with the
|
||||
// given URL. This is fired when Select to Speak is trying to speak
|
||||
// with search+s but cannot find a selection and the focused node
|
||||
// is in a Google Docs page.
|
||||
static void clipboardCopyInActiveGoogleDoc(DOMString url);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,49 @@
|
||||
// Copyright 2015 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>appview</code> tag to embed other Chrome Apps within your
|
||||
// Chrome App. (see <a href=#usage>Usage</a>).
|
||||
[documentation_title="<appview> Tag",
|
||||
documentation_namespace="<appview>",
|
||||
documented_in="tags/appview"]
|
||||
namespace appviewTag {
|
||||
// This object specifies details and operations to perform on the embedding
|
||||
// request. The app to be embedded can make a decision on whether or not to
|
||||
// allow the embedding and what to embed based on the embedder making the
|
||||
// request.
|
||||
dictionary EmbedRequest {
|
||||
// The ID of the app that sent the embedding request.
|
||||
DOMString embedderId;
|
||||
|
||||
// Optional developer specified data that the app to be embedded can use
|
||||
// when making an embedding decision.
|
||||
object data;
|
||||
|
||||
// Allows the embedding request.
|
||||
//
|
||||
// |url| : Specifies the content to be embedded.
|
||||
static void allow(DOMString url);
|
||||
|
||||
// Prevents the embedding request.
|
||||
static void deny();
|
||||
};
|
||||
|
||||
// An optional function that's called after the embedding request is
|
||||
// completed.
|
||||
//
|
||||
// |success| : True if the embedding request succeded.
|
||||
callback EmbeddingCallback = void (boolean success);
|
||||
|
||||
interface Functions {
|
||||
// Requests another app to be embedded.
|
||||
//
|
||||
// |app| : The extension id of the app to be embedded.
|
||||
// |data| : Optional developer specified data that the app to be embedded
|
||||
// can use when making an embedding decision.
|
||||
// |callback| : An optional function that's called after the embedding
|
||||
// request is completed.
|
||||
static void connect(DOMString app, optional any data,
|
||||
optional EmbeddingCallback callback);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,426 @@
|
||||
// Copyright 2015 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.autofillPrivate</code> API to add, remove, or update
|
||||
// autofill data from the settings UI.
|
||||
namespace autofillPrivate {
|
||||
// Subset of properties from the user account (signin component, AccountInfo).
|
||||
dictionary AccountInfo {
|
||||
DOMString email;
|
||||
boolean isSyncEnabledForAutofillProfiles;
|
||||
boolean isEligibleForAddressAccountStorage;
|
||||
|
||||
// Controls whether the Autofill Sync toggle should be available (duplicated
|
||||
// from the Sync Settings page) on the Autofill Settings page.
|
||||
// TODO(crbug.com/40943238): Remove when toggle becomes available on the Sync
|
||||
// page for non-syncing users.
|
||||
boolean isAutofillSyncToggleAvailable;
|
||||
|
||||
// Represents the UserSelectableType::kAutofill state (enabled or not).
|
||||
// TODO(crbug.com/40943238): Remove when toggle becomes available on the Sync
|
||||
// page for non-syncing users.
|
||||
boolean isAutofillSyncToggleEnabled;
|
||||
};
|
||||
|
||||
// A copy of FieldType from
|
||||
// chrome/common/extensions/api/autofill_private.idl
|
||||
enum FieldType {
|
||||
NO_SERVER_DATA,
|
||||
UNKNOWN_TYPE,
|
||||
EMPTY_TYPE,
|
||||
NAME_FIRST,
|
||||
NAME_MIDDLE,
|
||||
NAME_LAST,
|
||||
NAME_MIDDLE_INITIAL,
|
||||
NAME_FULL,
|
||||
NAME_SUFFIX,
|
||||
EMAIL_ADDRESS,
|
||||
PHONE_HOME_NUMBER,
|
||||
PHONE_HOME_CITY_CODE,
|
||||
PHONE_HOME_COUNTRY_CODE,
|
||||
PHONE_HOME_CITY_AND_NUMBER,
|
||||
PHONE_HOME_WHOLE_NUMBER,
|
||||
ADDRESS_HOME_LINE1,
|
||||
ADDRESS_HOME_LINE2,
|
||||
ADDRESS_HOME_APT_NUM,
|
||||
ADDRESS_HOME_CITY,
|
||||
ADDRESS_HOME_STATE,
|
||||
ADDRESS_HOME_ZIP,
|
||||
ADDRESS_HOME_COUNTRY,
|
||||
CREDIT_CARD_NAME_FULL,
|
||||
CREDIT_CARD_NUMBER,
|
||||
CREDIT_CARD_EXP_MONTH,
|
||||
CREDIT_CARD_EXP_2_DIGIT_YEAR,
|
||||
CREDIT_CARD_EXP_4_DIGIT_YEAR,
|
||||
CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR,
|
||||
CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR,
|
||||
CREDIT_CARD_TYPE,
|
||||
CREDIT_CARD_VERIFICATION_CODE,
|
||||
COMPANY_NAME,
|
||||
FIELD_WITH_DEFAULT_VALUE,
|
||||
MERCHANT_EMAIL_SIGNUP,
|
||||
MERCHANT_PROMO_CODE,
|
||||
PASSWORD,
|
||||
ACCOUNT_CREATION_PASSWORD,
|
||||
ADDRESS_HOME_STREET_ADDRESS,
|
||||
ADDRESS_HOME_SORTING_CODE,
|
||||
ADDRESS_HOME_DEPENDENT_LOCALITY,
|
||||
ADDRESS_HOME_LINE3,
|
||||
NOT_ACCOUNT_CREATION_PASSWORD,
|
||||
USERNAME,
|
||||
USERNAME_AND_EMAIL_ADDRESS,
|
||||
NEW_PASSWORD,
|
||||
PROBABLY_NEW_PASSWORD,
|
||||
NOT_NEW_PASSWORD,
|
||||
CREDIT_CARD_NAME_FIRST,
|
||||
CREDIT_CARD_NAME_LAST,
|
||||
PHONE_HOME_EXTENSION,
|
||||
CONFIRMATION_PASSWORD,
|
||||
AMBIGUOUS_TYPE,
|
||||
SEARCH_TERM,
|
||||
PRICE,
|
||||
NOT_PASSWORD,
|
||||
SINGLE_USERNAME,
|
||||
NOT_USERNAME,
|
||||
UPI_VPA,
|
||||
ADDRESS_HOME_STREET_NAME,
|
||||
ADDRESS_HOME_HOUSE_NUMBER,
|
||||
ADDRESS_HOME_SUBPREMISE,
|
||||
ADDRESS_HOME_OTHER_SUBUNIT,
|
||||
NAME_LAST_FIRST,
|
||||
NAME_LAST_CONJUNCTION,
|
||||
NAME_LAST_SECOND,
|
||||
NAME_HONORIFIC_PREFIX,
|
||||
ADDRESS_HOME_ADDRESS,
|
||||
ADDRESS_HOME_ADDRESS_WITH_NAME,
|
||||
ADDRESS_HOME_FLOOR,
|
||||
PHONE_HOME_CITY_CODE_WITH_TRUNK_PREFIX,
|
||||
PHONE_HOME_CITY_AND_NUMBER_WITHOUT_TRUNK_PREFIX,
|
||||
PHONE_HOME_NUMBER_PREFIX,
|
||||
PHONE_HOME_NUMBER_SUFFIX,
|
||||
IBAN_VALUE,
|
||||
CREDIT_CARD_STANDALONE_VERIFICATION_CODE,
|
||||
NUMERIC_QUANTITY,
|
||||
ONE_TIME_CODE,
|
||||
DELIVERY_INSTRUCTIONS,
|
||||
ADDRESS_HOME_OVERFLOW,
|
||||
ADDRESS_HOME_LANDMARK,
|
||||
ADDRESS_HOME_OVERFLOW_AND_LANDMARK,
|
||||
ADDRESS_HOME_ADMIN_LEVEL2,
|
||||
ADDRESS_HOME_STREET_LOCATION,
|
||||
ADDRESS_HOME_BETWEEN_STREETS,
|
||||
ADDRESS_HOME_BETWEEN_STREETS_OR_LANDMARK,
|
||||
ADDRESS_HOME_STREET_LOCATION_AND_LOCALITY,
|
||||
ADDRESS_HOME_STREET_LOCATION_AND_LANDMARK,
|
||||
ADDRESS_HOME_DEPENDENT_LOCALITY_AND_LANDMARK,
|
||||
ADDRESS_HOME_BETWEEN_STREETS_1,
|
||||
ADDRESS_HOME_BETWEEN_STREETS_2,
|
||||
SINGLE_USERNAME_FORGOT_PASSWORD,
|
||||
ADDRESS_HOME_APT,
|
||||
ADDRESS_HOME_APT_TYPE,
|
||||
ADDRESS_HOME_HOUSE_NUMBER_AND_APT,
|
||||
SINGLE_USERNAME_WITH_INTERMEDIATE_VALUES,
|
||||
MAX_VALID_FIELD_TYPE
|
||||
};
|
||||
|
||||
// The address source origin. Describes where the address is stored.
|
||||
enum AddressSource {
|
||||
// The address is stored in the Chrome infrastructure (locally and
|
||||
// possibly synced between devices).
|
||||
LOCAL_OR_SYNCABLE,
|
||||
// The address is stored in a third party service that is tied
|
||||
// to user's account.
|
||||
ACCOUNT
|
||||
};
|
||||
|
||||
// Metadata about an autofill entry (address or credit card) which is used to
|
||||
// render a summary list of all entries.
|
||||
dictionary AutofillMetadata {
|
||||
// Short summary of the address/credit card which is displayed in the UI; an
|
||||
// undefined value means that this entry has just been created on the client
|
||||
// and has not yet been given a summary.
|
||||
DOMString summaryLabel;
|
||||
|
||||
// Short, secondary summary of the address/credit card which is displayed
|
||||
// in the UI; an undefined value means that this entry has just been created
|
||||
// on the client and has not yet been given a summary.
|
||||
DOMString? summarySublabel;
|
||||
|
||||
// For addresses. Describes where the address is stored.
|
||||
AddressSource? source;
|
||||
|
||||
// For credit cards, whether the entry is locally owned by Chrome (as opposed to
|
||||
// being synced down from the server). Non-local entries may not be editable.
|
||||
boolean? isLocal;
|
||||
|
||||
// For credit cards, whether this is a full copy of the card
|
||||
boolean? isCached;
|
||||
|
||||
// For credit cards, whether this is migratable (both the card number and
|
||||
// expiration date valid and does not have the duplicated server card).
|
||||
boolean? isMigratable;
|
||||
|
||||
// For credit cards. Indicates whether a card is eligible for virtual cards
|
||||
// enrollment.
|
||||
boolean? isVirtualCardEnrollmentEligible;
|
||||
|
||||
// For credit cards. Indicates whether a card has been enrolled in virtual
|
||||
// cards if it is eligible.
|
||||
boolean? isVirtualCardEnrolled;
|
||||
};
|
||||
|
||||
// Represents single entry of the autofill profile, containing field type and
|
||||
// the corresponding field value.
|
||||
dictionary AddressField {
|
||||
FieldType type;
|
||||
DOMString value;
|
||||
};
|
||||
|
||||
// An address entry which can be saved in the autofill section of the
|
||||
// settings UI.
|
||||
dictionary AddressEntry {
|
||||
// Globally unique identifier for this entry.
|
||||
DOMString? guid;
|
||||
|
||||
// Fields have to be stored in the array with every field style stored only
|
||||
// once.
|
||||
AddressField[] fields;
|
||||
|
||||
DOMString? languageCode;
|
||||
|
||||
AutofillMetadata? metadata;
|
||||
};
|
||||
|
||||
// An entry representing a country and its code.
|
||||
dictionary CountryEntry {
|
||||
// The internationalized name of the country.
|
||||
DOMString? name;
|
||||
|
||||
// A two-character string representing the country.
|
||||
DOMString? countryCode;
|
||||
};
|
||||
|
||||
// A component to be shown in an address editor. Different countries have
|
||||
// different components to their addresses.
|
||||
dictionary AddressComponent {
|
||||
// The field type.
|
||||
FieldType field;
|
||||
|
||||
// The name of the field.
|
||||
DOMString fieldName;
|
||||
|
||||
// A hint for the UI regarding whether the input is likely to be long.
|
||||
boolean isLongField;
|
||||
|
||||
// Whether this component is required or not.
|
||||
boolean isRequired;
|
||||
|
||||
// A placeholder for the text field to be used when the user has not yet
|
||||
// input a value for the field.
|
||||
DOMString? placeholder;
|
||||
};
|
||||
|
||||
// A row of address components. Each component in a row should be shown in the
|
||||
// same row in the UI. For example, city, state, and zip code are all included
|
||||
// on the same line for US addresses.
|
||||
dictionary AddressComponentRow {
|
||||
AddressComponent[] row;
|
||||
};
|
||||
|
||||
// The address components for a given country code. Each entry in |components|
|
||||
// constitutes a row in the UI, while each inner array contains the list of
|
||||
// components to use in that row. For example, city, state, and zip code are
|
||||
// all included on the same line for US addresses. This dictionary also
|
||||
// includes the associated language code.
|
||||
dictionary AddressComponents {
|
||||
// The components.
|
||||
AddressComponentRow[] components;
|
||||
|
||||
// The language code.
|
||||
DOMString languageCode;
|
||||
};
|
||||
|
||||
// A credit card entry which can be saved in the autofill section of the
|
||||
// settings UI.
|
||||
dictionary CreditCardEntry {
|
||||
// Globally unique identifier for this entry.
|
||||
DOMString? guid;
|
||||
|
||||
// The card's instrument ID from the GPay server, if applicable.
|
||||
DOMString? instrumentId;
|
||||
|
||||
// Name of the person who owns the credit card.
|
||||
DOMString? name;
|
||||
|
||||
// Credit card number.
|
||||
DOMString? cardNumber;
|
||||
|
||||
// Month as 2-character string ("01" = January, "12" = December).
|
||||
DOMString? expirationMonth;
|
||||
|
||||
// Year as a 4-character string (as in "2015").
|
||||
DOMString? expirationYear;
|
||||
|
||||
// Credit card's nickname.
|
||||
DOMString? nickname;
|
||||
|
||||
// Credit card's network.
|
||||
DOMString? network;
|
||||
|
||||
// Credit card's image source.
|
||||
DOMString? imageSrc;
|
||||
|
||||
// Credit card's masked cvc.
|
||||
DOMString? cvc;
|
||||
|
||||
// Credit card's product terms URL.
|
||||
DOMString? productTermsUrl;
|
||||
|
||||
AutofillMetadata? metadata;
|
||||
};
|
||||
|
||||
// An IBAN entry which can be saved in the autofill section of the
|
||||
// settings UI.
|
||||
dictionary IbanEntry {
|
||||
// Globally unique identifier for this entry.
|
||||
DOMString? guid;
|
||||
|
||||
// IBAN value.
|
||||
DOMString? value;
|
||||
|
||||
// IBAN's nickname.
|
||||
DOMString? nickname;
|
||||
|
||||
AutofillMetadata? metadata;
|
||||
};
|
||||
|
||||
callback GetAccountInfoCallback = void(optional AccountInfo accountInfo);
|
||||
callback GetCountryListCallback = void(CountryEntry[] countries);
|
||||
callback GetAddressComponentsCallback = void(AddressComponents components);
|
||||
callback GetAddressListCallback = void(AddressEntry[] entries);
|
||||
callback GetCreditCardListCallback = void(CreditCardEntry[] entries);
|
||||
callback GetIbanListCallback = void(IbanEntry[] entries);
|
||||
callback IsValidIbanCallback = void(boolean isValid);
|
||||
callback GetCreditCardCallback = void(optional CreditCardEntry card);
|
||||
callback CheckForDeviceAuthCallback = void(boolean isDeviceAuthAvailable);
|
||||
|
||||
interface Functions {
|
||||
// Gets currently signed-in user profile info, no value is returned if
|
||||
// the user is not signed-in.
|
||||
// |callback|: Callback which will be called with the info.
|
||||
static void getAccountInfo(
|
||||
GetAccountInfoCallback callback);
|
||||
|
||||
// Saves the given address. If |address| has an empty string as its ID, it
|
||||
// will be assigned a new one and added as a new entry.
|
||||
// |address|: The address entry to save.
|
||||
static void saveAddress(AddressEntry address);
|
||||
|
||||
// Gets the list of all countries.
|
||||
// |forAccountAddressProfile|: whether the address profile opened in the
|
||||
// editor originates in the user's profile.
|
||||
// |callback|: Callback which will be called with the countries.
|
||||
static void getCountryList(
|
||||
boolean forAccountAddressProfile,
|
||||
GetCountryListCallback callback);
|
||||
|
||||
// Gets the address components for a given country code.
|
||||
// |countryCode|: A two-character string representing the address' country
|
||||
// whose components should be returned. See autofill_country.cc for a
|
||||
// list of valid codes.
|
||||
// |callback|: Callback which will be called with components.
|
||||
static void getAddressComponents(
|
||||
DOMString countryCode,
|
||||
GetAddressComponentsCallback callback);
|
||||
|
||||
// Gets the list of addresses.
|
||||
// |callback|: Callback which will be called with the list of addresses.
|
||||
static void getAddressList(
|
||||
GetAddressListCallback callback);
|
||||
|
||||
// Saves the given credit card. If |card| has an empty string as its
|
||||
// ID, it will be assigned a new one and added as a new entry.
|
||||
// |card|: The card entry to save.
|
||||
static void saveCreditCard(CreditCardEntry card);
|
||||
|
||||
// Saves the given IBAN. If `iban` has an empty string as its ID, it will be
|
||||
// assigned a new one and added as a new entry.
|
||||
// |iban|: The IBAN entry to save.
|
||||
static void saveIban(IbanEntry iban);
|
||||
|
||||
// Removes the entry (address or credit card) with the given ID.
|
||||
// |guid|: ID of the entry to remove.
|
||||
static void removeEntry(DOMString guid);
|
||||
|
||||
// Gets the list of credit cards.
|
||||
// |callback|: Callback which will be called with the list of credit cards.
|
||||
static void getCreditCardList(
|
||||
GetCreditCardListCallback callback);
|
||||
|
||||
// Gets the list of IBANs.
|
||||
// `callback`: Callback which will be called with the list of IBANs.
|
||||
static void getIbanList(
|
||||
GetIbanListCallback callback);
|
||||
|
||||
// Returns true if the given `ibanValue` is a valid IBAN.
|
||||
// `callback`: Callback which will be called with the result of IBAN
|
||||
// validation.
|
||||
static void isValidIban(
|
||||
DOMString ibanValue, IsValidIbanCallback callback);
|
||||
|
||||
// Triggers local credit cards migration.
|
||||
static void migrateCreditCards();
|
||||
|
||||
// Logs that the server cards edit link was clicked.
|
||||
static void logServerCardLinkClicked();
|
||||
|
||||
// Enrolls a credit card into virtual cards.
|
||||
// |cardId|: The server side id of the credit card to be enrolled. Note it
|
||||
// refers to the legacy server id of credit cards, not the instrument ids.
|
||||
static void addVirtualCard(DOMString cardId);
|
||||
|
||||
// Unenrolls a credit card from virtual cards.
|
||||
// |cardId|: The server side id of the credit card to be unenrolled. Note
|
||||
// it refers to the legacy server id of credit cards, not the instrument
|
||||
// ids.
|
||||
static void removeVirtualCard(DOMString cardId);
|
||||
|
||||
// Authenticates the user via device authentication and if successful, it
|
||||
// will then flip the mandatory auth toggle.
|
||||
static void authenticateUserAndFlipMandatoryAuthToggle();
|
||||
|
||||
// Returns the local card based on the `guid` provided. The user could
|
||||
// also be challenged with a reauth if that is enabled. For a successful
|
||||
// auth, the local card is returned otherwise return a null object.
|
||||
static void getLocalCard(
|
||||
DOMString guid, GetCreditCardCallback callback);
|
||||
|
||||
// Returns true if there is authentication available on this device
|
||||
// (biometric or screen lock), false otherwise.
|
||||
static void checkIfDeviceAuthAvailable(
|
||||
CheckForDeviceAuthCallback callback);
|
||||
|
||||
// Bulk delete all the CVCs (server and local) from the local webdata
|
||||
// database. For server CVCs, this will also clear them from the Chrome
|
||||
// sync server and thus other devices.
|
||||
static void bulkDeleteAllCvcs();
|
||||
|
||||
// Sets the Sync Autofill toggle value, which corresponds to
|
||||
// `syncer::UserSelectableType::kAutofill` in `SyncUserSettings`.
|
||||
static void setAutofillSyncToggleEnabled(boolean enabled);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Fired when the personal data has changed, meaning that an entry has
|
||||
// been added, removed, or changed.
|
||||
// `addressEntries`: the updated list of addresses.
|
||||
// `creditCardEntries`: the updated list of credit cards.
|
||||
// `ibans`: the updated list of IBANs.
|
||||
// `accountInfo`: account info if the user is signed-in or no value if not.
|
||||
static void onPersonalDataChanged(AddressEntry[] addressEntries,
|
||||
CreditCardEntry[] creditCardEntries,
|
||||
IbanEntry[] ibans,
|
||||
optional AccountInfo accountInfo);
|
||||
};
|
||||
};
|
||||
+1678
File diff suppressed because it is too large
Load Diff
+93
@@ -0,0 +1,93 @@
|
||||
// Copyright 2013 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Braille display access private API.
|
||||
namespace brailleDisplayPrivate {
|
||||
// Braille display keyboard command.
|
||||
enum KeyCommand {
|
||||
line_up,
|
||||
line_down,
|
||||
pan_left,
|
||||
pan_right,
|
||||
top,
|
||||
bottom,
|
||||
routing,
|
||||
secondary_routing,
|
||||
dots,
|
||||
chord,
|
||||
standard_key
|
||||
};
|
||||
|
||||
// A keyboard event. This is not a standard keyboard event because
|
||||
// braille display keyboards look significantly different from standard
|
||||
// keyboards.
|
||||
dictionary KeyEvent {
|
||||
KeyCommand command;
|
||||
// 0-based display position for commands that involve a routing key.
|
||||
long? displayPosition;
|
||||
// Braille dot keys that were pressed, stored in the low-order bits.
|
||||
// Dot 1 is stored in bit 0, dot2 in bit 1, etc.
|
||||
long? brailleDots;
|
||||
// DOM keyboard event code. This is present when command is standard_key
|
||||
// and the braille display event represents a non-alphanumeric key such
|
||||
// as an arrow key or function key.
|
||||
// The value is as defined by the |code| property in
|
||||
// http://www.w3.org/TR/uievents/#keyboard-event-interface
|
||||
DOMString? standardKeyCode;
|
||||
// DOM keyboard event character value. This is present if the
|
||||
// braille key event corresponds to a character.
|
||||
DOMString? standardKeyChar;
|
||||
// Whether the space key was pressed.
|
||||
boolean? spaceKey;
|
||||
// Whether the alt key was pressed.
|
||||
boolean? altKey;
|
||||
// Whether the shift key was pressed.
|
||||
boolean? shiftKey;
|
||||
// Whether the ctrl key was pressed.
|
||||
boolean? ctrlKey;
|
||||
};
|
||||
|
||||
// The current braille display state.
|
||||
dictionary DisplayState {
|
||||
// Whether a braille display is currently available.
|
||||
boolean available;
|
||||
// Number of rows of braille cells on the currently connected display.
|
||||
long? textRowCount;
|
||||
// Number of columns of braille cells on the currently connected display.
|
||||
long? textColumnCount;
|
||||
// The number of dots in a braille cell on the currently connected display.
|
||||
long? cellSize;
|
||||
};
|
||||
|
||||
callback DisplayStateCallback = void(DisplayState result);
|
||||
|
||||
interface Functions {
|
||||
// Gets the current display state.
|
||||
static void getDisplayState(
|
||||
DisplayStateCallback callback);
|
||||
|
||||
// Write the given dot patterns to the display. The buffer contains one
|
||||
// byte for each braille cell on the display, starting from the leftmost
|
||||
// cell. Each byte contains a bit pattern indicating which dots should be
|
||||
// raised in the corresponding cell with the low-order bit representing
|
||||
// dot 1 and so on until bit 7 which corresponds to dot 8. If the number
|
||||
// of bytes in the buffer is not equal to the display size, the buffer
|
||||
// will either be clipped or padded with blank cells on the right. The
|
||||
// buffer is a 2D array compressed into 1D. The |columns| and |rows|
|
||||
// parameters give the original 2D dimensions of the buffer. To access
|
||||
// an element cells[r][c], simply access cells[r * columns + c].
|
||||
static void writeDots(ArrayBuffer cells, long columns, long rows);
|
||||
|
||||
// Updates the single user-preferred braille device with the given bluetooth
|
||||
// device address and starts or restarts the Brltty daemon.
|
||||
static void updateBluetoothBrailleDisplayAddress(DOMString address);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Fired when a braille display is connected or disconnected.
|
||||
static void onDisplayStateChanged(DisplayState state);
|
||||
// Fired when an input event is received from the display.
|
||||
static void onKeyEvent(KeyEvent event);
|
||||
};
|
||||
};
|
||||
+305
@@ -0,0 +1,305 @@
|
||||
// Copyright 2015 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use this API to expose certificates to the platform which can use these
|
||||
// certificates for TLS authentications.
|
||||
namespace certificateProvider {
|
||||
|
||||
// Types of supported cryptographic signature algorithms.
|
||||
enum Algorithm {
|
||||
// Specifies the RSASSA PKCS#1 v1.5 signature algorithm with the MD5-SHA-1
|
||||
// hashing. The extension must not prepend a DigestInfo prefix but only
|
||||
// add PKCS#1 padding. This algorithm is deprecated and will never be requested
|
||||
// by Chrome as of version 109.
|
||||
RSASSA_PKCS1_v1_5_MD5_SHA1,
|
||||
// Specifies the RSASSA PKCS#1 v1.5 signature algorithm
|
||||
// with the SHA-1 hash function.
|
||||
RSASSA_PKCS1_v1_5_SHA1,
|
||||
// Specifies the RSASSA PKCS#1 v1.5 signature algorithm
|
||||
// with the SHA-256 hashing function.
|
||||
RSASSA_PKCS1_v1_5_SHA256,
|
||||
// Specifies the RSASSA PKCS#1 v1.5 signature algorithm
|
||||
// with the SHA-384 hashing function.
|
||||
RSASSA_PKCS1_v1_5_SHA384,
|
||||
// Specifies the RSASSA PKCS#1 v1.5 signature algorithm
|
||||
// with the SHA-512 hashing function.
|
||||
RSASSA_PKCS1_v1_5_SHA512,
|
||||
// Specifies the RSASSA PSS signature algorithm with the SHA-256 hashing
|
||||
// function, MGF1 mask generation function and the salt of the same size as
|
||||
// the hash.
|
||||
RSASSA_PSS_SHA256,
|
||||
// Specifies the RSASSA PSS signature algorithm with the SHA-384 hashing
|
||||
// function, MGF1 mask generation function and the salt of the same size as
|
||||
// the hash.
|
||||
RSASSA_PSS_SHA384,
|
||||
// Specifies the RSASSA PSS signature algorithm with the SHA-512 hashing
|
||||
// function, MGF1 mask generation function and the salt of the same size as
|
||||
// the hash.
|
||||
RSASSA_PSS_SHA512
|
||||
};
|
||||
|
||||
// Types of errors that the extension can report.
|
||||
enum Error {
|
||||
// General error that cannot be represented by other more specific
|
||||
// error codes.
|
||||
GENERAL_ERROR
|
||||
};
|
||||
|
||||
// Information about a client certificate.
|
||||
[noinline_doc] dictionary ClientCertificateInfo {
|
||||
// The array must contain the DER encoding of the X.509 client certificate
|
||||
// as its first element.
|
||||
// <p>This must include exactly one certificate.</p>
|
||||
ArrayBuffer[] certificateChain;
|
||||
// All algorithms supported for this certificate. The extension will only be
|
||||
// asked for signatures using one of these algorithms.
|
||||
Algorithm[] supportedAlgorithms;
|
||||
};
|
||||
|
||||
dictionary SetCertificatesDetails {
|
||||
// When called in response to $(ref:onCertificatesUpdateRequested), should
|
||||
// contain the received <code>certificatesRequestId</code> value. Otherwise,
|
||||
// should be unset.
|
||||
long? certificatesRequestId;
|
||||
// Error that occurred while extracting the certificates, if any. This error
|
||||
// will be surfaced to the user when appropriate.
|
||||
Error? error;
|
||||
// List of currently available client certificates.
|
||||
ClientCertificateInfo[] clientCertificates;
|
||||
};
|
||||
|
||||
dictionary CertificatesUpdateRequest {
|
||||
// Request identifier to be passed to $(ref:setCertificates).
|
||||
long certificatesRequestId;
|
||||
};
|
||||
|
||||
dictionary SignatureRequest {
|
||||
// Request identifier to be passed to $(ref:reportSignature).
|
||||
long signRequestId;
|
||||
// Data to be signed. Note that the data is not hashed.
|
||||
ArrayBuffer input;
|
||||
// Signature algorithm to be used.
|
||||
Algorithm algorithm;
|
||||
// The DER encoding of a X.509 certificate. The extension must sign
|
||||
// <code>input</code> using the associated private key.
|
||||
ArrayBuffer certificate;
|
||||
};
|
||||
|
||||
dictionary ReportSignatureDetails {
|
||||
// Request identifier that was received via the $(ref:onSignatureRequested)
|
||||
// event.
|
||||
long signRequestId;
|
||||
// Error that occurred while generating the signature, if any.
|
||||
Error? error;
|
||||
// The signature, if successfully generated.
|
||||
ArrayBuffer? signature;
|
||||
};
|
||||
|
||||
// Deprecated. Replaced by $(ref:Algorithm).
|
||||
enum Hash {
|
||||
// Specifies the MD5 and SHA1 hashing algorithms.
|
||||
MD5_SHA1,
|
||||
// Specifies the SHA1 hashing algorithm.
|
||||
SHA1,
|
||||
// Specifies the SHA256 hashing algorithm.
|
||||
SHA256,
|
||||
// Specifies the SHA384 hashing algorithm.
|
||||
SHA384,
|
||||
// Specifies the SHA512 hashing algorithm.
|
||||
SHA512
|
||||
};
|
||||
|
||||
// The type of code being requested by the extension with requestPin function.
|
||||
enum PinRequestType {
|
||||
// Specifies the requested code is a PIN.
|
||||
PIN,
|
||||
// Specifies the requested code is a PUK.
|
||||
PUK
|
||||
};
|
||||
|
||||
// The types of errors that can be presented to the user through the
|
||||
// requestPin function.
|
||||
enum PinRequestErrorType {
|
||||
// Specifies the PIN is invalid.
|
||||
INVALID_PIN,
|
||||
// Specifies the PUK is invalid.
|
||||
INVALID_PUK,
|
||||
// Specifies the maximum attempt number has been exceeded.
|
||||
MAX_ATTEMPTS_EXCEEDED,
|
||||
// Specifies that the error cannot be represented by the above types.
|
||||
UNKNOWN_ERROR
|
||||
};
|
||||
|
||||
// Deprecated. Replaced by $(ref:ClientCertificateInfo).
|
||||
dictionary CertificateInfo {
|
||||
// Must be the DER encoding of a X.509 certificate. Currently, only
|
||||
// certificates of RSA keys are supported.
|
||||
ArrayBuffer certificate;
|
||||
|
||||
// Must be set to all hashes supported for this certificate. This extension
|
||||
// will only be asked for signatures of digests calculated with one of these
|
||||
// hash algorithms. This should be in order of decreasing hash preference.
|
||||
Hash[] supportedHashes;
|
||||
};
|
||||
|
||||
// Deprecated. Replaced by $(ref:SignatureRequest).
|
||||
dictionary SignRequest {
|
||||
// The unique ID to be used by the extension should it need to call a method
|
||||
// that requires it, e.g. requestPin.
|
||||
long signRequestId;
|
||||
|
||||
// The digest that must be signed.
|
||||
ArrayBuffer digest;
|
||||
|
||||
// Refers to the hash algorithm that was used to create <code>digest</code>.
|
||||
Hash hash;
|
||||
|
||||
// The DER encoding of a X.509 certificate. The extension must sign
|
||||
// <code>digest</code> using the associated private key.
|
||||
ArrayBuffer certificate;
|
||||
};
|
||||
|
||||
dictionary RequestPinDetails {
|
||||
// The ID given by Chrome in SignRequest.
|
||||
long signRequestId;
|
||||
|
||||
// The type of code requested. Default is PIN.
|
||||
PinRequestType? requestType;
|
||||
|
||||
// The error template displayed to the user. This should be set if the
|
||||
// previous request failed, to notify the user of the failure reason.
|
||||
PinRequestErrorType? errorType;
|
||||
|
||||
// The number of attempts left. This is provided so that any UI can present
|
||||
// this information to the user. Chrome is not expected to enforce this,
|
||||
// instead stopPinRequest should be called by the extension with
|
||||
// errorType = MAX_ATTEMPTS_EXCEEDED when the number of pin requests is
|
||||
// exceeded.
|
||||
long? attemptsLeft;
|
||||
};
|
||||
|
||||
dictionary StopPinRequestDetails {
|
||||
// The ID given by Chrome in SignRequest.
|
||||
long signRequestId;
|
||||
|
||||
// The error template. If present it is displayed to user. Intended to
|
||||
// contain the reason for stopping the flow if it was caused by an error,
|
||||
// e.g. MAX_ATTEMPTS_EXCEEDED.
|
||||
PinRequestErrorType? errorType;
|
||||
};
|
||||
|
||||
dictionary PinResponseDetails {
|
||||
// The code provided by the user. Empty if user closed the dialog or some
|
||||
// other error occurred.
|
||||
DOMString? userInput;
|
||||
};
|
||||
|
||||
callback RequestPinCallback = void (optional PinResponseDetails details);
|
||||
|
||||
callback StopPinRequestCallback = void ();
|
||||
|
||||
callback SetCertificatesCallback = void ();
|
||||
|
||||
callback ReportSignatureCallback = void ();
|
||||
|
||||
// The callback provided by the extension that Chrome uses to report back
|
||||
// rejected certificates. See <code>CertificatesCallback</code>.
|
||||
callback ResultCallback = void (ArrayBuffer[] rejectedCertificates);
|
||||
|
||||
// If no error occurred, this function must be called with the signature of
|
||||
// the digest using the private key of the requested certificate.
|
||||
// For an RSA key, the signature must be a PKCS#1 signature. The extension
|
||||
// is responsible for prepending the DigestInfo prefix and adding PKCS#1
|
||||
// padding. If an error occurred, this callback should be called without
|
||||
// signature.
|
||||
callback SignCallback = void (optional ArrayBuffer signature);
|
||||
|
||||
// Call this exactly once with the list of certificates that this extension is
|
||||
// providing. The list must only contain certificates for which the extension
|
||||
// can sign data using the associated private key. If the list contains
|
||||
// invalid certificates, these will be ignored. All valid certificates are
|
||||
// still registered for the extension. Chrome will call back with the list of
|
||||
// rejected certificates, which might be empty.
|
||||
callback CertificatesCallback =
|
||||
void (CertificateInfo[] certificates, ResultCallback callback);
|
||||
|
||||
interface Events {
|
||||
// This event fires if the certificates set via $(ref:setCertificates)
|
||||
// are insufficient or the browser requests updated information. The
|
||||
// extension must call $(ref:setCertificates) with the updated list of
|
||||
// certificates and the received <code>certificatesRequestId</code>.
|
||||
static void onCertificatesUpdateRequested(
|
||||
CertificatesUpdateRequest request);
|
||||
|
||||
// This event fires every time the browser needs to sign a message using a
|
||||
// certificate provided by this extension via $(ref:setCertificates).
|
||||
// <p>The extension must sign the input data from <code>request</code> using
|
||||
// the appropriate algorithm and private key and return it by calling
|
||||
// $(ref:reportSignature) with the received <code>signRequestId</code>.</p>
|
||||
static void onSignatureRequested(SignatureRequest request);
|
||||
|
||||
// <p>This event fires every time the browser requests the current list of
|
||||
// certificates provided by this extension. The extension must call
|
||||
// <code>reportCallback</code> exactly once with the current list of
|
||||
// certificates.</p>
|
||||
[deprecated="Use $(ref:onCertificatesUpdateRequested) instead."]
|
||||
static void onCertificatesRequested(CertificatesCallback reportCallback);
|
||||
|
||||
// This event fires every time the browser needs to sign a message using
|
||||
// a certificate provided by this extension in reply to an
|
||||
// $(ref:onCertificatesRequested) event.
|
||||
// The extension must sign the data in <code>request</code> using the
|
||||
// appropriate algorithm and private key and return it by calling
|
||||
// <code>reportCallback</code>. <code>reportCallback</code> must be called
|
||||
// exactly once.
|
||||
// |request|: Contains the details about the sign request.
|
||||
[deprecated="Use $(ref:onSignatureRequested) instead."]
|
||||
static void onSignDigestRequested(SignRequest request,
|
||||
SignCallback reportCallback);
|
||||
};
|
||||
|
||||
interface Functions {
|
||||
// Requests the PIN from the user. Only one ongoing request at a time is
|
||||
// allowed. The requests issued while another flow is ongoing are rejected.
|
||||
// It's the extension's responsibility to try again later if another flow is
|
||||
// in progress.
|
||||
// |details|: Contains the details about the requested dialog.
|
||||
// |callback|: Is called when the dialog is resolved with the user input, or
|
||||
// when the dialog request finishes unsuccessfully (e.g. the dialog was
|
||||
// canceled by the user or was not allowed to be shown).
|
||||
static void requestPin(
|
||||
RequestPinDetails details,
|
||||
RequestPinCallback callback);
|
||||
|
||||
// Stops the pin request started by the $(ref:requestPin) function.
|
||||
// |details|: Contains the details about the reason for stopping the
|
||||
// request flow.
|
||||
// |callback|: To be used by Chrome to send to the extension the status from
|
||||
// their request to close PIN dialog for user.
|
||||
static void stopPinRequest(
|
||||
StopPinRequestDetails details,
|
||||
StopPinRequestCallback callback);
|
||||
|
||||
// Sets a list of certificates to use in the browser.
|
||||
// <p>The extension should call this function after initialization and on
|
||||
// every change in the set of currently available certificates. The
|
||||
// extension should also call this function in response to
|
||||
// $(ref:onCertificatesUpdateRequested) every time this event is
|
||||
// received.</p>
|
||||
// |details|: The certificates to set. Invalid certificates will be ignored.
|
||||
// |callback|: Called upon completion.
|
||||
static void setCertificates(
|
||||
SetCertificatesDetails details,
|
||||
optional SetCertificatesCallback callback);
|
||||
|
||||
// Should be called as a response to $(ref:onSignatureRequested).
|
||||
// <p>The extension must eventually call this function for every
|
||||
// $(ref:onSignatureRequested) event; the API implementation will stop
|
||||
// waiting for this call after some time and respond with a timeout
|
||||
// error when this function is called.</p>
|
||||
static void reportSignature(
|
||||
ReportSignatureDetails details,
|
||||
optional ReportSignatureCallback callback);
|
||||
};
|
||||
};
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// Copyright 2015 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Internal API backing the chrome.certificateProvider API events.
|
||||
// The internal API associates events with replies to these events using request
|
||||
// IDs. A custom binding is used to hide these IDs from the public API.
|
||||
// Before an event hits the extension, the request ID is removed and instead a
|
||||
// callback is added to the event arguments. On the way back, when the extension
|
||||
// runs the callback to report its results, the callback magically prepends the
|
||||
// request ID to the results and calls the respective internal report function
|
||||
// (reportSignature or reportCertificates).
|
||||
[implemented_in = "chrome/browser/extensions/api/certificate_provider/certificate_provider_api.h"]
|
||||
namespace certificateProviderInternal {
|
||||
callback DoneCallback = void ();
|
||||
callback ResultCallback = void (ArrayBuffer[] rejectedCertificates);
|
||||
|
||||
interface Functions {
|
||||
// Matches certificateProvider.SignCallback. Must be called without the
|
||||
// signature to report an error.
|
||||
static void reportSignature(
|
||||
long requestId,
|
||||
optional ArrayBuffer signature,
|
||||
optional DoneCallback callback);
|
||||
|
||||
// Matches certificateProvider.CertificatesCallback. Must be called without
|
||||
// the certificates argument to report an error.
|
||||
static void reportCertificates(
|
||||
long requestId,
|
||||
optional certificateProvider.CertificateInfo[] certificates,
|
||||
optional ResultCallback callback);
|
||||
};
|
||||
};
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// Copyright 2021 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Stub namespace for the "chrome_url_overrides" manifest key.
|
||||
namespace chrome_url_overrides {
|
||||
dictionary UrlOverrideInfo {
|
||||
// Override for the chrome://newtab page.
|
||||
DOMString? newtab;
|
||||
|
||||
// Override for the chrome://bookmarks page.
|
||||
DOMString? bookmarks;
|
||||
|
||||
// Override for the chrome://history page.
|
||||
DOMString? history;
|
||||
|
||||
[nodoc, platforms=("chromeos")] DOMString? activationmessage;
|
||||
[nodoc, platforms=("chromeos")] DOMString? keyboard;
|
||||
};
|
||||
|
||||
dictionary ManifestKeys {
|
||||
// Chrome url overrides. Note that an extension can override only one page.
|
||||
UrlOverrideInfo chrome_url_overrides;
|
||||
};
|
||||
};
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
// Copyright 2019 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Private API for Chrome component extensions to report errors.
|
||||
[platforms=("chromeos")]
|
||||
namespace crashReportPrivate {
|
||||
// A dictionary containing additional context about the error.
|
||||
dictionary ErrorInfo {
|
||||
// The error message.
|
||||
DOMString message;
|
||||
|
||||
// URL where the error occurred.
|
||||
// Must be the full URL, containing the protocol (e.g.
|
||||
// http://www.example.com).
|
||||
DOMString url;
|
||||
|
||||
// Name of the product where the error occurred.
|
||||
// Defaults to the product variant of Chrome that is hosting the extension.
|
||||
// (e.g. "Chrome" or "Chrome_ChromeOS").
|
||||
DOMString? product;
|
||||
|
||||
// Version of the product where the error occurred.
|
||||
// Defaults to the version of Chrome that is hosting the extension (e.g.
|
||||
// "73.0.3683.75").
|
||||
DOMString? version;
|
||||
|
||||
// Line number where the error occurred.
|
||||
long? lineNumber;
|
||||
|
||||
// Column number where the error occurred.
|
||||
long? columnNumber;
|
||||
|
||||
// Used to map the obfuscated source code back to a source map. If present,
|
||||
// must match the debug_id used to upload the source map.
|
||||
DOMString? debugId;
|
||||
|
||||
// String containing the stack trace for the error.
|
||||
// Defaults to the empty string.
|
||||
DOMString? stackTrace;
|
||||
};
|
||||
|
||||
// Callback for |reportError|.
|
||||
callback ReportCallback = void ();
|
||||
|
||||
interface Functions {
|
||||
// Report and upload an error to Crash.
|
||||
// |info|: Information about the error.
|
||||
// |callback|: Called when the error has been uploaded.
|
||||
static void reportError(
|
||||
ErrorInfo info,
|
||||
ReportCallback callback);
|
||||
};
|
||||
};
|
||||
+893
@@ -0,0 +1,893 @@
|
||||
// Copyright 2012 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// developerPrivate API.
|
||||
// This is a private API exposing developing and debugging functionalities for
|
||||
// apps and extensions.
|
||||
namespace developerPrivate {
|
||||
|
||||
// DEPRECATED: Prefer ExtensionType.
|
||||
enum ItemType {
|
||||
hosted_app,
|
||||
packaged_app,
|
||||
legacy_packaged_app,
|
||||
extension,
|
||||
theme
|
||||
};
|
||||
|
||||
// DEPRECATED: Prefer ExtensionView.
|
||||
dictionary ItemInspectView {
|
||||
// path to the inspect page.
|
||||
DOMString path;
|
||||
|
||||
// For lazy background pages, the value is -1.
|
||||
long render_process_id;
|
||||
// This actually refers to a render frame.
|
||||
long render_view_id;
|
||||
|
||||
boolean incognito;
|
||||
boolean generatedBackgroundPage;
|
||||
};
|
||||
|
||||
// DEPRECATED: Use OpenDevTools.
|
||||
dictionary InspectOptions {
|
||||
DOMString extension_id;
|
||||
(DOMString or long) render_process_id;
|
||||
(DOMString or long) render_view_id;
|
||||
boolean incognito;
|
||||
};
|
||||
|
||||
dictionary InstallWarning {
|
||||
DOMString message;
|
||||
};
|
||||
|
||||
enum ExtensionType {
|
||||
HOSTED_APP,
|
||||
PLATFORM_APP,
|
||||
LEGACY_PACKAGED_APP,
|
||||
EXTENSION,
|
||||
THEME,
|
||||
SHARED_MODULE
|
||||
};
|
||||
|
||||
enum Location {
|
||||
FROM_STORE,
|
||||
UNPACKED,
|
||||
THIRD_PARTY,
|
||||
INSTALLED_BY_DEFAULT,
|
||||
// "Unknown" includes crx's installed from chrome://extensions.
|
||||
UNKNOWN
|
||||
};
|
||||
|
||||
enum ViewType {
|
||||
APP_WINDOW,
|
||||
BACKGROUND_CONTENTS,
|
||||
COMPONENT,
|
||||
EXTENSION_BACKGROUND_PAGE,
|
||||
EXTENSION_GUEST,
|
||||
EXTENSION_POPUP,
|
||||
EXTENSION_SERVICE_WORKER_BACKGROUND,
|
||||
TAB_CONTENTS,
|
||||
OFFSCREEN_DOCUMENT,
|
||||
EXTENSION_SIDE_PANEL
|
||||
};
|
||||
|
||||
enum ErrorType {
|
||||
MANIFEST,
|
||||
RUNTIME
|
||||
};
|
||||
|
||||
enum ErrorLevel {
|
||||
LOG,
|
||||
WARN,
|
||||
ERROR
|
||||
};
|
||||
|
||||
enum ExtensionState {
|
||||
ENABLED,
|
||||
DISABLED,
|
||||
TERMINATED,
|
||||
BLACKLISTED
|
||||
};
|
||||
|
||||
enum CommandScope {
|
||||
GLOBAL,
|
||||
CHROME
|
||||
};
|
||||
|
||||
enum SafetyCheckWarningReason {
|
||||
UNPUBLISHED,
|
||||
POLICY,
|
||||
MALWARE,
|
||||
OFFSTORE,
|
||||
UNWANTED,
|
||||
NO_PRIVACY_PRACTICE
|
||||
};
|
||||
|
||||
dictionary AccessModifier {
|
||||
boolean isEnabled;
|
||||
boolean isActive;
|
||||
};
|
||||
|
||||
dictionary StackFrame {
|
||||
long lineNumber;
|
||||
long columnNumber;
|
||||
DOMString url;
|
||||
DOMString functionName;
|
||||
};
|
||||
|
||||
dictionary ManifestError {
|
||||
ErrorType type;
|
||||
DOMString extensionId;
|
||||
boolean fromIncognito;
|
||||
DOMString source;
|
||||
DOMString message;
|
||||
long id;
|
||||
DOMString manifestKey;
|
||||
DOMString? manifestSpecific;
|
||||
};
|
||||
|
||||
dictionary RuntimeError {
|
||||
ErrorType type;
|
||||
DOMString extensionId;
|
||||
boolean fromIncognito;
|
||||
DOMString source;
|
||||
DOMString message;
|
||||
long id;
|
||||
ErrorLevel severity;
|
||||
DOMString contextUrl;
|
||||
long occurrences;
|
||||
long renderViewId;
|
||||
long renderProcessId;
|
||||
boolean canInspect;
|
||||
StackFrame[] stackTrace;
|
||||
};
|
||||
|
||||
dictionary DisableReasons {
|
||||
boolean suspiciousInstall;
|
||||
boolean corruptInstall;
|
||||
boolean updateRequired;
|
||||
boolean publishedInStoreRequired;
|
||||
boolean blockedByPolicy;
|
||||
boolean reloading;
|
||||
boolean custodianApprovalRequired;
|
||||
boolean parentDisabledPermissions;
|
||||
boolean unsupportedManifestVersion;
|
||||
};
|
||||
|
||||
dictionary OptionsPage {
|
||||
boolean openInTab;
|
||||
DOMString url;
|
||||
};
|
||||
|
||||
dictionary HomePage {
|
||||
DOMString url;
|
||||
boolean specified;
|
||||
};
|
||||
|
||||
dictionary ExtensionView {
|
||||
DOMString url;
|
||||
long renderProcessId;
|
||||
// This actually refers to a render frame.
|
||||
long renderViewId;
|
||||
boolean incognito;
|
||||
boolean isIframe;
|
||||
ViewType type;
|
||||
};
|
||||
|
||||
enum HostAccess {
|
||||
ON_CLICK,
|
||||
ON_SPECIFIC_SITES,
|
||||
ON_ALL_SITES
|
||||
};
|
||||
|
||||
dictionary SafetyCheckStrings {
|
||||
DOMString? panelString;
|
||||
DOMString? detailString;
|
||||
};
|
||||
|
||||
dictionary ControlledInfo {
|
||||
DOMString text;
|
||||
};
|
||||
|
||||
dictionary Command {
|
||||
DOMString description;
|
||||
DOMString keybinding;
|
||||
DOMString name;
|
||||
boolean isActive;
|
||||
CommandScope scope;
|
||||
boolean isExtensionAction;
|
||||
};
|
||||
|
||||
dictionary DependentExtension {
|
||||
DOMString id;
|
||||
DOMString name;
|
||||
};
|
||||
|
||||
dictionary Permission {
|
||||
DOMString message;
|
||||
DOMString[] submessages;
|
||||
};
|
||||
|
||||
dictionary SiteControl {
|
||||
// The host pattern for the site.
|
||||
DOMString host;
|
||||
// Whether the pattern has been granted.
|
||||
boolean granted;
|
||||
};
|
||||
|
||||
dictionary RuntimeHostPermissions {
|
||||
// True if |hosts| contains an all hosts like pattern.
|
||||
boolean hasAllHosts;
|
||||
|
||||
// The current HostAccess setting for the extension.
|
||||
HostAccess hostAccess;
|
||||
|
||||
// The site controls for all granted and requested patterns.
|
||||
SiteControl[] hosts;
|
||||
};
|
||||
|
||||
dictionary Permissions {
|
||||
Permission[] simplePermissions;
|
||||
|
||||
// Only populated for extensions that can be affected by the runtime host
|
||||
// permissions feature.
|
||||
RuntimeHostPermissions? runtimeHostPermissions;
|
||||
|
||||
// True if the extension can access site data through host permissions or
|
||||
// API permissions such as activeTab.
|
||||
boolean canAccessSiteData;
|
||||
};
|
||||
|
||||
dictionary ExtensionInfo {
|
||||
DOMString? blacklistText;
|
||||
SafetyCheckStrings? safetyCheckText;
|
||||
Command[] commands;
|
||||
ControlledInfo? controlledInfo;
|
||||
DependentExtension[] dependentExtensions;
|
||||
DOMString description;
|
||||
DisableReasons disableReasons;
|
||||
AccessModifier errorCollection;
|
||||
AccessModifier fileAccess;
|
||||
HomePage homePage;
|
||||
DOMString iconUrl;
|
||||
DOMString id;
|
||||
AccessModifier incognitoAccess;
|
||||
DOMString[] installWarnings;
|
||||
DOMString? launchUrl;
|
||||
Location location;
|
||||
DOMString? locationText;
|
||||
ManifestError[] manifestErrors;
|
||||
DOMString manifestHomePageUrl;
|
||||
boolean mustRemainInstalled;
|
||||
DOMString name;
|
||||
boolean offlineEnabled;
|
||||
OptionsPage? optionsPage;
|
||||
DOMString? path;
|
||||
Permissions permissions;
|
||||
DOMString? prettifiedPath;
|
||||
DOMString? recommendationsUrl;
|
||||
RuntimeError[] runtimeErrors;
|
||||
DOMString[] runtimeWarnings;
|
||||
ExtensionState state;
|
||||
ExtensionType type;
|
||||
DOMString updateUrl;
|
||||
boolean userMayModify;
|
||||
DOMString version;
|
||||
ExtensionView[] views;
|
||||
DOMString webStoreUrl;
|
||||
boolean showSafeBrowsingAllowlistWarning;
|
||||
SafetyCheckWarningReason? safetyCheckWarningReason;
|
||||
boolean showAccessRequestsInToolbar;
|
||||
boolean? pinnedToToolbar;
|
||||
boolean isAffectedByMV2Deprecation;
|
||||
boolean didAcknowledgeMV2DeprecationNotice;
|
||||
};
|
||||
|
||||
dictionary ProfileInfo {
|
||||
boolean canLoadUnpacked;
|
||||
boolean inDeveloperMode;
|
||||
boolean isDeveloperModeControlledByPolicy;
|
||||
boolean isIncognitoAvailable;
|
||||
boolean isChildAccount;
|
||||
boolean isMv2DeprecationNoticeDismissed;
|
||||
};
|
||||
|
||||
// DEPRECATED: Prefer ExtensionInfo.
|
||||
dictionary ItemInfo {
|
||||
DOMString id;
|
||||
DOMString name;
|
||||
DOMString version;
|
||||
DOMString description;
|
||||
boolean may_disable;
|
||||
boolean enabled;
|
||||
boolean isApp;
|
||||
ItemType type;
|
||||
boolean allow_activity;
|
||||
boolean allow_file_access;
|
||||
boolean wants_file_access;
|
||||
boolean incognito_enabled;
|
||||
boolean is_unpacked;
|
||||
boolean allow_reload;
|
||||
boolean terminated;
|
||||
boolean allow_incognito;
|
||||
DOMString icon_url;
|
||||
|
||||
// Path of an unpacked extension.
|
||||
DOMString? path;
|
||||
|
||||
// Options settings page for the item.
|
||||
DOMString? options_url;
|
||||
DOMString? app_launch_url;
|
||||
DOMString? homepage_url;
|
||||
DOMString? update_url;
|
||||
InstallWarning[] install_warnings;
|
||||
any[] manifest_errors;
|
||||
any[] runtime_errors;
|
||||
boolean offline_enabled;
|
||||
|
||||
// All views of the current extension.
|
||||
ItemInspectView[] views;
|
||||
};
|
||||
|
||||
dictionary GetExtensionsInfoOptions {
|
||||
boolean? includeDisabled;
|
||||
boolean? includeTerminated;
|
||||
};
|
||||
|
||||
dictionary ExtensionConfigurationUpdate {
|
||||
DOMString extensionId;
|
||||
boolean? fileAccess;
|
||||
boolean? incognitoAccess;
|
||||
boolean? errorCollection;
|
||||
HostAccess? hostAccess;
|
||||
boolean? showAccessRequestsInToolbar;
|
||||
SafetyCheckWarningReason? acknowledgeSafetyCheckWarningReason;
|
||||
boolean? acknowledgeSafetyCheckWarning;
|
||||
boolean? pinnedToToolbar;
|
||||
};
|
||||
|
||||
dictionary ProfileConfigurationUpdate {
|
||||
boolean? inDeveloperMode;
|
||||
boolean? isMv2DeprecationNoticeDismissed;
|
||||
};
|
||||
|
||||
dictionary ExtensionCommandUpdate {
|
||||
DOMString extensionId;
|
||||
DOMString commandName;
|
||||
CommandScope? scope;
|
||||
DOMString? keybinding;
|
||||
};
|
||||
|
||||
dictionary ReloadOptions {
|
||||
// If false, an alert dialog will show in the event of a reload error.
|
||||
// Defaults to false.
|
||||
boolean? failQuietly;
|
||||
|
||||
// If true, populates a LoadError for the response rather than setting
|
||||
// lastError. Only relevant for unpacked extensions; it will be ignored for
|
||||
// any other extension.
|
||||
boolean? populateErrorForUnpacked;
|
||||
};
|
||||
|
||||
dictionary LoadUnpackedOptions {
|
||||
// If false, an alert dialog will show in the event of a reload error.
|
||||
// Defaults to false.
|
||||
boolean? failQuietly;
|
||||
|
||||
// If true, populates a LoadError for the response rather than setting
|
||||
// lastError.
|
||||
boolean? populateError;
|
||||
|
||||
// A unique identifier for retrying a previous failed load. This should be
|
||||
// the identifier returned in the LoadError. If specified, the path
|
||||
// associated with the identifier will be loaded, and the file chooser
|
||||
// will be skipped.
|
||||
DOMString? retryGuid;
|
||||
|
||||
// True if the function should try to load an extension from the drop data
|
||||
// of the page. notifyDragInstallInProgress() needs to be called prior to
|
||||
// this being used. This cannot be used with |retryGuid|.
|
||||
boolean? useDraggedPath;
|
||||
};
|
||||
|
||||
// Describes which set of sites a given url/string is associated with. Note
|
||||
// that a site can belong to multiple sets at the same time.
|
||||
enum SiteSet {
|
||||
// The site is specified by the user to automatically grant access to all
|
||||
// extensions with matching host permissions. Mutually exclusive with
|
||||
// USER_RESTRICTED but takes precedence over EXTENSION_SPECIFIED.
|
||||
USER_PERMITTED,
|
||||
// The site is specified by the user to disallow all extensions from running
|
||||
// on it. Mutually exclusive with USER_PERMITTED but takes precedence over
|
||||
// EXTENSION_SPECIFIED.
|
||||
USER_RESTRICTED,
|
||||
// The site is specified by one or more extensions' set of host permissions.
|
||||
EXTENSION_SPECIFIED
|
||||
};
|
||||
|
||||
dictionary UserSiteSettingsOptions {
|
||||
// Specifies which set of user specified sites that the host will be added
|
||||
// to or removed from.
|
||||
SiteSet siteSet;
|
||||
// The sites to add/remove.
|
||||
DOMString[] hosts;
|
||||
};
|
||||
|
||||
dictionary UserSiteSettings {
|
||||
// The list of origins where the user has allowed all extensions to run on.
|
||||
DOMString[] permittedSites;
|
||||
// The list of origins where the user has blocked all extensions from
|
||||
// running on.
|
||||
DOMString[] restrictedSites;
|
||||
};
|
||||
|
||||
dictionary SiteInfo {
|
||||
// The site set that `site` belongs to.
|
||||
SiteSet siteSet;
|
||||
// The number of extensions with access to `site`.
|
||||
// TODO(crbug.com/40227416): A tricky edge case is when one extension
|
||||
// specifies something like *.foo.com and another specifies foo.com.
|
||||
// Patterns which match all subdomains should be represented differently.
|
||||
long numExtensions;
|
||||
// The site itself. This could either be a user specified site or an
|
||||
// extension host permission pattern.
|
||||
DOMString site;
|
||||
};
|
||||
|
||||
dictionary SiteGroup {
|
||||
// The common effective top level domain plus one (eTLD+1) for all sites in
|
||||
// `sites`.
|
||||
DOMString etldPlusOne;
|
||||
// The number of extensions that can run on at least one site inside `sites`
|
||||
// for this eTLD+1.
|
||||
long numExtensions;
|
||||
// The list of user or extension specified sites that share the same eTLD+1.
|
||||
SiteInfo[] sites;
|
||||
};
|
||||
|
||||
dictionary MatchingExtensionInfo {
|
||||
// The id of the matching extension.
|
||||
DOMString id;
|
||||
// Describes the extension's access to the queried site from
|
||||
// getMatchingExtensionsForSite. Note that the meaning is different from the
|
||||
// original enum:
|
||||
// - ON_CLICK: The extension requested access to the site but its access is
|
||||
// withheld.
|
||||
// - ON_SPECIFIC_SITES: the extension is permitted to run on at least one
|
||||
// site specified by the queried site but it does not request access to
|
||||
// all sites or it has its access withheld on at least one site in its
|
||||
// host permissions.
|
||||
// - ON_ALL_SITES: the extension is permitted to run on all sites.
|
||||
HostAccess siteAccess;
|
||||
// Whether the matching extension requests access to all sites in its
|
||||
// host permissions.
|
||||
boolean canRequestAllSites;
|
||||
};
|
||||
|
||||
dictionary ExtensionSiteAccessUpdate {
|
||||
// The id of the extension to update its site access settings for.
|
||||
DOMString id;
|
||||
// Describes the update made to the extension's site access for a given site
|
||||
// Note that this has a different meaning from the original enum:
|
||||
// - ON_CLICK: Withholds the extension's access to the given site,
|
||||
// - ON_SPECIFIC_SITES: Grants the extension access to the intersection of
|
||||
// (given site, extension's specified host permissions.)
|
||||
// - ON_ALL_SITES: Grants access to all of the extension's specified host
|
||||
// permissions.
|
||||
HostAccess siteAccess;
|
||||
};
|
||||
|
||||
enum PackStatus {
|
||||
SUCCESS,
|
||||
ERROR,
|
||||
WARNING
|
||||
};
|
||||
|
||||
enum FileType {
|
||||
LOAD,
|
||||
PEM
|
||||
};
|
||||
|
||||
enum SelectType {
|
||||
FILE,
|
||||
FOLDER
|
||||
};
|
||||
|
||||
enum EventType {
|
||||
INSTALLED,
|
||||
UNINSTALLED,
|
||||
LOADED,
|
||||
UNLOADED,
|
||||
// New window / view opened.
|
||||
VIEW_REGISTERED,
|
||||
// window / view closed.
|
||||
VIEW_UNREGISTERED,
|
||||
ERROR_ADDED,
|
||||
ERRORS_REMOVED,
|
||||
PREFS_CHANGED,
|
||||
WARNINGS_CHANGED,
|
||||
COMMAND_ADDED,
|
||||
COMMAND_REMOVED,
|
||||
PERMISSIONS_CHANGED,
|
||||
SERVICE_WORKER_STARTED,
|
||||
SERVICE_WORKER_STOPPED,
|
||||
CONFIGURATION_CHANGED,
|
||||
PINNED_ACTIONS_CHANGED
|
||||
};
|
||||
|
||||
dictionary PackDirectoryResponse {
|
||||
// The response message of success or error.
|
||||
DOMString message;
|
||||
|
||||
// Unpacked items's path.
|
||||
DOMString item_path;
|
||||
|
||||
// Permanent key path.
|
||||
DOMString pem_path;
|
||||
|
||||
long override_flags;
|
||||
PackStatus status;
|
||||
};
|
||||
|
||||
dictionary ProjectInfo {
|
||||
DOMString name;
|
||||
};
|
||||
|
||||
dictionary EventData {
|
||||
EventType event_type;
|
||||
DOMString item_id;
|
||||
ExtensionInfo? extensionInfo;
|
||||
};
|
||||
|
||||
dictionary ErrorFileSource {
|
||||
// The region before the "highlight" portion.
|
||||
// If the region which threw the error was not found, the full contents of
|
||||
// the file will be in the "beforeHighlight" section.
|
||||
DOMString beforeHighlight;
|
||||
|
||||
// The region of the code which threw the error, and should be highlighted.
|
||||
DOMString highlight;
|
||||
|
||||
// The region after the "highlight" portion.
|
||||
DOMString afterHighlight;
|
||||
};
|
||||
|
||||
dictionary LoadError {
|
||||
// The error that occurred when trying to load the extension.
|
||||
DOMString error;
|
||||
|
||||
// The path to the extension.
|
||||
DOMString path;
|
||||
|
||||
// The file source for the error, if it could be retrieved.
|
||||
ErrorFileSource? source;
|
||||
|
||||
// A unique identifier to pass to developerPrivate.loadUnpacked to retry
|
||||
// loading the extension at the same path.
|
||||
DOMString retryGuid;
|
||||
};
|
||||
|
||||
dictionary RequestFileSourceProperties {
|
||||
// The ID of the extension owning the file.
|
||||
DOMString extensionId;
|
||||
|
||||
// The path of the file, relative to the extension; e.g., manifest.json,
|
||||
// script.js, or main.html.
|
||||
DOMString pathSuffix;
|
||||
|
||||
// The error message which was thrown as a result of the error in the file.
|
||||
DOMString message;
|
||||
|
||||
// The key in the manifest which caused the error (e.g., "permissions").
|
||||
// (Required for "manifest.json" files)
|
||||
DOMString? manifestKey;
|
||||
|
||||
// The specific portion of the manifest key which caused the error (e.g.,
|
||||
// "foo" in the "permissions" key). (Optional for "manifest.json" file).
|
||||
DOMString? manifestSpecific;
|
||||
|
||||
// The line number which caused the error (optional for non-manifest files).
|
||||
long? lineNumber;
|
||||
};
|
||||
|
||||
dictionary RequestFileSourceResponse {
|
||||
// The region of the code which threw the error, and should be highlighted.
|
||||
DOMString highlight;
|
||||
|
||||
// The region before the "highlight" portion.
|
||||
// If the region which threw the error was not found, the full contents of
|
||||
// the file will be in the "beforeHighlight" section.
|
||||
DOMString beforeHighlight;
|
||||
|
||||
// The region after the "highlight" portion.
|
||||
DOMString afterHighlight;
|
||||
|
||||
// A title for the file in the form '<extension name>: <file name>'.
|
||||
DOMString title;
|
||||
|
||||
// The error message.
|
||||
DOMString message;
|
||||
};
|
||||
|
||||
dictionary OpenDevToolsProperties {
|
||||
// The ID of the extension. This is only needed if opening its background
|
||||
// page or its background service worker (where renderViewId and
|
||||
// renderProcessId are -1).
|
||||
DOMString? extensionId;
|
||||
|
||||
// The ID of the render frame in which the error occurred.
|
||||
// Despite being called renderViewId, this refers to a render frame.
|
||||
long renderViewId;
|
||||
|
||||
// The ID of the process in which the error occurred.
|
||||
long renderProcessId;
|
||||
|
||||
// Whether or not the background is service worker based.
|
||||
boolean? isServiceWorker;
|
||||
|
||||
boolean? incognito;
|
||||
|
||||
// The URL in which the error occurred.
|
||||
DOMString? url;
|
||||
|
||||
// The line to focus the devtools at.
|
||||
long? lineNumber;
|
||||
|
||||
// The column to focus the devtools at.
|
||||
long? columnNumber;
|
||||
};
|
||||
|
||||
dictionary DeleteExtensionErrorsProperties {
|
||||
DOMString extensionId;
|
||||
long[]? errorIds;
|
||||
ErrorType? type;
|
||||
};
|
||||
|
||||
callback VoidCallback = void ();
|
||||
callback BooleanCallback = void (boolean result);
|
||||
callback ExtensionInfosCallback = void (ExtensionInfo[] result);
|
||||
callback ExtensionInfoCallback = void (ExtensionInfo result);
|
||||
callback ItemsInfoCallback = void (ItemInfo[] result);
|
||||
callback ProfileInfoCallback = void (ProfileInfo info);
|
||||
callback GetProjectsInfoCallback = void (ProjectInfo[] result);
|
||||
callback PackCallback = void (PackDirectoryResponse response);
|
||||
callback StringCallback = void (DOMString string);
|
||||
callback RequestFileSourceCallback =
|
||||
void (RequestFileSourceResponse response);
|
||||
callback LoadErrorCallback = void (optional LoadError error);
|
||||
callback DragInstallInProgressCallback = void (DOMString loadGuid);
|
||||
callback UserSiteSettingsCallback = void (UserSiteSettings settings);
|
||||
callback UserAndExtensionSitesByEtldCallback = void (SiteGroup[] siteGroups);
|
||||
callback GetMatchingExtensionsForSiteCallback =
|
||||
void (MatchingExtensionInfo[] matchingExtensions);
|
||||
|
||||
interface Functions {
|
||||
// Runs auto update for extensions and apps immediately.
|
||||
// |callback| : Called after update check completes.
|
||||
static void autoUpdate(optional VoidCallback callback);
|
||||
|
||||
// Returns information of all the extensions and apps installed.
|
||||
// |options| : Options to restrict the items returned.
|
||||
// |callback| : Called with extensions info.
|
||||
static void getExtensionsInfo(
|
||||
optional GetExtensionsInfoOptions options,
|
||||
optional ExtensionInfosCallback callback);
|
||||
|
||||
// Returns information of a particular extension.
|
||||
// |id| : The id of the extension.
|
||||
// |callback| : Called with the result.
|
||||
static void getExtensionInfo(
|
||||
DOMString id,
|
||||
optional ExtensionInfoCallback callback);
|
||||
|
||||
// Returns the size of a particular extension on disk (already formatted).
|
||||
// |id| : The id of the extension.
|
||||
// |callback| : Called with the result.
|
||||
static void getExtensionSize(
|
||||
DOMString id,
|
||||
StringCallback callback);
|
||||
|
||||
// Returns the current profile's configuration.
|
||||
static void getProfileConfiguration(
|
||||
ProfileInfoCallback callback);
|
||||
|
||||
// Updates the active profile.
|
||||
// |update| : The parameters for updating the profile's configuration. Any
|
||||
// properties omitted from |update| will not be changed.
|
||||
static void updateProfileConfiguration(
|
||||
ProfileConfigurationUpdate update,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Reloads a given extension.
|
||||
// |extensionId| : The id of the extension to reload.
|
||||
// |options| : Additional configuration parameters.
|
||||
static void reload(
|
||||
DOMString extensionId,
|
||||
optional ReloadOptions options,
|
||||
optional LoadErrorCallback callback);
|
||||
|
||||
// Modifies an extension's current configuration.
|
||||
// |update| : The parameters for updating the extension's configuration.
|
||||
// Any properties omitted from |update| will not be changed.
|
||||
static void updateExtensionConfiguration(
|
||||
ExtensionConfigurationUpdate update,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Loads a user-selected unpacked item.
|
||||
// |options| : Additional configuration parameters.
|
||||
static void loadUnpacked(
|
||||
optional LoadUnpackedOptions options,
|
||||
optional LoadErrorCallback callback);
|
||||
|
||||
// Installs the file that was dragged and dropped onto the associated
|
||||
// page.
|
||||
static void installDroppedFile(
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Notifies the browser that a user began a drag in order to install an
|
||||
// extension.
|
||||
static void notifyDragInstallInProgress();
|
||||
|
||||
// Loads an extension / app.
|
||||
// |directory| : The directory to load the extension from.
|
||||
static void loadDirectory(
|
||||
[instanceOf=DirectoryEntry] object directory,
|
||||
StringCallback callback);
|
||||
|
||||
// Open Dialog to browse to an entry.
|
||||
// |selectType| : Select a file or a folder.
|
||||
// |fileType| : Required file type. For example, pem type is for private
|
||||
// key and load type is for an unpacked item.
|
||||
// |callback| : called with selected item's path.
|
||||
static void choosePath(
|
||||
SelectType selectType,
|
||||
FileType fileType,
|
||||
StringCallback callback);
|
||||
|
||||
// Pack an extension.
|
||||
// |rootPath| : The path of the extension.
|
||||
// |privateKeyPath| : The path of the private key, if one is given.
|
||||
// |flags| : Special flags to apply to the loading process, if any.
|
||||
// |callback| : called with the success result string.
|
||||
static void packDirectory(
|
||||
DOMString path,
|
||||
optional DOMString privateKeyPath,
|
||||
optional long flags,
|
||||
optional PackCallback callback);
|
||||
|
||||
// Returns true if the profile is managed.
|
||||
static void isProfileManaged(BooleanCallback callback);
|
||||
|
||||
// Reads and returns the contents of a file related to an extension which
|
||||
// caused an error.
|
||||
static void requestFileSource(
|
||||
RequestFileSourceProperties properties,
|
||||
RequestFileSourceCallback callback);
|
||||
|
||||
// Open the developer tools to focus on a particular error.
|
||||
static void openDevTools(
|
||||
OpenDevToolsProperties properties,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Delete reported extension errors.
|
||||
// |properties| : The properties specifying the errors to remove.
|
||||
static void deleteExtensionErrors(
|
||||
DeleteExtensionErrorsProperties properties,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Repairs the extension specified.
|
||||
// |extensionId| : The id of the extension to repair.
|
||||
static void repairExtension(
|
||||
DOMString extensionId,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Shows the options page for the extension specified.
|
||||
// |extensionId| : The id of the extension to show the options page for.
|
||||
static void showOptions(
|
||||
DOMString extensionId,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Shows the path of the extension specified.
|
||||
// |extensionId| : The id of the extension to show the path for.
|
||||
static void showPath(
|
||||
DOMString extensionId,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// (Un)suspends global shortcut handling.
|
||||
// |isSuspended| : Whether or not shortcut handling should be suspended.
|
||||
static void setShortcutHandlingSuspended(
|
||||
boolean isSuspended,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Updates an extension command.
|
||||
// |update| : The parameters for updating the extension command.
|
||||
static void updateExtensionCommand(
|
||||
ExtensionCommandUpdate update,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Adds a new host permission to the extension. The extension will only
|
||||
// have access to the host if it is within the requested permissions.
|
||||
// |extensionId|: The id of the extension to modify.
|
||||
// |host|: The host to add.
|
||||
static void addHostPermission(
|
||||
DOMString extensionId,
|
||||
DOMString host,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Removes a host permission from the extension. This should only be called
|
||||
// with a host that the extension has access to.
|
||||
// |extensionId|: The id of the extension to modify.
|
||||
// |host|: The host to remove.
|
||||
static void removeHostPermission(
|
||||
DOMString extensionId,
|
||||
DOMString host,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Returns the user specified site settings (which origins can extensions
|
||||
// always/never run on) for the current profile.
|
||||
static void getUserSiteSettings(
|
||||
UserSiteSettingsCallback callback);
|
||||
|
||||
// Adds hosts to the set of user permitted or restricted sites. If any hosts
|
||||
// are in the other set than what's specified in `options`, then they are
|
||||
// removed from that set.
|
||||
static void addUserSpecifiedSites(
|
||||
UserSiteSettingsOptions options,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Removes hosts from the specified set of user permitted or restricted
|
||||
// sites.
|
||||
static void removeUserSpecifiedSites(
|
||||
UserSiteSettingsOptions options,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Returns all hosts specified by user site settings, grouped by each host's
|
||||
// eTLD+1.
|
||||
static void getUserAndExtensionSitesByEtld(
|
||||
UserAndExtensionSitesByEtldCallback callback);
|
||||
|
||||
// Returns a list of extensions which have at least one matching site in
|
||||
// common between its set of host permissions and `site`.
|
||||
static void getMatchingExtensionsForSite(
|
||||
DOMString site,
|
||||
GetMatchingExtensionsForSiteCallback callback);
|
||||
|
||||
// Updates the site access settings for multiple extensions for the given
|
||||
// `site` and calls `callback` once all updates have been finished.
|
||||
// Each update species an extension id an a new HostAccess setting.
|
||||
static void updateSiteAccess(
|
||||
DOMString site,
|
||||
ExtensionSiteAccessUpdate[] updates,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Removes multiple installed extensions.
|
||||
static void removeMultipleExtensions(
|
||||
DOMString[] extensionIds,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Dismisses the menu notification for the extensions module in Safety Hub
|
||||
// if one is active.
|
||||
static void dismissSafetyHubExtensionsMenuNotification();
|
||||
|
||||
// Triggers the dismissal of the mv2 deprecation notice for `extensionId`.
|
||||
static void dismissMv2DeprecationNoticeForExtension(DOMString extensionId);
|
||||
|
||||
[nocompile, deprecated="Use openDevTools"]
|
||||
static void inspect(InspectOptions options,
|
||||
optional VoidCallback callback);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Fired when a item state is changed.
|
||||
static void onItemStateChanged(EventData response);
|
||||
|
||||
// Fired when the profile's state has changed.
|
||||
static void onProfileStateChanged(ProfileInfo info);
|
||||
|
||||
// Fired when the lists of sites in the user's site settings have changed.
|
||||
static void onUserSiteSettingsChanged(UserSiteSettings settings);
|
||||
};
|
||||
|
||||
};
|
||||
@@ -0,0 +1,654 @@
|
||||
// Copyright 2014 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.documentScan</code> API to discover and retrieve
|
||||
// images from attached document scanners.
|
||||
[platforms=("chromeos", "lacros"),
|
||||
implemented_in="chrome/browser/extensions/api/document_scan/document_scan_api.h"]
|
||||
namespace documentScan {
|
||||
dictionary ScanOptions {
|
||||
// The MIME types that are accepted by the caller.
|
||||
DOMString[]? mimeTypes;
|
||||
|
||||
// The number of scanned images allowed. The default is 1.
|
||||
long? maxImages;
|
||||
};
|
||||
|
||||
dictionary ScanResults {
|
||||
// An array of data image URLs in a form that can be passed as the "src"
|
||||
// value to an image tag.
|
||||
DOMString[] dataUrls;
|
||||
|
||||
// The MIME type of the <code>dataUrls</code>.
|
||||
DOMString mimeType;
|
||||
};
|
||||
|
||||
// An enum that indicates the result of each operation.
|
||||
enum OperationResult {
|
||||
// An unknown or generic failure occurred.
|
||||
UNKNOWN,
|
||||
|
||||
// The operation succeeded.
|
||||
SUCCESS,
|
||||
|
||||
// The operation is not supported.
|
||||
UNSUPPORTED,
|
||||
|
||||
// The operation was cancelled.
|
||||
CANCELLED,
|
||||
|
||||
// The device is busy.
|
||||
DEVICE_BUSY,
|
||||
|
||||
// Either the data or an argument passed to the method is not valid.
|
||||
INVALID,
|
||||
|
||||
// The supplied value is the wrong data type for the underlying option.
|
||||
WRONG_TYPE,
|
||||
|
||||
// No more data is available.
|
||||
EOF,
|
||||
|
||||
// The document feeder is jammed.
|
||||
ADF_JAMMED,
|
||||
|
||||
// The document feeder is empty.
|
||||
ADF_EMPTY,
|
||||
|
||||
// The flatbed cover is open.
|
||||
COVER_OPEN,
|
||||
|
||||
// An error occurred while communicating with the device.
|
||||
IO_ERROR,
|
||||
|
||||
// The device requires authentication.
|
||||
ACCESS_DENIED,
|
||||
|
||||
// Not enough memory is available on the Chromebook to complete the
|
||||
// operation.
|
||||
NO_MEMORY,
|
||||
|
||||
// The device is not reachable.
|
||||
UNREACHABLE,
|
||||
|
||||
// The device is disconnected.
|
||||
MISSING,
|
||||
|
||||
// An error has occurred somewhere other than the calling application.
|
||||
INTERNAL_ERROR
|
||||
};
|
||||
|
||||
// Indicates how the scanner is connected to the computer.
|
||||
enum ConnectionType {
|
||||
UNSPECIFIED,
|
||||
USB,
|
||||
NETWORK
|
||||
};
|
||||
|
||||
// Contains general information about a scanner. It is
|
||||
// intended for filtering and constructing user-facing information. to
|
||||
// configure a scan, use $(ref:StartScanOptions).
|
||||
dictionary ScannerInfo {
|
||||
// The ID of a specific scanner.
|
||||
DOMString scannerId;
|
||||
|
||||
// A human-readable name for the scanner to display in the UI.
|
||||
DOMString name;
|
||||
|
||||
// The scanner manufacturer.
|
||||
DOMString manufacturer;
|
||||
|
||||
// The scanner model if it is available, or a generic description.
|
||||
DOMString model;
|
||||
|
||||
// For matching against other <code>ScannerInfo</code> entries that point
|
||||
// to the same physical device.
|
||||
DOMString deviceUuid;
|
||||
|
||||
// Indicates how the scanner is connected to the computer.
|
||||
ConnectionType connectionType;
|
||||
|
||||
// If true, the scanner connection's transport cannot be intercepted by a
|
||||
// passive listener, such as TLS or USB.
|
||||
boolean secure;
|
||||
|
||||
// An array of MIME types that can be requested for returned scans.
|
||||
DOMString[] imageFormats;
|
||||
|
||||
// A human-readable description of the protocol or driver used to
|
||||
// access the scanner, such as Mopria, WSD, or epsonds. This is primarily
|
||||
// useful for allowing a user to choose between protocols if a device
|
||||
// supports multiple protocols.
|
||||
DOMString protocolType;
|
||||
};
|
||||
|
||||
// The data type of an option.
|
||||
enum OptionType {
|
||||
// The option's data type is unknown. The <code>value</code> property
|
||||
// will be unset.
|
||||
UNKNOWN,
|
||||
|
||||
// The <code>value</code> property will be one of <code>true</code or
|
||||
// <code>false</code>.
|
||||
BOOL,
|
||||
|
||||
// A signed 32-bit integer. The <code>value</code> property will be long or
|
||||
// long[], depending on whether the option takes more than one value.
|
||||
INT,
|
||||
|
||||
// A double in the range -32768-32767.9999 with a resolution of 1/65535.
|
||||
// The <code>value</code> property will be double or double[] depending
|
||||
// on whether the option takes more than one value. Double values that
|
||||
// can't be exactly represented will be rounded to the available range
|
||||
// and precision.
|
||||
FIXED,
|
||||
|
||||
// A sequence of any bytes except NUL ('\0'). The <code>value</code>
|
||||
// property will be a DOMString.
|
||||
STRING,
|
||||
|
||||
// An option of this type has no value. Instead, setting an option of
|
||||
// this type causes an option-specific side effect in the scanner
|
||||
// driver. For example, a button-typed option could be used by a
|
||||
// scanner driver to provide a means to select default values or to
|
||||
// tell an automatic document feeder to advance to the next sheet of
|
||||
// paper.
|
||||
BUTTON,
|
||||
|
||||
// Grouping option. No value. This is included for compatibility, but
|
||||
// will not normally be returned in <code>ScannerOption</code> values. Use
|
||||
// <code>getOptionGroups()</code> to retrieve the list of groups with their
|
||||
// member options.
|
||||
GROUP
|
||||
};
|
||||
|
||||
// Indicates the data type for $(ref:ScannerOption.unit).
|
||||
enum OptionUnit {
|
||||
// The value is a unitless number. For example, it can be a threshold.
|
||||
UNITLESS,
|
||||
|
||||
// The value is a number of pixels, for example, scan dimensions.
|
||||
PIXEL,
|
||||
|
||||
// The value is the number of bits, for example, color depth.
|
||||
BIT,
|
||||
|
||||
// The value is measured in millimeters, for example, scan dimensions.
|
||||
MM,
|
||||
|
||||
// The value is measured in dots per inch, for example, resolution.
|
||||
DPI,
|
||||
|
||||
// The value is a percent, for example, brightness.
|
||||
PERCENT,
|
||||
|
||||
// The value is measured in microseconds, for example, exposure time.
|
||||
MICROSECOND
|
||||
};
|
||||
|
||||
// The data type of constraint represented by an $(ref:OptionConstraint).
|
||||
enum ConstraintType {
|
||||
// The constraint on a range of <code>OptionType.INT</code> values.
|
||||
// The <code>min</code>, <code>max</code>, and <code>quant</code> properties
|
||||
// of <code>OptionConstraint</code> will be <code>long</code>, and its
|
||||
// <code>list</code> propety will be unset.
|
||||
INT_RANGE,
|
||||
|
||||
// The constraint on a range of <code>OptionType.FIXED</code> values.
|
||||
// The <code>min</code>, <code>max</code>, and <code>quant</code> properties
|
||||
// of <code>OptionConstraint</code> will be <code>double</code>, and its
|
||||
// <code>list</code> property will be unset.
|
||||
FIXED_RANGE,
|
||||
|
||||
// The constraint on a specific list of <code>OptionType.INT</code>
|
||||
// values. The <code>OptionConstraint.list</code> property will contain
|
||||
// <code>long</code> values, and the other properties will be unset.
|
||||
INT_LIST,
|
||||
|
||||
// The constraint on a specific list of <code>OptionType.FIXED</code>
|
||||
// values. The <code>OptionConstraint.list</code> property will contain
|
||||
// <code>double</code> values, and the other properties will be unset.
|
||||
FIXED_LIST,
|
||||
|
||||
// The constraint on a specific list of <code>OptionType.STRING</code>
|
||||
// values. The <code>OptionConstraint.list</code> property will contain
|
||||
// <code>DOMString</code> values, and the other properties will be unset.
|
||||
STRING_LIST
|
||||
};
|
||||
|
||||
// The specific values for the $(ref:ConstraintType) structure.
|
||||
// An unconstrained value is represented by a lack of constraints;
|
||||
// there is no separate <code>ConstraintType</code> value to indicate an
|
||||
// unconstrained value.
|
||||
dictionary OptionConstraint {
|
||||
ConstraintType type;
|
||||
(long or double)? min;
|
||||
(long or double)? max;
|
||||
(long or double)? quant;
|
||||
(double[] or long[] or DOMString[])? list;
|
||||
};
|
||||
|
||||
// How an option can be changed.
|
||||
enum Configurability {
|
||||
// The option is read-only.
|
||||
NOT_CONFIGURABLE,
|
||||
|
||||
// The option can be set in software.
|
||||
SOFTWARE_CONFIGURABLE,
|
||||
|
||||
// The option can be set by the user toggling or pushing a button on
|
||||
// the scanner.
|
||||
HARDWARE_CONFIGURABLE
|
||||
};
|
||||
|
||||
// A self-describing configurable scanner option and its current value.
|
||||
dictionary ScannerOption {
|
||||
// The option name using lowercase ASCII letters, numbers, and dashes.
|
||||
// Diacritics are not allowed.
|
||||
DOMString name;
|
||||
|
||||
// A printable one-line title.
|
||||
DOMString title;
|
||||
|
||||
// A longer description of the option.
|
||||
DOMString description;
|
||||
|
||||
// The data type contained in the <code>value</code> property, which
|
||||
// is needed for setting this option.
|
||||
OptionType type;
|
||||
|
||||
// The unit of measurement for this option.
|
||||
OptionUnit unit;
|
||||
|
||||
// The current value of the option, if relevant. Note that the data
|
||||
// type of this property must match the data type specified in
|
||||
// <code>type</code>.
|
||||
(boolean or double or double[] or long or long[] or DOMString)? value;
|
||||
|
||||
// Defines $(ref:OptionConstraint) on the current scanner option.
|
||||
OptionConstraint? constraint;
|
||||
|
||||
// Indicates that this option can be detected from software.
|
||||
boolean isDetectable;
|
||||
|
||||
// Indicates whether and how the option can be changed.
|
||||
Configurability configurability;
|
||||
|
||||
// Can be automatically set by the scanner driver.
|
||||
boolean isAutoSettable;
|
||||
|
||||
// Emulated by the scanner driver if true.
|
||||
boolean isEmulated;
|
||||
|
||||
// Indicates the option is active and can be set or retrieved. If false,
|
||||
// the <code>value</code> property will not be set.
|
||||
boolean isActive;
|
||||
|
||||
// Indicates that the UI should not display this option by default.
|
||||
boolean isAdvanced;
|
||||
|
||||
// Indicates that the option is used for internal configuration and
|
||||
// should never be displayed in the UI.
|
||||
boolean isInternal;
|
||||
};
|
||||
|
||||
// A set of criteria passed to <code>getScannerList()</code>. Only devices
|
||||
// that match all of the criteria will be returned.
|
||||
dictionary DeviceFilter {
|
||||
// Only return scanners that are directly attached to the computer.
|
||||
boolean? local;
|
||||
|
||||
// Only return scanners that use a secure transport, such as USB or TLS.
|
||||
boolean? secure;
|
||||
};
|
||||
|
||||
// Contains a list of option names. The groups and their contents are
|
||||
// determined by the scanner driver and do not have any defined semantics
|
||||
// or consistent membership. This structure is primarily intended
|
||||
// for UI layout assistance; it does not affect individual option
|
||||
// behaviors.
|
||||
dictionary OptionGroup {
|
||||
// Provides a printable title, for example "Geometry options".
|
||||
DOMString title;
|
||||
|
||||
// An array of option names in driver-provided order.
|
||||
DOMString[] members;
|
||||
};
|
||||
|
||||
// The response from $(ref:getScannerList).
|
||||
dictionary GetScannerListResponse {
|
||||
// The enumeration result. Note that partial results could be
|
||||
// returned even if this indicates an error.
|
||||
OperationResult result;
|
||||
|
||||
// A possibly-empty list of scanners that match the provided
|
||||
// $(ref:DeviceFilter).
|
||||
ScannerInfo[] scanners;
|
||||
};
|
||||
|
||||
// The response from $(ref:openScanner).
|
||||
dictionary OpenScannerResponse {
|
||||
// The scanner ID passed to <code>openScanner()</code>.
|
||||
DOMString scannerId;
|
||||
|
||||
// The result of opening the scanner. If the value of this is
|
||||
// <code>SUCCESS</code>, the <code>scannerHandle</code> and
|
||||
// <code>options</code> properties will be populated.
|
||||
OperationResult result;
|
||||
|
||||
// If <code>result</code> is <code>SUCCESS</code>, a
|
||||
// handle to the scanner that can be used for further operations.
|
||||
DOMString? scannerHandle;
|
||||
|
||||
// If <code>result</code> is <code>SUCCESS</code>,
|
||||
// provides a key-value mapping where the key is a device-specific
|
||||
// option and the value is an instance of $(ref:ScannerOption).
|
||||
object? options;
|
||||
};
|
||||
|
||||
// The response from $(ref:getOptionGroups).
|
||||
dictionary GetOptionGroupsResponse {
|
||||
// The same scanner handle as was passed to $(ref:getOptionGroups).
|
||||
DOMString scannerHandle;
|
||||
|
||||
// The result of getting the option groups. If the value of this is
|
||||
// <code>SUCCESS</code>, the <code>groups</code> property will be
|
||||
// populated.
|
||||
OperationResult result;
|
||||
|
||||
// If <code>result</code> is <code>SUCCESS</code>, provides a
|
||||
// list of option groups in the order supplied by the scanner driver.
|
||||
OptionGroup[]? groups;
|
||||
};
|
||||
|
||||
// The response from <code>closeScanner()</code>.
|
||||
dictionary CloseScannerResponse {
|
||||
// The same scanner handle as was passed to $(ref:closeScanner).
|
||||
DOMString scannerHandle;
|
||||
|
||||
// The result of closing the scanner. Even if this value is not
|
||||
// <code>SUCCESS</code>, the handle will be invalid and
|
||||
// should not be used for any further operations.
|
||||
OperationResult result;
|
||||
};
|
||||
|
||||
// Passed to $(ref:setOptions) to set an option to $(ref:ScannerOption) to
|
||||
// a new value.
|
||||
dictionary OptionSetting {
|
||||
// Indicates the name of the option to set.
|
||||
DOMString name;
|
||||
|
||||
// Indicates the data type of the option. The requested data type must
|
||||
// match the real data type of the underlying option.
|
||||
OptionType type;
|
||||
|
||||
// Indicates the value to set. Leave unset to request automatic setting for
|
||||
// options that have <code>autoSettable</code> enabled. The data type
|
||||
// supplied for <code>value</code> must match <code>type</code>.
|
||||
(boolean or double or double[] or long or long[] or DOMString)? value;
|
||||
};
|
||||
|
||||
// The result of setting an individual option. Each individual option
|
||||
// supplied to <code>setOptions()</code> produces a separate result
|
||||
// due to things like rounding and constraints.
|
||||
dictionary SetOptionResult {
|
||||
// Indicates the name of the option that was set.
|
||||
DOMString name;
|
||||
|
||||
// Indicates the result of setting the option.
|
||||
OperationResult result;
|
||||
};
|
||||
|
||||
// The response from a call to $(ref:setOptions).
|
||||
dictionary SetOptionsResponse {
|
||||
// Provides the scanner handle passed to <code>setOptions()</code>.
|
||||
DOMString scannerHandle;
|
||||
|
||||
// An array of results, one each for every passed-in
|
||||
// <code>OptionSetting</code>.
|
||||
SetOptionResult[] results;
|
||||
|
||||
// An updated key-value mapping from option names to
|
||||
// $(ref:ScannerOption) values containing the new configuration after
|
||||
// attempting to set all supplied options. This has the same structure as
|
||||
// the <code>options</code> property in $(ref:OpenScannerResponse).
|
||||
//
|
||||
// This property will be set even if some options were not set successfully,
|
||||
// but will be unset if retrieving the updated configuration fails (for
|
||||
// example, if the scanner is disconnected in the middle of scanning).
|
||||
object? options;
|
||||
};
|
||||
|
||||
// Specifies options for $(ref:startScan).
|
||||
dictionary StartScanOptions {
|
||||
// Specifies the MIME type to return scanned data in.
|
||||
DOMString format;
|
||||
|
||||
// If a non-zero value is specified, limits the maximum scanned bytes
|
||||
// returned in a single $(ref:readScanData) response to that value. The
|
||||
// smallest allowed value is 32768 (32 KB). If this property is not
|
||||
// specified, the size of a returned chunk may be as large as the entire
|
||||
// scanned image.
|
||||
long? maxReadSize;
|
||||
};
|
||||
|
||||
// The response from <code>startScan()</code>.
|
||||
dictionary StartScanResponse {
|
||||
// Provides the same scanner handle that was passed to
|
||||
// <code>startScan()</code>.
|
||||
DOMString scannerHandle;
|
||||
|
||||
// The result of starting a scan. If the value of this is
|
||||
// <code>SUCCESS</code>, the <code>job</code> property will be populated.
|
||||
OperationResult result;
|
||||
|
||||
// If <code>result</code> is <code>SUCCESS</code>, provides a
|
||||
// handle that can be used to read scan data or cancel the job.
|
||||
DOMString? job;
|
||||
};
|
||||
|
||||
// The response from <code>cancelScan()</code>.
|
||||
dictionary CancelScanResponse {
|
||||
// Provides the same job handle that was passed to
|
||||
// <code>cancelScan()</code>.
|
||||
DOMString job;
|
||||
|
||||
// The backend's cancel scan result. If the result is
|
||||
// <code>OperationResult.SUCCESS</code> or
|
||||
// <code>OperationResult.CANCELLED</code>, the scan has been cancelled and
|
||||
// the scanner is ready to start a new scan. If the result is
|
||||
// <code>OperationResult.DEVICE_BUSY </code>, the scanner is still
|
||||
// processing the requested cancellation; the caller should wait a short
|
||||
// time and try the request again. Other result values indicate a permanent
|
||||
// error that should not be retried.
|
||||
OperationResult result;
|
||||
};
|
||||
|
||||
// The response from $(ref:readScanData).
|
||||
dictionary ReadScanDataResponse {
|
||||
// Provides the job handle passed to <code>readScanData()</code>.
|
||||
DOMString job;
|
||||
|
||||
// The result of reading data. If its value is
|
||||
// <code>SUCCESS</code>, then <code>data</code> contains the
|
||||
// <em>next</em> (possibly zero-length) chunk of image data that is ready
|
||||
// for reading. If its value is <code>EOF</code>, the <code>data</code>
|
||||
// contains the <em>last</em> chunk of image data.
|
||||
OperationResult result;
|
||||
|
||||
// If <code>result</code> is <code>SUCCESS</code>, contains
|
||||
// the <em>next</em> chunk of scanned image data. If <code>result</code> is
|
||||
// <code>EOF</code>, contains the <em>last</em> chunk of
|
||||
// scanned image data.
|
||||
ArrayBuffer? data;
|
||||
|
||||
// If <code>result</code> is <code>SUCCESS</code>, an estimate of
|
||||
// how much of the total scan data has been delivered so far, in the range
|
||||
// 0 to 100.
|
||||
long? estimatedCompletion;
|
||||
};
|
||||
|
||||
// Callback from the $(ref:scan) method.
|
||||
// |result| Provides the results from the scan, if successful.
|
||||
// Otherwise, this value will be null and $(ref:runtime.lastError)
|
||||
// will be set.
|
||||
callback ScanCallback = void (ScanResults result);
|
||||
|
||||
// Callback from the $(ref:getScannerList) method.
|
||||
// |response| The response from enumeration, if the call was valid.
|
||||
// Otherwise, this value will be null and $(ref:runtime.lastError)
|
||||
// will be set.
|
||||
callback GetScannerListCallback = void (GetScannerListResponse response);
|
||||
|
||||
// Callback from the $(ref:openScanner) method.
|
||||
// |response| The response from opening the scanner, if the call was valid.
|
||||
// Otherwise, this value will be null and $(ref:runtime.lastError)
|
||||
// will be set.
|
||||
callback OpenScannerCallback = void (OpenScannerResponse response);
|
||||
|
||||
// Callback from the $(ref:getOptionGroups) method.
|
||||
// |response| The response from getting the option groups, if the call was
|
||||
// valid. Otherwise, this value will be null and $(ref:runtime.lastError)
|
||||
// will be set.
|
||||
callback GetOptionGroupsCallback =
|
||||
void (GetOptionGroupsResponse response);
|
||||
|
||||
// Callback from the $(ref:closeScanner) method.
|
||||
// |response| The response from closing the scanner, if the call was valid.
|
||||
// Otherwise, this value will be null and $(ref:runtime.lastError)
|
||||
// will be set.
|
||||
callback CloseScannerCallback = void (CloseScannerResponse response);
|
||||
|
||||
// Callback from the $(ref:setOptions) method.
|
||||
// |response| The response from setting the options, if the call was valid.
|
||||
// Otherwise, this value will be null and $(ref:runtime.lastError)
|
||||
// will be set.
|
||||
callback SetOptionsCallback = void (SetOptionsResponse response);
|
||||
|
||||
// Callback from the $(ref:startScan) method.
|
||||
// |response| The response from starting the scan, if the call was valid.
|
||||
// Otherwise, this value will be null and $(ref:runtime.lastError)
|
||||
// will be set.
|
||||
callback StartScanCallback = void (StartScanResponse response);
|
||||
|
||||
// Callback from the $(ref:cancelScan) method.
|
||||
// |response| The response from canceling the scan, if the call was valid.
|
||||
// Otherwise, this value will be null and $(ref:runtime.lastError)
|
||||
// will be set.
|
||||
callback CancelScanCallback = void (CancelScanResponse response);
|
||||
|
||||
// Callback from the $(ref:readScanData) method.
|
||||
// |response| The response from reading the next chunk of scanned image data,
|
||||
// if the call was valid. Otherwise, this value will be null and
|
||||
// $(ref:runtime.lastError) will be set.
|
||||
callback ReadScanDataCallback = void (ReadScanDataResponse response);
|
||||
|
||||
interface Functions {
|
||||
// Performs a document scan and returns a Promise that resolves
|
||||
// with a $(ref:ScanResults) object. If a callback is passed to
|
||||
// this function, the returned data is passed to it instead.
|
||||
// |options| : An object containing scan parameters.
|
||||
// |callback| : Called with the result and data from the scan.
|
||||
static void scan(
|
||||
ScanOptions options,
|
||||
ScanCallback callback);
|
||||
|
||||
// Gets the list of available scanners and returns a Promise that
|
||||
// resolves with a $(ref:GetScannerListResponse) object. If a callback
|
||||
// is passed to this function, returned data is passed to it instead.
|
||||
// |filter| : A $(ref:DeviceFilter) indicating which types of scanners
|
||||
// should be returned.
|
||||
// |callback| : Called with the result and list of scanners.
|
||||
static void getScannerList(
|
||||
DeviceFilter filter, GetScannerListCallback callback);
|
||||
|
||||
// Opens a scanner for exclusive access and returns a Promise that
|
||||
// resolves with an $(ref:OpenScannerResponse) object. If a callback
|
||||
// is passed to this function, returned data is passed to it instead.
|
||||
// |scannerId| : The ID of a scanner to be opened. This value is one
|
||||
// returned from a previous call to $(ref:getScannerList).
|
||||
// |callback| : Called with the result.
|
||||
static void openScanner(
|
||||
DOMString scannerId, OpenScannerCallback callback);
|
||||
|
||||
// Gets the group names and member options from a scanner previously
|
||||
// opened by $(ref:openScanner). This method returns a Promise that
|
||||
// resolves with a $(ref:GetOptionGroupsResponse) object. If a callback
|
||||
// is passed to this function, returned data is passed to it instead.
|
||||
// |scannerHandle| : The handle of an open scanner returned from a call
|
||||
// to $(ref:openScanner).
|
||||
// |callback| : Called with the result.
|
||||
static void getOptionGroups(
|
||||
DOMString scannerHandle, GetOptionGroupsCallback callback);
|
||||
|
||||
// Closes the scanner with the passed in handle and returns a Promise
|
||||
// that resolves with a $(ref:CloseScannerResponse) object. If a callback
|
||||
// is used, the object is passed to it instead. Even if the response is
|
||||
// not a success, the supplied handle becomes invalid and should not be
|
||||
// used for further operations.
|
||||
// |scannerHandle| : Specifies the handle of an open scanner that was
|
||||
// previously returned from a call to $(ref:openScanner).
|
||||
// |callback| : Called with the result.
|
||||
static void closeScanner(
|
||||
DOMString scannerHandle, CloseScannerCallback callback);
|
||||
|
||||
// Sets options on the specified scanner and returns a Promise that
|
||||
// resolves with a $(ref:SetOptionsResponse) object containing the
|
||||
// result of trying to set every value in the order of the passed-in
|
||||
// $(ref:OptionSetting) object. If a callback is used, the object is
|
||||
// passed to it instead.
|
||||
// |scannerHandle| : The handle of the scanner to set options on. This
|
||||
// should be a value previously returned from a call to $(ref:openScanner).
|
||||
// |options| : A list of <code>OptionSetting</code> objects to be applied to
|
||||
// the scanner.
|
||||
// |callback| : Called with the result.
|
||||
static void setOptions(
|
||||
DOMString scannerHandle, OptionSetting[] options,
|
||||
SetOptionsCallback callback);
|
||||
|
||||
// Starts a scan on the specified scanner and returns a Promise that
|
||||
// resolves with a $(ref:StartScanResponse). If a callback is used,
|
||||
// the object is passed to it instead. If the call was successful, the
|
||||
// response includes a job handle that can be used in subsequent calls
|
||||
// to read scan data or cancel a scan.
|
||||
// |scannerHandle| : The handle of an open scanner. This should be a value
|
||||
// previously returned from a call to $(ref:openScanner).
|
||||
// |options| : A $(ref:StartScanOptions) object indicating the options to
|
||||
// be used for the scan. The <code>StartScanOptions.format</code> property
|
||||
// must match one of the entries returned in the scanner's
|
||||
// <code>ScannerInfo</code>.
|
||||
// |callback| : Called with the result.
|
||||
static void startScan(
|
||||
DOMString scannerHandle, StartScanOptions options,
|
||||
StartScanCallback callback);
|
||||
|
||||
// Cancels a started scan and returns a Promise that resolves with a
|
||||
// $(ref:CancelScanResponse) object. If a callback is used, the object
|
||||
// is passed to it instead.
|
||||
// |job| : The handle of an active scan job previously returned from a
|
||||
// call to $(ref:startScan).
|
||||
// |callback| : Called with the result.
|
||||
static void cancelScan(
|
||||
DOMString job, CancelScanCallback callback);
|
||||
|
||||
// Reads the next chunk of available image data from an active job handle,
|
||||
// and returns a Promise that resolves with a $(ref:ReadScanDataResponse)
|
||||
// object. If a callback is used, the object is passed to it instead.
|
||||
//
|
||||
// <aside class="note"><b>Note:</b>It is valid for a response result to be
|
||||
// <code>SUCCESS</code> with a zero-length <code>data</code>
|
||||
// member. This means the scanner is still working but does not yet have
|
||||
// additional data ready. The caller should wait a short time and try again.
|
||||
//
|
||||
// When the scan job completes, the response will have the result value of
|
||||
// <code>EOF</code>. This response may contain a final
|
||||
// non-zero <code>data</code> member.</aside>
|
||||
//
|
||||
// |job| : Active job handle previously returned from
|
||||
// $(ref:startScan).
|
||||
// |callback| : Called with the result.
|
||||
static void readScanData(
|
||||
DOMString job, ReadScanDataCallback callback);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,630 @@
|
||||
// Copyright 2012 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.downloads</code> API to programmatically initiate,
|
||||
// monitor, manipulate, and search for downloads.
|
||||
[permissions=downloads]
|
||||
namespace downloads {
|
||||
[inline_doc] dictionary HeaderNameValuePair {
|
||||
// Name of the HTTP header.
|
||||
DOMString name;
|
||||
|
||||
// Value of the HTTP header.
|
||||
DOMString value;
|
||||
};
|
||||
|
||||
// <dl><dt>uniquify</dt>
|
||||
// <dd>To avoid duplication, the <code>filename</code> is changed to
|
||||
// include a counter before the filename extension.</dd>
|
||||
// <dt>overwrite</dt>
|
||||
// <dd>The existing file will be overwritten with the new file.</dd>
|
||||
// <dt>prompt</dt>
|
||||
// <dd>The user will be prompted with a file chooser dialog.</dd>
|
||||
// </dl>
|
||||
enum FilenameConflictAction {uniquify, overwrite, prompt};
|
||||
|
||||
[inline_doc] dictionary FilenameSuggestion {
|
||||
// The $(ref:DownloadItem)'s new target $(ref:DownloadItem.filename), as a path
|
||||
// relative to the user's default Downloads directory, possibly containing
|
||||
// subdirectories. Absolute paths, empty paths, and paths containing
|
||||
// back-references ".." will be ignored. <code>filename</code> is ignored if
|
||||
// there are any $(ref:onDeterminingFilename) listeners registered by any
|
||||
// extensions.
|
||||
DOMString filename;
|
||||
|
||||
// The action to take if <code>filename</code> already exists.
|
||||
FilenameConflictAction? conflictAction;
|
||||
};
|
||||
|
||||
[inline_doc] enum HttpMethod {GET, POST};
|
||||
|
||||
enum InterruptReason {
|
||||
FILE_FAILED,
|
||||
FILE_ACCESS_DENIED,
|
||||
FILE_NO_SPACE,
|
||||
FILE_NAME_TOO_LONG,
|
||||
FILE_TOO_LARGE,
|
||||
FILE_VIRUS_INFECTED,
|
||||
FILE_TRANSIENT_ERROR,
|
||||
FILE_BLOCKED,
|
||||
FILE_SECURITY_CHECK_FAILED,
|
||||
FILE_TOO_SHORT,
|
||||
FILE_HASH_MISMATCH,
|
||||
FILE_SAME_AS_SOURCE,
|
||||
NETWORK_FAILED,
|
||||
NETWORK_TIMEOUT,
|
||||
NETWORK_DISCONNECTED,
|
||||
NETWORK_SERVER_DOWN,
|
||||
NETWORK_INVALID_REQUEST,
|
||||
SERVER_FAILED,
|
||||
SERVER_NO_RANGE,
|
||||
SERVER_BAD_CONTENT,
|
||||
SERVER_UNAUTHORIZED,
|
||||
SERVER_CERT_PROBLEM,
|
||||
SERVER_FORBIDDEN,
|
||||
SERVER_UNREACHABLE,
|
||||
SERVER_CONTENT_LENGTH_MISMATCH,
|
||||
SERVER_CROSS_ORIGIN_REDIRECT,
|
||||
USER_CANCELED,
|
||||
USER_SHUTDOWN,
|
||||
CRASH};
|
||||
|
||||
[inline_doc] dictionary DownloadOptions {
|
||||
// The URL to download.
|
||||
DOMString url;
|
||||
|
||||
// A file path relative to the Downloads directory to contain the downloaded
|
||||
// file, possibly containing subdirectories. Absolute paths, empty paths,
|
||||
// and paths containing back-references ".." will cause an error.
|
||||
// $(ref:onDeterminingFilename) allows suggesting a filename after the file's
|
||||
// MIME type and a tentative filename have been determined.
|
||||
DOMString? filename;
|
||||
|
||||
// The action to take if <code>filename</code> already exists.
|
||||
FilenameConflictAction? conflictAction;
|
||||
|
||||
// Use a file-chooser to allow the user to select a filename regardless of
|
||||
// whether <code>filename</code> is set or already exists.
|
||||
boolean? saveAs;
|
||||
|
||||
// The HTTP method to use if the URL uses the HTTP[S] protocol.
|
||||
HttpMethod? method;
|
||||
|
||||
// Extra HTTP headers to send with the request if the URL uses the HTTP[s]
|
||||
// protocol. Each header is represented as a dictionary containing the keys
|
||||
// <code>name</code> and either <code>value</code> or
|
||||
// <code>binaryValue</code>, restricted to those allowed by XMLHttpRequest.
|
||||
HeaderNameValuePair[]? headers;
|
||||
|
||||
// Post body.
|
||||
DOMString? body;
|
||||
};
|
||||
|
||||
// <dl><dt>file</dt>
|
||||
// <dd>The download's filename is suspicious.</dd>
|
||||
// <dt>url</dt>
|
||||
// <dd>The download's URL is known to be malicious.</dd>
|
||||
// <dt>content</dt>
|
||||
// <dd>The downloaded file is known to be malicious.</dd>
|
||||
// <dt>uncommon</dt>
|
||||
// <dd>The download's URL is not commonly downloaded and could be
|
||||
// dangerous.</dd>
|
||||
// <dt>host</dt>
|
||||
// <dd>The download came from a host known to distribute malicious
|
||||
// binaries and is likely dangerous.</dd>
|
||||
// <dt>unwanted</dt>
|
||||
// <dd>The download is potentially unwanted or unsafe. E.g. it could make
|
||||
// changes to browser or computer settings.</dd>
|
||||
// <dt>safe</dt>
|
||||
// <dd>The download presents no known danger to the user's computer.</dd>
|
||||
// <dt>accepted</dt>
|
||||
// <dd>The user has accepted the dangerous download.</dd>
|
||||
// </dl>
|
||||
enum DangerType {
|
||||
file,
|
||||
url,
|
||||
content,
|
||||
uncommon,
|
||||
host,
|
||||
unwanted,
|
||||
safe,
|
||||
accepted,
|
||||
allowlistedByPolicy,
|
||||
asyncScanning,
|
||||
asyncLocalPasswordScanning,
|
||||
passwordProtected,
|
||||
blockedTooLarge,
|
||||
sensitiveContentWarning,
|
||||
sensitiveContentBlock,
|
||||
deepScannedFailed,
|
||||
deepScannedSafe,
|
||||
deepScannedOpenedDangerous,
|
||||
promptForScanning,
|
||||
promptForLocalPasswordScanning,
|
||||
accountCompromise,
|
||||
blockedScanFailed
|
||||
};
|
||||
|
||||
// <dl><dt>in_progress</dt>
|
||||
// <dd>The download is currently receiving data from the server.</dd>
|
||||
// <dt>interrupted</dt>
|
||||
// <dd>An error broke the connection with the file host.</dd>
|
||||
// <dt>complete</dt>
|
||||
// <dd>The download completed successfully.</dd>
|
||||
// </dl>
|
||||
enum State {in_progress, interrupted, complete};
|
||||
|
||||
// The state of the process of downloading a file.
|
||||
dictionary DownloadItem {
|
||||
// An identifier that is persistent across browser sessions.
|
||||
long id;
|
||||
|
||||
// The absolute URL that this download initiated from, before any
|
||||
// redirects.
|
||||
DOMString url;
|
||||
|
||||
// The absolute URL that this download is being made from, after all
|
||||
// redirects.
|
||||
DOMString finalUrl;
|
||||
|
||||
// Absolute URL.
|
||||
DOMString referrer;
|
||||
|
||||
// Absolute local path.
|
||||
DOMString filename;
|
||||
|
||||
// False if this download is recorded in the history, true if it is not
|
||||
// recorded.
|
||||
boolean incognito;
|
||||
|
||||
// Indication of whether this download is thought to be safe or known to be
|
||||
// suspicious.
|
||||
DangerType danger;
|
||||
|
||||
// The file's MIME type.
|
||||
DOMString mime;
|
||||
|
||||
// The time when the download began in ISO 8601 format. May be passed
|
||||
// directly to the Date constructor: <code>chrome.downloads.search({},
|
||||
// function(items){items.forEach(function(item){console.log(new
|
||||
// Date(item.startTime))})})</code>
|
||||
DOMString startTime;
|
||||
|
||||
// The time when the download ended in ISO 8601 format. May be passed
|
||||
// directly to the Date constructor: <code>chrome.downloads.search({},
|
||||
// function(items){items.forEach(function(item){if (item.endTime)
|
||||
// console.log(new Date(item.endTime))})})</code>
|
||||
DOMString? endTime;
|
||||
|
||||
// Estimated time when the download will complete in ISO 8601 format. May be
|
||||
// passed directly to the Date constructor:
|
||||
// <code>chrome.downloads.search({},
|
||||
// function(items){items.forEach(function(item){if (item.estimatedEndTime)
|
||||
// console.log(new Date(item.estimatedEndTime))})})</code>
|
||||
DOMString? estimatedEndTime;
|
||||
|
||||
// Indicates whether the download is progressing, interrupted, or complete.
|
||||
State state;
|
||||
|
||||
// True if the download has stopped reading data from the host, but kept the
|
||||
// connection open.
|
||||
boolean paused;
|
||||
|
||||
// True if the download is in progress and paused, or else if it is
|
||||
// interrupted and can be resumed starting from where it was interrupted.
|
||||
boolean canResume;
|
||||
|
||||
// Why the download was interrupted. Several kinds of HTTP errors may be
|
||||
// grouped under one of the errors beginning with <code>SERVER_</code>.
|
||||
// Errors relating to the network begin with <code>NETWORK_</code>, errors
|
||||
// relating to the process of writing the file to the file system begin with
|
||||
// <code>FILE_</code>, and interruptions initiated by the user begin with
|
||||
// <code>USER_</code>.
|
||||
InterruptReason? error;
|
||||
|
||||
// Number of bytes received so far from the host, without considering file
|
||||
// compression.
|
||||
double bytesReceived;
|
||||
|
||||
// Number of bytes in the whole file, without considering file compression,
|
||||
// or -1 if unknown.
|
||||
double totalBytes;
|
||||
|
||||
// Number of bytes in the whole file post-decompression, or -1 if unknown.
|
||||
double fileSize;
|
||||
|
||||
// Whether the downloaded file still exists. This information may be out of
|
||||
// date because Chrome does not automatically watch for file removal. Call
|
||||
// $(ref:search)() in order to trigger the check for file existence. When the
|
||||
// existence check completes, if the file has been deleted, then an
|
||||
// $(ref:onChanged) event will fire. Note that $(ref:search)() does not wait
|
||||
// for the existence check to finish before returning, so results from
|
||||
// $(ref:search)() may not accurately reflect the file system. Also,
|
||||
// $(ref:search)() may be called as often as necessary, but will not check for
|
||||
// file existence any more frequently than once every 10 seconds.
|
||||
boolean exists;
|
||||
|
||||
// The identifier for the extension that initiated this download if this
|
||||
// download was initiated by an extension. Does not change once it is set.
|
||||
DOMString? byExtensionId;
|
||||
|
||||
// The localized name of the extension that initiated this download if this
|
||||
// download was initiated by an extension. May change if the extension
|
||||
// changes its name or if the user changes their locale.
|
||||
DOMString? byExtensionName;
|
||||
};
|
||||
|
||||
[inline_doc] dictionary DownloadQuery {
|
||||
// This array of search terms limits results to $(ref:DownloadItem) whose
|
||||
// <code>filename</code> or <code>url</code> or <code>finalUrl</code>
|
||||
// contain all of the search terms that do not begin with a dash '-' and
|
||||
// none of the search terms that do begin with a dash.
|
||||
DOMString[]? query;
|
||||
|
||||
// Limits results to $(ref:DownloadItem) that
|
||||
// started before the given ms in ISO 8601 format.
|
||||
DOMString? startedBefore;
|
||||
|
||||
// Limits results to $(ref:DownloadItem) that
|
||||
// started after the given ms in ISO 8601 format.
|
||||
DOMString? startedAfter;
|
||||
|
||||
// Limits results to $(ref:DownloadItem) that ended before the given ms in
|
||||
// ISO 8601 format.
|
||||
DOMString? endedBefore;
|
||||
|
||||
// Limits results to $(ref:DownloadItem) that ended after the given ms in
|
||||
// ISO 8601 format
|
||||
DOMString? endedAfter;
|
||||
|
||||
// Limits results to $(ref:DownloadItem) whose
|
||||
// <code>totalBytes</code> is greater than the given integer.
|
||||
double? totalBytesGreater;
|
||||
|
||||
// Limits results to $(ref:DownloadItem) whose
|
||||
// <code>totalBytes</code> is less than the given integer.
|
||||
double? totalBytesLess;
|
||||
|
||||
// Limits results to $(ref:DownloadItem) whose
|
||||
// <code>filename</code> matches the given regular expression.
|
||||
DOMString? filenameRegex;
|
||||
|
||||
// Limits results to $(ref:DownloadItem) whose
|
||||
// <code>url</code> matches the given regular expression.
|
||||
DOMString? urlRegex;
|
||||
|
||||
// Limits results to $(ref:DownloadItem) whose
|
||||
// <code>finalUrl</code> matches the given regular expression.
|
||||
DOMString? finalUrlRegex;
|
||||
|
||||
// The maximum number of matching $(ref:DownloadItem) returned. Defaults to
|
||||
// 1000. Set to 0 in order to return all matching $(ref:DownloadItem). See
|
||||
// $(ref:search) for how to page through results.
|
||||
long? limit;
|
||||
|
||||
// Set elements of this array to $(ref:DownloadItem) properties in order to
|
||||
// sort search results. For example, setting
|
||||
// <code>orderBy=['startTime']</code> sorts the $(ref:DownloadItem) by their
|
||||
// start time in ascending order. To specify descending order, prefix with a
|
||||
// hyphen: '-startTime'.
|
||||
DOMString[]? orderBy;
|
||||
|
||||
// The <code>id</code> of the $(ref:DownloadItem) to query.
|
||||
long? id;
|
||||
|
||||
// The absolute URL that this download initiated from, before any
|
||||
// redirects.
|
||||
DOMString? url;
|
||||
|
||||
// The absolute URL that this download is being made from, after all
|
||||
// redirects.
|
||||
DOMString? finalUrl;
|
||||
|
||||
// Absolute local path.
|
||||
DOMString? filename;
|
||||
|
||||
// Indication of whether this download is thought to be safe or known to be
|
||||
// suspicious.
|
||||
DangerType? danger;
|
||||
|
||||
// The file's MIME type.
|
||||
DOMString? mime;
|
||||
|
||||
// The time when the download began in ISO 8601 format.
|
||||
DOMString? startTime;
|
||||
|
||||
// The time when the download ended in ISO 8601 format.
|
||||
DOMString? endTime;
|
||||
|
||||
// Indicates whether the download is progressing, interrupted, or complete.
|
||||
State? state;
|
||||
|
||||
// True if the download has stopped reading data from the host, but kept the
|
||||
// connection open.
|
||||
boolean? paused;
|
||||
|
||||
// Why a download was interrupted.
|
||||
InterruptReason? error;
|
||||
|
||||
// Number of bytes received so far from the host, without considering file
|
||||
// compression.
|
||||
double? bytesReceived;
|
||||
|
||||
// Number of bytes in the whole file, without considering file compression,
|
||||
// or -1 if unknown.
|
||||
double? totalBytes;
|
||||
|
||||
// Number of bytes in the whole file post-decompression, or -1 if unknown.
|
||||
double? fileSize;
|
||||
|
||||
// Whether the downloaded file exists;
|
||||
boolean? exists;
|
||||
};
|
||||
|
||||
dictionary StringDelta {
|
||||
DOMString? previous;
|
||||
DOMString? current;
|
||||
};
|
||||
|
||||
dictionary DoubleDelta {
|
||||
double? previous;
|
||||
double? current;
|
||||
};
|
||||
|
||||
dictionary BooleanDelta {
|
||||
boolean? previous;
|
||||
boolean? current;
|
||||
};
|
||||
|
||||
// Encapsulates a change in a DownloadItem.
|
||||
[inline_doc] dictionary DownloadDelta {
|
||||
// The <code>id</code> of the $(ref:DownloadItem)
|
||||
// that changed.
|
||||
long id;
|
||||
|
||||
// The change in <code>url</code>, if any.
|
||||
StringDelta? url;
|
||||
|
||||
// The change in <code>finalUrl</code>, if any.
|
||||
StringDelta? finalUrl;
|
||||
|
||||
// The change in <code>filename</code>, if any.
|
||||
StringDelta? filename;
|
||||
|
||||
// The change in <code>danger</code>, if any.
|
||||
StringDelta? danger;
|
||||
|
||||
// The change in <code>mime</code>, if any.
|
||||
StringDelta? mime;
|
||||
|
||||
// The change in <code>startTime</code>, if any.
|
||||
StringDelta? startTime;
|
||||
|
||||
// The change in <code>endTime</code>, if any.
|
||||
StringDelta? endTime;
|
||||
|
||||
// The change in <code>state</code>, if any.
|
||||
StringDelta? state;
|
||||
|
||||
// The change in <code>canResume</code>, if any.
|
||||
BooleanDelta? canResume;
|
||||
|
||||
// The change in <code>paused</code>, if any.
|
||||
BooleanDelta? paused;
|
||||
|
||||
// The change in <code>error</code>, if any.
|
||||
StringDelta? error;
|
||||
|
||||
// The change in <code>totalBytes</code>, if any.
|
||||
DoubleDelta? totalBytes;
|
||||
|
||||
// The change in <code>fileSize</code>, if any.
|
||||
DoubleDelta? fileSize;
|
||||
|
||||
// The change in <code>exists</code>, if any.
|
||||
BooleanDelta? exists;
|
||||
};
|
||||
|
||||
[inline_doc] dictionary GetFileIconOptions {
|
||||
// The size of the returned icon. The icon will be square with dimensions
|
||||
// size * size pixels. The default and largest size for the icon is 32x32
|
||||
// pixels. The only supported sizes are 16 and 32. It is an error to specify
|
||||
// any other size.
|
||||
long? size;
|
||||
};
|
||||
|
||||
// Encapsulates a change in the download UI.
|
||||
[inline_doc] dictionary UiOptions {
|
||||
// Enable or disable the download UI.
|
||||
boolean enabled;
|
||||
};
|
||||
|
||||
callback DownloadCallback = void(long downloadId);
|
||||
callback SearchCallback = void(DownloadItem[] results);
|
||||
callback EraseCallback = void(long[] erasedIds);
|
||||
callback NullCallback = void();
|
||||
callback GetFileIconCallback = void(optional DOMString iconURL);
|
||||
callback SuggestFilenameCallback = void(
|
||||
optional FilenameSuggestion suggestion);
|
||||
|
||||
interface Functions {
|
||||
// Download a URL. If the URL uses the HTTP[S] protocol, then the request
|
||||
// will include all cookies currently set for its hostname. If both
|
||||
// <code>filename</code> and <code>saveAs</code> are specified, then the
|
||||
// Save As dialog will be displayed, pre-populated with the specified
|
||||
// <code>filename</code>. If the download started successfully,
|
||||
// <code>callback</code> will be called with the new $(ref:DownloadItem)'s
|
||||
// <code>downloadId</code>. If there was an error starting the download,
|
||||
// then <code>callback</code> will be called with
|
||||
// <code>downloadId=undefined</code> and $(ref:runtime.lastError) will contain
|
||||
// a descriptive string. The error strings are not guaranteed to remain
|
||||
// backwards compatible between releases. Extensions must not parse it.
|
||||
// |options|: What to download and how.
|
||||
// |callback|: Called with the id of the new $(ref:DownloadItem).
|
||||
static void download(
|
||||
DownloadOptions options,
|
||||
optional DownloadCallback callback);
|
||||
|
||||
// Find $(ref:DownloadItem). Set <code>query</code> to the empty object to get
|
||||
// all $(ref:DownloadItem). To get a specific $(ref:DownloadItem), set only the
|
||||
// <code>id</code> field. To page through a large number of items, set
|
||||
// <code>orderBy: ['-startTime']</code>, set <code>limit</code> to the
|
||||
// number of items per page, and set <code>startedAfter</code> to the
|
||||
// <code>startTime</code> of the last item from the last page.
|
||||
static void search(
|
||||
DownloadQuery query,
|
||||
SearchCallback callback);
|
||||
|
||||
// Pause the download. If the request was successful the download is in a
|
||||
// paused state. Otherwise $(ref:runtime.lastError) contains an error message.
|
||||
// The request will fail if the download is not active.
|
||||
// |downloadId|: The id of the download to pause.
|
||||
// |callback|: Called when the pause request is completed.
|
||||
static void pause(
|
||||
long downloadId,
|
||||
optional NullCallback callback);
|
||||
|
||||
// Resume a paused download. If the request was successful the download is
|
||||
// in progress and unpaused. Otherwise $(ref:runtime.lastError) contains an
|
||||
// error message. The request will fail if the download is not active.
|
||||
// |downloadId|: The id of the download to resume.
|
||||
// |callback|: Called when the resume request is completed.
|
||||
static void resume(
|
||||
long downloadId,
|
||||
optional NullCallback callback);
|
||||
|
||||
// Cancel a download. When <code>callback</code> is run, the download is
|
||||
// cancelled, completed, interrupted or doesn't exist anymore.
|
||||
// |downloadId|: The id of the download to cancel.
|
||||
// |callback|: Called when the cancel request is completed.
|
||||
static void cancel(
|
||||
long downloadId,
|
||||
optional NullCallback callback);
|
||||
|
||||
// Retrieve an icon for the specified download. For new downloads, file
|
||||
// icons are available after the $(ref:onCreated) event has been received. The
|
||||
// image returned by this function while a download is in progress may be
|
||||
// different from the image returned after the download is complete. Icon
|
||||
// retrieval is done by querying the underlying operating system or toolkit
|
||||
// depending on the platform. The icon that is returned will therefore
|
||||
// depend on a number of factors including state of the download, platform,
|
||||
// registered file types and visual theme. If a file icon cannot be
|
||||
// determined, $(ref:runtime.lastError) will contain an error message.
|
||||
// |downloadId|: The identifier for the download.
|
||||
// |callback|: A URL to an image that represents the download.
|
||||
static void getFileIcon(
|
||||
long downloadId,
|
||||
optional GetFileIconOptions options,
|
||||
GetFileIconCallback callback);
|
||||
|
||||
// Opens the downloaded file now if the $(ref:DownloadItem) is complete;
|
||||
// otherwise returns an error through $(ref:runtime.lastError). This method
|
||||
// requires the <code>"downloads.open"</code> permission in addition to the
|
||||
// <code>"downloads"</code> permission. An $(ref:onChanged) event fires
|
||||
// when the item is opened for the first time. This method can only be called
|
||||
// in response to a user gesture.
|
||||
// |downloadId|: The identifier for the downloaded file.
|
||||
static void open(long downloadId,
|
||||
optional NullCallback callback);
|
||||
|
||||
// Show the downloaded file in its folder in a file manager.
|
||||
// |downloadId|: The identifier for the downloaded file.
|
||||
static void show(long downloadId);
|
||||
|
||||
// Show the default Downloads folder in a file manager.
|
||||
static void showDefaultFolder();
|
||||
|
||||
// Erase matching $(ref:DownloadItem) from history without deleting the
|
||||
// downloaded file. An $(ref:onErased) event will fire for each
|
||||
// $(ref:DownloadItem) that matches <code>query</code>, then
|
||||
// <code>callback</code> will be called.
|
||||
static void erase(
|
||||
DownloadQuery query,
|
||||
optional EraseCallback callback);
|
||||
|
||||
// Remove the downloaded file if it exists and the $(ref:DownloadItem) is
|
||||
// complete; otherwise return an error through $(ref:runtime.lastError).
|
||||
static void removeFile(
|
||||
long downloadId,
|
||||
optional NullCallback callback);
|
||||
|
||||
// Prompt the user to accept a dangerous download. Can only be called from a
|
||||
// visible context (tab, window, or page/browser action popup). Does not
|
||||
// automatically accept dangerous downloads. If the download is accepted,
|
||||
// then an $(ref:onChanged) event will fire, otherwise nothing will happen.
|
||||
// When all the data is fetched into a temporary file and either the
|
||||
// download is not dangerous or the danger has been accepted, then the
|
||||
// temporary file is renamed to the target filename, the |state| changes to
|
||||
// 'complete', and $(ref:onChanged) fires.
|
||||
// |downloadId|: The identifier for the $(ref:DownloadItem).
|
||||
// |callback|: Called when the danger prompt dialog closes.
|
||||
static void acceptDanger(
|
||||
long downloadId,
|
||||
optional NullCallback callback);
|
||||
|
||||
// Enable or disable the gray shelf at the bottom of every window associated
|
||||
// with the current browser profile. The shelf will be disabled as long as
|
||||
// at least one extension has disabled it. Enabling the shelf while at least
|
||||
// one other extension has disabled it will return an error through
|
||||
// $(ref:runtime.lastError). Requires the <code>"downloads.shelf"</code>
|
||||
// permission in addition to the <code>"downloads"</code> permission.
|
||||
[deprecated="Use $(ref:setUiOptions) instead."]
|
||||
static void setShelfEnabled(boolean enabled);
|
||||
|
||||
// Change the download UI of every window associated with the current
|
||||
// browser profile. As long as at least one extension has set
|
||||
// $(ref:UiOptions.enabled) to false, the download UI will be hidden.
|
||||
// Setting $(ref:UiOptions.enabled) to true while at least one other
|
||||
// extension has disabled it will return an error through
|
||||
// $(ref:runtime.lastError). Requires the <code>"downloads.ui"</code>
|
||||
// permission in addition to the <code>"downloads"</code> permission.
|
||||
// |options|: Encapsulate a change to the download UI.
|
||||
// |callback|: Called when the UI update is completed.
|
||||
static void setUiOptions(
|
||||
UiOptions options,
|
||||
optional NullCallback callback);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// This event fires with the $(ref:DownloadItem) object when a download
|
||||
// begins.
|
||||
static void onCreated(DownloadItem downloadItem);
|
||||
|
||||
// Fires with the <code>downloadId</code> when a download is erased from
|
||||
// history.
|
||||
// |downloadId|: The <code>id</code> of the $(ref:DownloadItem) that was
|
||||
// erased.
|
||||
static void onErased(long downloadId);
|
||||
|
||||
// When any of a $(ref:DownloadItem)'s properties except
|
||||
// <code>bytesReceived</code> and <code>estimatedEndTime</code> changes,
|
||||
// this event fires with the <code>downloadId</code> and an object
|
||||
// containing the properties that changed.
|
||||
static void onChanged(DownloadDelta downloadDelta);
|
||||
|
||||
// During the filename determination process, extensions will be given the
|
||||
// opportunity to override the target $(ref:DownloadItem.filename). Each
|
||||
// extension may not register more than one listener for this event. Each
|
||||
// listener must call <code>suggest</code> exactly once, either
|
||||
// synchronously or asynchronously. If the listener calls
|
||||
// <code>suggest</code> asynchronously, then it must return
|
||||
// <code>true</code>. If the listener neither calls <code>suggest</code>
|
||||
// synchronously nor returns <code>true</code>, then <code>suggest</code>
|
||||
// will be called automatically. The $(ref:DownloadItem) will not complete
|
||||
// until all listeners have called <code>suggest</code>. Listeners may call
|
||||
// <code>suggest</code> without any arguments in order to allow the download
|
||||
// to use <code>downloadItem.filename</code> for its filename, or pass a
|
||||
// <code>suggestion</code> object to <code>suggest</code> in order to
|
||||
// override the target filename. If more than one extension overrides the
|
||||
// filename, then the last extension installed whose listener passes a
|
||||
// <code>suggestion</code> object to <code>suggest</code> wins. In order to
|
||||
// avoid confusion regarding which extension will win, users should not
|
||||
// install extensions that may conflict. If the download is initiated by
|
||||
// $(ref:download) and the target filename is known before the MIME type and
|
||||
// tentative filename have been determined, pass <code>filename</code> to
|
||||
// $(ref:download) instead.
|
||||
[maxListeners=1] static void onDeterminingFilename(
|
||||
DownloadItem downloadItem, SuggestFilenameCallback suggest);
|
||||
};
|
||||
};
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// Copyright 2012 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// downloadsInternal
|
||||
[nodoc=true]
|
||||
namespace downloadsInternal {
|
||||
interface Functions {
|
||||
// Secretly called when onDeterminingFilename handlers return.
|
||||
static void determineFilename(long downloadId,
|
||||
DOMString filename,
|
||||
DOMString conflict_action);
|
||||
};
|
||||
};
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
// Copyright 2015 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.enterprise.deviceAttributes</code> API to read device
|
||||
// attributes.
|
||||
// Note: This API is only available to extensions force-installed by enterprise
|
||||
// policy.
|
||||
namespace enterprise.deviceAttributes {
|
||||
callback GetDirectoryDeviceIdCallback = void (DOMString deviceId);
|
||||
|
||||
callback GetDeviceSerialNumberCallback = void (DOMString serialNumber);
|
||||
|
||||
callback GetDeviceAssetIdCallback = void (DOMString assetId);
|
||||
|
||||
callback GetDeviceAnnotatedLocationCallback = void (DOMString annotatedLocation);
|
||||
|
||||
callback GetDeviceHostnameCallback = void (DOMString hostname);
|
||||
|
||||
interface Functions {
|
||||
// Fetches the value of
|
||||
// <a href="https://developers.google.com/admin-sdk/directory/v1/guides/manage-chrome-devices">the device identifier of the directory API</a>,
|
||||
// that is generated by the server and identifies the cloud record of the
|
||||
// device for querying in the cloud directory API.
|
||||
// If the current user is not affiliated, returns an empty string.
|
||||
// |callback| : Called with the device identifier of the directory API when
|
||||
// received.
|
||||
void getDirectoryDeviceId(
|
||||
GetDirectoryDeviceIdCallback callback);
|
||||
|
||||
// Fetches the device's serial number. Please note the purpose of this API
|
||||
// is to administrate the device (e.g. generating Certificate Sign Requests
|
||||
// for device-wide certificates). This API may not be used for tracking
|
||||
// devices without the consent of the device's administrator.
|
||||
// If the current user is not affiliated, returns an empty string.
|
||||
// |callback| : Called with the serial number of the device.
|
||||
void getDeviceSerialNumber(
|
||||
GetDeviceSerialNumberCallback callback);
|
||||
|
||||
// Fetches the administrator-annotated Asset Id.
|
||||
// If the current user is not affiliated or no Asset Id has been set by the
|
||||
// administrator, returns an empty string.
|
||||
// |callback| : Called with the Asset ID of the device.
|
||||
void getDeviceAssetId(GetDeviceAssetIdCallback callback);
|
||||
|
||||
// Fetches the administrator-annotated Location.
|
||||
// If the current user is not affiliated or no Annotated Location has been
|
||||
// set by the administrator, returns an empty string.
|
||||
// |callback| : Called with the Annotated Location of the device.
|
||||
void getDeviceAnnotatedLocation(
|
||||
GetDeviceAnnotatedLocationCallback callback);
|
||||
|
||||
// Fetches the device's hostname as set by DeviceHostnameTemplate policy.
|
||||
// If the current user is not affiliated or no hostname has been set by the
|
||||
// enterprise policy, returns an empty string.
|
||||
// |callback| : Called with hostname of the device.
|
||||
void getDeviceHostname(
|
||||
GetDeviceHostnameCallback callback);
|
||||
};
|
||||
|
||||
};
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// Copyright 2018 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.enterprise.hardwarePlatform</code> API to get the
|
||||
// manufacturer and model of the hardware platform where the browser runs.
|
||||
// Note: This API is only available to extensions installed by enterprise
|
||||
// policy.
|
||||
namespace enterprise.hardwarePlatform {
|
||||
dictionary HardwarePlatformInfo {
|
||||
DOMString model;
|
||||
DOMString manufacturer;
|
||||
};
|
||||
|
||||
callback HardwarePlatformInfoCallback = void(HardwarePlatformInfo info);
|
||||
|
||||
interface Functions {
|
||||
// Obtains the manufacturer and model for the hardware platform and, if
|
||||
// the extension is authorized, returns it via |callback|.
|
||||
// |callback|: Called with the hardware platform info.
|
||||
static void getHardwarePlatformInfo(
|
||||
HardwarePlatformInfoCallback callback);
|
||||
};
|
||||
};
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
// Copyright 2023 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.enterprise.kioskInput</code> API to change input
|
||||
// settings for Kiosk sessions.
|
||||
// Note: This API is only available to extensions installed by enterprise
|
||||
// policy in ChromeOS Kiosk sessions.
|
||||
[platforms = ("chromeos", "lacros"),
|
||||
implemented_in = "chrome/browser/extensions/api/enterprise_kiosk_input/enterprise_kiosk_input_api.h"]
|
||||
namespace enterprise.kioskInput {
|
||||
dictionary SetCurrentInputMethodOptions {
|
||||
// The input method ID to set as current input method. This input
|
||||
// method has to be enabled by enterprise policies. Supported IDs
|
||||
// are located in https://crsrc.org/c/chrome/browser/resources/chromeos/input_method.
|
||||
DOMString inputMethodId;
|
||||
};
|
||||
|
||||
callback SetCurrentInputMethodCallback = void();
|
||||
|
||||
interface Functions {
|
||||
// Sets the current input method. This function only changes
|
||||
// the current input method to an enabled input method.
|
||||
// Input methods can be enabled by enterprise polices.
|
||||
// If the input method ID is invalid, or not enabled,
|
||||
// $(ref:runtime.lastError) will be set with a failure reason.
|
||||
// |options|: Object containing the fields defined in
|
||||
// $(ref:SetCurrentInputMethodOptions).
|
||||
// |callback|: Called when the input method is changed or if
|
||||
// there is an error.
|
||||
static void setCurrentInputMethod(
|
||||
SetCurrentInputMethodOptions options,
|
||||
SetCurrentInputMethodCallback callback);
|
||||
};
|
||||
|
||||
};
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
// Copyright 2020 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.enterprise.networkingAttributes</code> API to read
|
||||
// information about your current network.
|
||||
// Note: This API is only available to extensions force-installed by enterprise
|
||||
// policy.
|
||||
[platforms = ("chromeos", "lacros"),
|
||||
implemented_in = "chrome/browser/extensions/api/enterprise_networking_attributes/enterprise_networking_attributes_api.h"]
|
||||
namespace enterprise.networkingAttributes {
|
||||
[noinline_doc] dictionary NetworkDetails {
|
||||
// The device's MAC address.
|
||||
DOMString macAddress;
|
||||
|
||||
// The device's local IPv4 address (undefined if not configured).
|
||||
DOMString? ipv4;
|
||||
|
||||
// The device's local IPv6 address (undefined if not configured).
|
||||
DOMString? ipv6;
|
||||
};
|
||||
|
||||
callback GetNetworkDetailsCallback = void(NetworkDetails networkAddresses);
|
||||
|
||||
interface Functions {
|
||||
// Retrieves the network details of the device's default network.
|
||||
// If the user is not affiliated or the device is not connected to a
|
||||
// network, $(ref:runtime.lastError) will be set with a failure reason.
|
||||
// |callback| : Called with the device's default network's
|
||||
// $(ref:NetworkDetails).
|
||||
void getNetworkDetails(
|
||||
GetNetworkDetailsCallback callback);
|
||||
};
|
||||
};
|
||||
+230
@@ -0,0 +1,230 @@
|
||||
// Copyright 2014 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.enterprise.platformKeys</code> API to generate keys and
|
||||
// install certificates for these keys. The certificates will be managed by the
|
||||
// platform and can be used for TLS authentication, network access or by other
|
||||
// extension through $(ref:platformKeys chrome.platformKeys).
|
||||
[platforms = ("chromeos", "lacros")]
|
||||
namespace enterprise.platformKeys {
|
||||
[nocompile, noinline_doc] dictionary Token {
|
||||
// Uniquely identifies this <code>Token</code>.
|
||||
// <p>Static IDs are <code>"user"</code> and <code>"system"</code>,
|
||||
// referring to the platform's user-specific and the system-wide hardware
|
||||
// token, respectively. Any other tokens (with other identifiers) might be
|
||||
// returned by $(ref:enterprise.platformKeys.getTokens).</p>
|
||||
DOMString id;
|
||||
|
||||
// Implements the WebCrypto's
|
||||
// <a href="http://www.w3.org/TR/WebCryptoAPI/#subtlecrypto-interface">SubtleCrypto</a>
|
||||
// interface. The cryptographic operations, including key generation, are
|
||||
// hardware-backed.
|
||||
// <p>Only non-extractable RSASSA-PKCS1-V1_5 keys with
|
||||
// <code>modulusLength</code> up to 2048 and ECDSA with
|
||||
// <code>namedCurve</code> P-256 can be generated. Each key can be
|
||||
// used for signing data at most once.</p>
|
||||
// <p>Keys generated on a specific <code>Token</code> cannot be used with
|
||||
// any other Tokens, nor can they be used with
|
||||
// <code>window.crypto.subtle</code>. Equally, <code>Key</code> objects
|
||||
// created with <code>window.crypto.subtle</code> cannot be used with this
|
||||
// interface.</p>
|
||||
[instanceOf = SubtleCrypto] object subtleCrypto;
|
||||
|
||||
// Implements the WebCrypto's
|
||||
// <a href="http://www.w3.org/TR/WebCryptoAPI/#subtlecrypto-interface">SubtleCrypto</a>
|
||||
// interface. The cryptographic operations, including key generation, are
|
||||
// software-backed. Protection of the keys, and thus implementation of the
|
||||
// non-extractable property, is done in software, so the keys are less
|
||||
// protected than hardware-backed keys.
|
||||
// <p>Only non-extractable RSASSA-PKCS1-V1_5 keys with
|
||||
// <code>modulusLength</code> up to 2048 can be generated. Each key can be
|
||||
// used for signing data at most once.</p>
|
||||
// <p>Keys generated on a specific <code>Token</code> cannot be used with
|
||||
// any other Tokens, nor can they be used with
|
||||
// <code>window.crypto.subtle</code>. Equally, <code>Key</code> objects
|
||||
// created with <code>window.crypto.subtle</code> cannot be used with this
|
||||
// interface.</p>
|
||||
[instanceOf = SubtleCrypto] object softwareBackedSubtleCrypto;
|
||||
};
|
||||
|
||||
// Whether to use the Enterprise User Key or the Enterprise Machine Key.
|
||||
enum Scope { USER, MACHINE };
|
||||
|
||||
// Type of key to generate.
|
||||
enum Algorithm { RSA, ECDSA };
|
||||
|
||||
// Invoked by <code>getTokens</code> with the list of available Tokens.
|
||||
// |tokens|: The list of available tokens.
|
||||
callback GetTokensCallback = void(Token[] tokens);
|
||||
|
||||
// Callback to which the certificates are passed.
|
||||
// |certificates|: The list of certificates, each in DER encoding of a X.509
|
||||
// certificate.
|
||||
callback GetCertificatesCallback = void(ArrayBuffer[] certificates);
|
||||
|
||||
// Invoked by importCertificate or removeCertificate when the respective
|
||||
// operation is finished.
|
||||
callback DoneCallback = void();
|
||||
|
||||
// Invoked by <code>challengeMachineKey</code> or
|
||||
// <code>challengeUserKey</code> with the challenge response.
|
||||
// |response|: The challenge response.
|
||||
callback ChallengeCallback = void(ArrayBuffer response);
|
||||
|
||||
dictionary RegisterKeyOptions {
|
||||
// Which algorithm the registered key should use.
|
||||
Algorithm algorithm;
|
||||
};
|
||||
|
||||
dictionary ChallengeKeyOptions {
|
||||
// A challenge as emitted by the Verified Access Web API.
|
||||
ArrayBuffer challenge;
|
||||
// If present, registers the challenged key with the specified
|
||||
// <code>scope</code>'s token. The key can then be associated with a
|
||||
// certificate and used like any other signing key. Subsequent calls to
|
||||
// this function will then generate a new Enterprise Key in the specified
|
||||
// <code>scope</code>.
|
||||
RegisterKeyOptions? registerKey;
|
||||
// Which Enterprise Key to challenge.
|
||||
Scope scope;
|
||||
};
|
||||
|
||||
|
||||
interface Functions {
|
||||
// Returns the available Tokens. In a regular user's session the list will
|
||||
// always contain the user's token with <code>id</code> <code>"user"</code>.
|
||||
// If a system-wide TPM token is available, the returned list will also
|
||||
// contain the system-wide token with <code>id</code> <code>"system"</code>.
|
||||
// The system-wide token will be the same for all sessions on this device
|
||||
// (device in the sense of e.g. a Chromebook).
|
||||
[nocompile] static void getTokens(GetTokensCallback callback);
|
||||
|
||||
// Returns the list of all client certificates available from the given
|
||||
// token. Can be used to check for the existence and expiration of client
|
||||
// certificates that are usable for a certain authentication.
|
||||
// |tokenId|: The id of a Token returned by <code>getTokens</code>.
|
||||
// |callback|: Called back with the list of the available certificates.
|
||||
static void getCertificates(DOMString tokenId,
|
||||
GetCertificatesCallback callback);
|
||||
|
||||
// Imports <code>certificate</code> to the given token if the certified key
|
||||
// is already stored in this token.
|
||||
// After a successful certification request, this function should be used to
|
||||
// store the obtained certificate and to make it available to the operating
|
||||
// system and browser for authentication.
|
||||
// |tokenId|: The id of a Token returned by <code>getTokens</code>.
|
||||
// |certificate|: The DER encoding of a X.509 certificate.
|
||||
// |callback|: Called back when this operation is finished.
|
||||
static void importCertificate(DOMString tokenId,
|
||||
ArrayBuffer certificate,
|
||||
optional DoneCallback callback);
|
||||
|
||||
// Removes <code>certificate</code> from the given token if present.
|
||||
// Should be used to remove obsolete certificates so that they are not
|
||||
// considered during authentication and do not clutter the certificate
|
||||
// choice. Should be used to free storage in the certificate store.
|
||||
// |tokenId|: The id of a Token returned by <code>getTokens</code>.
|
||||
// |certificate|: The DER encoding of a X.509 certificate.
|
||||
// |callback|: Called back when this operation is finished.
|
||||
static void removeCertificate(DOMString tokenId,
|
||||
ArrayBuffer certificate,
|
||||
optional DoneCallback callback);
|
||||
|
||||
// Similar to <code>challengeMachineKey</code> and
|
||||
// <code>challengeUserKey</code>, but allows specifying the algorithm of a
|
||||
// registered key. Challenges a hardware-backed Enterprise Machine Key and
|
||||
// emits the response as part of a remote attestation protocol. Only useful
|
||||
// on Chrome OS and in conjunction with the Verified Access Web API which
|
||||
// both issues challenges and verifies responses.
|
||||
//
|
||||
// A successful verification by the Verified Access Web API is a strong
|
||||
// signal that the current device is a legitimate Chrome OS device, the
|
||||
// current device is managed by the domain specified during verification,
|
||||
// the current signed-in user is managed by the domain specified during
|
||||
// verification, and the current device state complies with enterprise
|
||||
// device policy. For example, a policy may specify that the device must not
|
||||
// be in developer mode. Any device identity emitted by the verification is
|
||||
// tightly bound to the hardware of the current device. If
|
||||
// <code>"user"</code> Scope is specified, the identity is also tighly bound
|
||||
// to the current signed-in user.
|
||||
//
|
||||
// This function is highly restricted and will fail if the current device is
|
||||
// not managed, the current user is not managed, or if this operation has
|
||||
// not explicitly been enabled for the caller by enterprise device policy.
|
||||
// The challenged key does not reside in the <code>"system"</code> or
|
||||
// <code>"user"</code> token and is not accessible by any other API.
|
||||
// |options|: Object containing the fields defined in
|
||||
// $(ref:ChallengeKeyOptions).
|
||||
// |callback|: Called back with the challenge response.
|
||||
static void challengeKey(ChallengeKeyOptions options,
|
||||
ChallengeCallback callback);
|
||||
|
||||
// Challenges a hardware-backed Enterprise Machine Key and emits the
|
||||
// response as part of a remote attestation protocol. Only useful on Chrome
|
||||
// OS and in conjunction with the Verified Access Web API which both issues
|
||||
// challenges and verifies responses. A successful verification by the
|
||||
// Verified Access Web API is a strong signal of all of the following:
|
||||
// * The current device is a legitimate Chrome OS device.
|
||||
// * The current device is managed by the domain specified during
|
||||
// verification.
|
||||
// * The current signed-in user is managed by the domain specified during
|
||||
// verification.
|
||||
// * The current device state complies with enterprise device policy. For
|
||||
// example, a policy may specify that the device must not be in developer
|
||||
// mode.
|
||||
// * Any device identity emitted by the verification is tightly bound to the
|
||||
// hardware of the current device.
|
||||
// This function is highly restricted and will fail if the current device
|
||||
// is not managed, the current user is not managed, or if this operation
|
||||
// has not explicitly been enabled for the caller by enterprise device
|
||||
// policy. The Enterprise Machine Key does not reside in the
|
||||
// <code>"system"</code> token and is not accessible by any other API.
|
||||
// |challenge|: A challenge as emitted by the Verified Access Web API.
|
||||
// |registerKey|: If set, the current Enterprise Machine Key is registered
|
||||
// with the <code>"system"</code> token and relinquishes the
|
||||
// Enterprise Machine Key role. The key can then be
|
||||
// associated with a certificate and used like any other
|
||||
// signing key. This key is 2048-bit RSA. Subsequent calls
|
||||
// to this function will then generate a new Enterprise
|
||||
// Machine Key.
|
||||
// |callback|: Called back with the challenge response.
|
||||
[deprecated="Use $(ref:challengeKey) instead."]
|
||||
static void challengeMachineKey(ArrayBuffer challenge,
|
||||
optional boolean registerKey,
|
||||
ChallengeCallback callback);
|
||||
|
||||
// Challenges a hardware-backed Enterprise User Key and emits the response
|
||||
// as part of a remote attestation protocol. Only useful on Chrome OS and in
|
||||
// conjunction with the Verified Access Web API which both issues challenges
|
||||
// and verifies responses. A successful verification by the Verified Access
|
||||
// Web API is a strong signal of all of the following:
|
||||
// * The current device is a legitimate Chrome OS device.
|
||||
// * The current device is managed by the domain specified during
|
||||
// verification.
|
||||
// * The current signed-in user is managed by the domain specified during
|
||||
// verification.
|
||||
// * The current device state complies with enterprise user policy. For
|
||||
// example, a policy may specify that the device must not be in developer
|
||||
// mode.
|
||||
// * The public key emitted by the verification is tightly bound to the
|
||||
// hardware of the current device and to the current signed-in user.
|
||||
// This function is highly restricted and will fail if the current device is
|
||||
// not managed, the current user is not managed, or if this operation has
|
||||
// not explicitly been enabled for the caller by enterprise user policy.
|
||||
// The Enterprise User Key does not reside in the <code>"user"</code> token
|
||||
// and is not accessible by any other API.
|
||||
// |challenge|: A challenge as emitted by the Verified Access Web API.
|
||||
// |registerKey|: If set, the current Enterprise User Key is registered with
|
||||
// the <code>"user"</code> token and relinquishes the
|
||||
// Enterprise User Key role. The key can then be associated
|
||||
// with a certificate and used like any other signing key.
|
||||
// This key is 2048-bit RSA. Subsequent calls to this
|
||||
// function will then generate a new Enterprise User Key.
|
||||
// |callback|: Called back with the challenge response.
|
||||
[deprecated="Use $(ref:challengeKey) instead."]
|
||||
static void challengeUserKey(ArrayBuffer challenge,
|
||||
boolean registerKey,
|
||||
ChallengeCallback callback);
|
||||
};
|
||||
};
|
||||
Executable
+60
@@ -0,0 +1,60 @@
|
||||
// Copyright 2014 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Internal API for platform keys and certificate management.
|
||||
[ platforms = ("chromeos", "lacros"),
|
||||
implemented_in = "chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.h" ]
|
||||
namespace enterprise.platformKeysInternal {
|
||||
dictionary Hash {
|
||||
DOMString name;
|
||||
};
|
||||
|
||||
// For more information about the RSA key generation parameters, please refer
|
||||
// to: https://www.w3.org/TR/WebCryptoAPI/#RsaHashedKeyGenParams-dictionary
|
||||
// For more information about the ECDSA key generation parameters, please
|
||||
// refer to: https://www.w3.org/TR/WebCryptoAPI/#dfn-EcdsaParams
|
||||
// Note: |hash| is not used by generateKey() but is added to completely
|
||||
// mirror WebCrypto in using RsaHashedKeyAlgorithm to be able to wrap all
|
||||
// parameters in one structure.
|
||||
dictionary Algorithm {
|
||||
// Provided for all algorithms.
|
||||
DOMString name;
|
||||
|
||||
// Provided in case of RSASSA-PKCS1-v1_5.
|
||||
long? modulusLength;
|
||||
ArrayBuffer? publicExponent;
|
||||
Hash? hash;
|
||||
|
||||
// Provided in case of ECDSA.
|
||||
DOMString? namedCurve;
|
||||
};
|
||||
|
||||
// Invoked by <code>getTokens</code>.
|
||||
// |tokenIds| The list of IDs of the avialable Tokens.
|
||||
callback GetTokensCallback = void(DOMString[] tokenIds);
|
||||
|
||||
// Invoked by <code>generateKey</code>.
|
||||
// |publicKey| The Subject Public Key Info (see X.509) of the generated key
|
||||
// in DER encoding.
|
||||
callback GenerateKeyCallback = void(ArrayBuffer publicKey);
|
||||
|
||||
interface Functions {
|
||||
// Internal version of entrprise.platformKeys.getTokens. Returns a list of
|
||||
// token IDs instead of token objects.
|
||||
static void getTokens(GetTokensCallback callback);
|
||||
|
||||
// Internal version of Token.generateKey, currently supporting only
|
||||
// RSASSA-PKCS1-v1_5 and ECDSA.
|
||||
// |tokenId| The id of a Token returned by |getTokens|.
|
||||
// |algorithm| The algorithm parameters as specified by WebCrypto.
|
||||
// |softwareBacked| Whether the key operations should be executed in
|
||||
// software.
|
||||
// |callback| Called back with the Subject Public Key Info of the generated
|
||||
// key.
|
||||
static void generateKey(DOMString tokenId,
|
||||
Algorithm algorithm,
|
||||
boolean softwareBacked,
|
||||
GenerateKeyCallback callback);
|
||||
};
|
||||
};
|
||||
+407
@@ -0,0 +1,407 @@
|
||||
// Copyright 2018 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Private API for reporting Chrome browser status to admin console.
|
||||
namespace enterprise.reportingPrivate {
|
||||
|
||||
// Invoked by <code>UploadChromeDesktopReport</code> when the upload is
|
||||
// finished.
|
||||
// Also Invoked by <code>setDeviceData</code> when data is stored.
|
||||
[platforms = ("win", "mac", "linux")]
|
||||
callback DoneCallback = void();
|
||||
|
||||
// Invoked by <code>getDeviceId</code> to return the ID.
|
||||
[platforms = ("win", "mac", "linux")]
|
||||
callback GetDeviceIdCallback = void(DOMString id);
|
||||
|
||||
// Invoked by <code>getPersistentSecret</code> to return the secret.
|
||||
[platforms = ("win", "mac")]
|
||||
callback GetPersistentSecretCallback = void(ArrayBuffer secret);
|
||||
|
||||
// Invoked by <code>getDeviceDataCallback</code> to return the device data.
|
||||
[platforms = ("win", "mac", "linux")]
|
||||
callback GetDeviceDataCallback = void(ArrayBuffer data);
|
||||
|
||||
// Possible states a particular device setting can be in.
|
||||
[platforms = ("win", "mac", "linux")]
|
||||
enum SettingValue { UNKNOWN, DISABLED, ENABLED };
|
||||
|
||||
// Device info fields returned by the getDeviceInfo API.
|
||||
[platforms = ("win", "mac", "linux")]
|
||||
dictionary DeviceInfo {
|
||||
DOMString osName;
|
||||
DOMString osVersion;
|
||||
DOMString deviceHostName;
|
||||
DOMString deviceModel;
|
||||
DOMString serialNumber;
|
||||
SettingValue screenLockSecured;
|
||||
SettingValue diskEncrypted;
|
||||
DOMString[] macAddresses;
|
||||
DOMString? windowsMachineDomain;
|
||||
DOMString? windowsUserDomain;
|
||||
DOMString securityPatchLevel;
|
||||
|
||||
// This value is only returned on Windows for now.
|
||||
SettingValue? secureBootEnabled;
|
||||
};
|
||||
|
||||
// Invoked by <code>getDeviceInfo</code> to return device information.
|
||||
[platforms = ("win", "mac", "linux")]
|
||||
callback GetDeviceInfoCallback = void(DeviceInfo deviceInfo);
|
||||
|
||||
// Possible states for the EnterpriseRealTimeUrlCheckMode policy.
|
||||
enum RealtimeUrlCheckMode { DISABLED, ENABLED_MAIN_FRAME };
|
||||
|
||||
// Possible states for the SafeBrowsingProtectionLevel policy.
|
||||
enum SafeBrowsingLevel { DISABLED, STANDARD, ENHANCED };
|
||||
|
||||
// Possible states for the PasswordProtectionWarningTrigger policy
|
||||
enum PasswordProtectionTrigger {
|
||||
PASSWORD_PROTECTION_OFF,
|
||||
PASSWORD_REUSE,
|
||||
PHISHING_REUSE,
|
||||
POLICY_UNSET
|
||||
};
|
||||
|
||||
// Context info fields returned by the getContextInfo API.
|
||||
dictionary ContextInfo {
|
||||
DOMString[] browserAffiliationIds;
|
||||
DOMString[] profileAffiliationIds;
|
||||
DOMString[] onFileAttachedProviders;
|
||||
DOMString[] onFileDownloadedProviders;
|
||||
DOMString[] onBulkDataEntryProviders;
|
||||
DOMString[] onPrintProviders;
|
||||
RealtimeUrlCheckMode realtimeUrlCheckMode;
|
||||
DOMString[] onSecurityEventProviders;
|
||||
DOMString browserVersion;
|
||||
SafeBrowsingLevel safeBrowsingProtectionLevel;
|
||||
boolean siteIsolationEnabled;
|
||||
boolean builtInDnsClientEnabled;
|
||||
PasswordProtectionTrigger passwordProtectionWarningTrigger;
|
||||
boolean chromeRemoteDesktopAppBlocked;
|
||||
boolean? thirdPartyBlockingEnabled;
|
||||
SettingValue osFirewall;
|
||||
DOMString[] systemDnsServers;
|
||||
DOMString? enterpriseProfileId;
|
||||
};
|
||||
|
||||
// Invoked by <code>getContextInfo</code> to return context information.
|
||||
callback GetContextInfoCallback = void(ContextInfo contextInfo);
|
||||
|
||||
// The status passed to the callback of <code>getCertificate</code> to
|
||||
// indicate if the required policy is set.
|
||||
enum CertificateStatus { OK, POLICY_UNSET };
|
||||
|
||||
// The certificate, if one meets the requirements, returned by the
|
||||
// $(ref:getCertificate) API. <code>encodedCertificate</code> will be
|
||||
// the DER encoding (binary encoding following X.690 Distinguished Encoding
|
||||
// Rules) of the X.509 certificate.
|
||||
dictionary Certificate {
|
||||
CertificateStatus status;
|
||||
ArrayBuffer? encodedCertificate;
|
||||
};
|
||||
|
||||
// Invoked by <code>getCertificate</code> to return the selected certificate.
|
||||
callback CertificateCallback = void(Certificate certificate);
|
||||
|
||||
// Captures the type of event so it can be associated with user or device in
|
||||
// Chrome for reporting purposes
|
||||
[platforms = ("chromeos", "lacros")]
|
||||
enum EventType { DEVICE, USER };
|
||||
|
||||
// Composite object that captures the information we need to report events.
|
||||
// Some fields like the record and priority are serialized to avoid any
|
||||
// dependency on proto definitions here, given the fact that they will likely
|
||||
// change in the future. These will be deserialized and validated in Chrome.
|
||||
[platforms = ("chromeos", "lacros")]
|
||||
dictionary EnqueueRecordRequest {
|
||||
// Serialized record data binary based on the proto definition in
|
||||
// //components/reporting/proto/synced/record.proto.
|
||||
[instanceOf=Uint8Array] ArrayBufferView recordData;
|
||||
// Serialized priority based on the proto definition in
|
||||
// //components/reporting/proto/synced/record_constants.proto. Used to
|
||||
// determine which records are shed first.
|
||||
long priority;
|
||||
EventType eventType;
|
||||
};
|
||||
|
||||
// Context object containing the content-area user's ID for whom the signals
|
||||
// collection request is for. This will be used to identify the organization
|
||||
// in which the user is, and can then be used to determine their affiliation
|
||||
// with the current browser management state.
|
||||
[platforms = ("win")]
|
||||
dictionary UserContext {
|
||||
DOMString userId;
|
||||
};
|
||||
|
||||
// Enumeration of the various states an AntiVirus software product can be in.
|
||||
[platforms = ("win")]
|
||||
enum AntiVirusProductState { ON, OFF, SNOOZED, EXPIRED };
|
||||
|
||||
// Metadata about a specific AntiVirus software product.
|
||||
[platforms = ("win")]
|
||||
dictionary AntiVirusSignal {
|
||||
DOMString displayName;
|
||||
DOMString productId;
|
||||
AntiVirusProductState state;
|
||||
};
|
||||
|
||||
// Invoked by <code>getAvInfo</code> to return information about installed
|
||||
// AntiVirus software.
|
||||
[platforms = ("win")]
|
||||
callback AvInfoCallback = void(AntiVirusSignal[] avSignals);
|
||||
|
||||
// ID of an installed hotfix system update.
|
||||
[platforms = ("win")]
|
||||
dictionary HotfixSignal {
|
||||
DOMString hotfixId;
|
||||
};
|
||||
|
||||
// Invoked by <code>getHotfixes</code> to return the IDs of installed hotfix
|
||||
// system updates.
|
||||
[platforms = ("win")]
|
||||
callback HotfixesCallback = void(HotfixSignal[] hotfixSignals);
|
||||
|
||||
// Used to indicate whether a given signal was correctly found or not, or
|
||||
// indicate a reason for not being able to find it.
|
||||
[platforms = ("win", "mac", "linux")]
|
||||
enum PresenceValue {
|
||||
// Was unable to determine whether the signal source exists or not. This
|
||||
// typically indicates that a failure occurred before even trying to assess
|
||||
// its presence.
|
||||
UNSPECIFIED,
|
||||
|
||||
// Current user does not have access to the signal's source.
|
||||
ACCESS_DENIED,
|
||||
|
||||
// The resource was not found.
|
||||
NOT_FOUND,
|
||||
|
||||
// The resource was found.
|
||||
FOUND
|
||||
};
|
||||
|
||||
// Parameter used to collect information about a specific file system
|
||||
// resource.
|
||||
[platforms = ("win", "mac", "linux")]
|
||||
dictionary GetFileSystemInfoOptions {
|
||||
DOMString path;
|
||||
boolean computeSha256;
|
||||
boolean computeExecutableMetadata;
|
||||
};
|
||||
|
||||
[platforms = ("win", "mac", "linux")]
|
||||
dictionary GetFileSystemInfoRequest {
|
||||
// Information about the for whom the signal collection request is for.
|
||||
UserContext userContext;
|
||||
|
||||
// Collection of parameters used to conduct signals collection about
|
||||
// specific file system resources.
|
||||
GetFileSystemInfoOptions[] options;
|
||||
};
|
||||
|
||||
[platforms = ("win", "mac", "linux")]
|
||||
dictionary GetFileSystemInfoResponse {
|
||||
// Path to the file system object for whom those signals were collected.
|
||||
DOMString path;
|
||||
|
||||
// Value indicating whether the specific resource could be found or not.
|
||||
PresenceValue presence;
|
||||
|
||||
// Sha256 hash of a file's bytes. Ignored when path points to a
|
||||
// directory. Collected only when computeSha256 is set to true in the
|
||||
// given signals collection parameters.
|
||||
DOMString? sha256Hash;
|
||||
|
||||
// Set of properties only relevant for executable files. Will only be
|
||||
// collected if computeExecutableMetadata is set to true in the given
|
||||
// signals collection parameters and if path points to an executable file.
|
||||
|
||||
// Is true if a currently running process was spawned from this file.
|
||||
boolean? isRunning;
|
||||
|
||||
// SHA-256 hashes of the public keys of the certificates used to sign the
|
||||
// executable. A hash is computed over the DER-encoded SubjectPublicKeyInfo
|
||||
// representation of the key.
|
||||
DOMString[]? publicKeysHashes;
|
||||
|
||||
// Product name of this executable.
|
||||
DOMString? productName;
|
||||
|
||||
// Version of this executable.
|
||||
DOMString? version;
|
||||
};
|
||||
|
||||
[platforms = ("win", "mac", "linux")]
|
||||
callback FileSystemInfoCallback =
|
||||
void(GetFileSystemInfoResponse[] fileSystemSignals);
|
||||
|
||||
[platforms = ("win")]
|
||||
enum RegistryHive {
|
||||
HKEY_CLASSES_ROOT,
|
||||
HKEY_LOCAL_MACHINE,
|
||||
HKEY_CURRENT_USER
|
||||
};
|
||||
|
||||
[platforms = ("win", "mac")]
|
||||
dictionary GetSettingsOptions {
|
||||
// Path to a collection of settings.
|
||||
// On Windows it would be the path to the reg key inside the hive.
|
||||
// On Mac it would be the path to the plist file.
|
||||
DOMString path;
|
||||
|
||||
// Key specifying the setting entry we're looking for.
|
||||
// On Windows, that will be the registry key itself.
|
||||
// On Mac, this is a key path used to retrieve a value from
|
||||
// valueForKeyPath:.
|
||||
DOMString key;
|
||||
|
||||
// When set to true, the retrieved signal will also include the setting's
|
||||
// value. When false, the signal will only contain the setting's
|
||||
// presence.
|
||||
// Supported setting types on Windows:
|
||||
// - REG_SZ
|
||||
// - REG_DWORD
|
||||
// - REG_QWORD
|
||||
// Supported setting types on Mac:
|
||||
// - NSString
|
||||
// - NSNumber
|
||||
boolean getValue;
|
||||
|
||||
// Windows registry hive containing the desired value.
|
||||
// Required value on Windows, will be ignored on other platforms.
|
||||
RegistryHive? hive;
|
||||
};
|
||||
|
||||
[platforms = ("win", "mac")]
|
||||
dictionary GetSettingsRequest {
|
||||
// Information about the for whom the signal collection request is for.
|
||||
UserContext userContext;
|
||||
|
||||
// Collection of parameters used to conduct signals collection about
|
||||
// specific settings of the system.
|
||||
GetSettingsOptions[] options;
|
||||
};
|
||||
|
||||
[platforms = ("win", "mac")]
|
||||
dictionary GetSettingsResponse {
|
||||
// Path as given in the corresponding <code>GetSettingsOptions</code>
|
||||
// request.
|
||||
DOMString path;
|
||||
|
||||
// Key as given in the corresponding <code>GetSettingsOptions</code>
|
||||
// request.
|
||||
DOMString key;
|
||||
|
||||
// Hive as given in the corresponding <code>GetSettingsOptions</code>
|
||||
// request.
|
||||
// Present on Windows only.
|
||||
RegistryHive? hive;
|
||||
|
||||
// Value indicating whether the specific resource could be found or not.
|
||||
PresenceValue presence;
|
||||
|
||||
// JSON-stringified value of the setting. Only set if <code>getValue</code>
|
||||
// was true in the corresponding request, and if the setting value was
|
||||
// retrievable.
|
||||
DOMString? value;
|
||||
};
|
||||
|
||||
[platforms = ("win", "mac")]
|
||||
callback SettingsCallback =
|
||||
void(GetSettingsResponse[] settings);
|
||||
|
||||
interface Functions {
|
||||
// Gets the identity of device that Chrome browser is running on. The ID is
|
||||
// retrieved from the local device and used by the Google admin console.
|
||||
[platforms = ("win", "mac", "linux")]
|
||||
static void getDeviceId(optional GetDeviceIdCallback callback);
|
||||
|
||||
// Gets a randomly generated persistent secret (symmetric key) that
|
||||
// can be used to encrypt the data stored with |setDeviceData|. If the
|
||||
// optional parameter |forceCreation| is set to true the secret is recreated
|
||||
// in case of any failure to retrieve the currently stored one. Sets
|
||||
// $(ref:runtime.lastError) on failure.
|
||||
[platforms = ("win", "mac")]
|
||||
static void getPersistentSecret(
|
||||
optional boolean resetSecret,
|
||||
GetPersistentSecretCallback callback);
|
||||
|
||||
// Gets the device data for |id|. Sets $(ref:runtime.lastError) on failure.
|
||||
[platforms = ("win", "mac", "linux")]
|
||||
static void getDeviceData(DOMString id, GetDeviceDataCallback callback);
|
||||
|
||||
// Sets the device data for |id|. Sets $(ref:runtime.lastError) on failure.
|
||||
// If the |data| parameter is undefined and there is already data
|
||||
// associated with |id| it will be cleared.
|
||||
[platforms = ("win", "mac", "linux")]
|
||||
static void setDeviceData(
|
||||
DOMString id,
|
||||
optional ArrayBuffer data,
|
||||
optional DoneCallback callback);
|
||||
|
||||
// Gets the device information (including disk encryption status,
|
||||
// screen lock status, serial number, model).
|
||||
[platforms = ("win", "mac", "linux")]
|
||||
static void getDeviceInfo(GetDeviceInfoCallback callback);
|
||||
|
||||
// Gets the context information (including management status of the browser,
|
||||
// state of key security policies, browser version).
|
||||
static void getContextInfo(
|
||||
GetContextInfoCallback callback);
|
||||
|
||||
// Returns the certificate that would be selected by the filters in the
|
||||
// AutoSelectCertificateForUrls policy for <code>url</code>.
|
||||
static void getCertificate(
|
||||
DOMString url,
|
||||
CertificateCallback callback);
|
||||
|
||||
// Enqueues a record for upload to the reporting service
|
||||
// |request|: Composite object that captures everything
|
||||
// we need for uploading records.
|
||||
// |callback|: Callback that is triggered upon completion
|
||||
[platforms = ("chromeos", "lacros")]
|
||||
static void enqueueRecord(
|
||||
EnqueueRecordRequest request,
|
||||
optional DoneCallback callback);
|
||||
|
||||
// Gets information about file system resources, specified by the contents
|
||||
// of <code>request</code>, on the current device. <code>request</code> must
|
||||
// hold a user context to be used to verify the affiliation between the
|
||||
// user's organization and the organization managing the browser. If the
|
||||
// management or affiliation states are not suitable, no results will be
|
||||
// returned.
|
||||
[platforms = ("win", "mac", "linux")]
|
||||
static void getFileSystemInfo(
|
||||
GetFileSystemInfoRequest request,
|
||||
FileSystemInfoCallback callback);
|
||||
|
||||
// Gets information about system settings specified by the contents of
|
||||
// <code>request</code>. <code>request</code> must hold a user context to be
|
||||
// used to verify the affiliation between the user's organization and the
|
||||
// organization managing the browser. If the management or affiliation
|
||||
// states are not suitable, no results will be returned.
|
||||
[platforms = ("win", "mac")]
|
||||
static void getSettings(
|
||||
GetSettingsRequest request,
|
||||
SettingsCallback callback);
|
||||
|
||||
// Gets information about AntiVirus software installed on the current
|
||||
// device. <code>userContext</code> is used to verify the affiliation
|
||||
// between the user's organization and the organization managing the
|
||||
// browser. If the management, or affiliation, state is not suitable, no
|
||||
// results will be returned.
|
||||
[platforms = ("win")]
|
||||
static void getAvInfo(UserContext userContext, AvInfoCallback callback);
|
||||
|
||||
// Gets information about hotfix system updates installed on the current
|
||||
// device. <code>userContext</code> is used to verify the affiliation
|
||||
// between the user's organization and the organization managing the
|
||||
// browser. If the management, or affiliation, state is not suitable, no
|
||||
// results will be returned.
|
||||
[platforms = ("win")]
|
||||
static void getHotfixes(UserContext userContext, HotfixesCallback callback);
|
||||
};
|
||||
|
||||
};
|
||||
+2127
File diff suppressed because it is too large
Load Diff
+180
@@ -0,0 +1,180 @@
|
||||
// Copyright 2014 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Internal, used by fileManagerPrivate's custom bindings.
|
||||
[platforms=("chromeos"),
|
||||
implemented_in="chrome/browser/ash/extensions/file_manager/file_manager_private_api_functions.h"]
|
||||
namespace fileManagerPrivateInternal {
|
||||
// Entry information that renderers need to create an Entry instance.
|
||||
dictionary EntryDescription {
|
||||
DOMString fileSystemName;
|
||||
DOMString fileSystemRoot;
|
||||
DOMString fileFullPath;
|
||||
boolean fileIsDirectory;
|
||||
};
|
||||
dictionary IOTaskParams {
|
||||
DOMString? destinationFolderUrl;
|
||||
DOMString? password;
|
||||
boolean? showNotification;
|
||||
};
|
||||
dictionary ParsedTrashInfoFile {
|
||||
EntryDescription restoreEntry;
|
||||
DOMString trashInfoFileName;
|
||||
double deletionDate;
|
||||
};
|
||||
dictionary SearchFilesParams {
|
||||
DOMString? rootUrl;
|
||||
DOMString query;
|
||||
fileManagerPrivate.SearchType types;
|
||||
long maxResults;
|
||||
double modifiedTimestamp;
|
||||
fileManagerPrivate.FileCategory category;
|
||||
};
|
||||
dictionary CrostiniSharedPathResponse {
|
||||
EntryDescription[] entries;
|
||||
boolean firstForSession;
|
||||
};
|
||||
|
||||
callback SimpleCallback = void();
|
||||
callback ResolveIsolatedEntriesCallback = void(EntryDescription[] entries);
|
||||
callback GetEntryPropertiesCallback = void(
|
||||
fileManagerPrivate.EntryProperties[] entryProperties);
|
||||
callback AddFileWatchCallback = void(optional boolean success);
|
||||
callback RemoveFileWatchCallback = void(optional boolean success);
|
||||
callback GetCustomActionsCallback = void(fileSystemProvider.Action[] actions);
|
||||
callback GetMimeTypeCallback = void(DOMString result);
|
||||
callback GetContentMimeTypeCallback = void(DOMString result);
|
||||
callback GetContentMetadataCallback = void(
|
||||
fileManagerPrivate.MediaMetadata result);
|
||||
callback ExecuteTaskCallback = void(fileManagerPrivate.TaskResult result);
|
||||
callback GetFileTasksCallback = void(fileManagerPrivate.ResultingTasks resultingTasks);
|
||||
callback GetDisallowedTransfersCallback =
|
||||
void(EntryDescription[] entries);
|
||||
callback GetDlpMetadataCallback =
|
||||
void(fileManagerPrivate.DlpMetadata[] entries);
|
||||
callback GetDriveQuotaMetadataCallback =
|
||||
void(optional fileManagerPrivate.DriveQuotaMetadata driveQuotaMetadata);
|
||||
callback IOTaskIdCallback = void(long taskId);
|
||||
callback ValidatePathNameLengthCallback = void(boolean result);
|
||||
callback GetDirectorySizeCallback = void(double size);
|
||||
callback GetRecentFilesCallback = void(EntryDescription[] entries);
|
||||
callback GetCrostiniSharedPathsCallback =
|
||||
void(CrostiniSharedPathResponse response);
|
||||
callback GetLinuxPackageInfoCallback =
|
||||
void(fileManagerPrivate.LinuxPackageInfo linux_package_info);
|
||||
callback InstallLinuxPackageCallback =
|
||||
void(fileManagerPrivate.InstallLinuxPackageStatus status);
|
||||
callback GetThumbnailCallback = void(DOMString ThumbnailDataUrl);
|
||||
callback BooleanCallback = void(boolean result);
|
||||
callback GetVolumeRootCallback = void(EntryDescription rootDir);
|
||||
callback ParseTrashInfoFilesCallback = void(ParsedTrashInfoFile[] files);
|
||||
callback SearchFilesCallback = void(EntryDescription[] entries);
|
||||
|
||||
interface Functions {
|
||||
static void resolveIsolatedEntries(
|
||||
DOMString[] urls,
|
||||
ResolveIsolatedEntriesCallback callback);
|
||||
static void getEntryProperties(
|
||||
DOMString[] urls,
|
||||
fileManagerPrivate.EntryPropertyName[] names,
|
||||
GetEntryPropertiesCallback callback);
|
||||
static void addFileWatch(
|
||||
DOMString url,
|
||||
AddFileWatchCallback callback);
|
||||
static void removeFileWatch(
|
||||
DOMString url,
|
||||
RemoveFileWatchCallback callback);
|
||||
static void getCustomActions(
|
||||
DOMString[] urls,
|
||||
GetCustomActionsCallback callback);
|
||||
static void executeCustomAction(
|
||||
DOMString[] urls,
|
||||
DOMString actionId,
|
||||
SimpleCallback callback);
|
||||
static void getContentMimeType(
|
||||
DOMString blobUUID,
|
||||
GetContentMimeTypeCallback callback);
|
||||
static void getContentMetadata(
|
||||
DOMString blobUUID,
|
||||
DOMString mimeType,
|
||||
boolean includeImages,
|
||||
GetContentMetadataCallback callback);
|
||||
static void pinDriveFile(
|
||||
DOMString url,
|
||||
boolean pin,
|
||||
SimpleCallback callback);
|
||||
static void executeTask(
|
||||
fileManagerPrivate.FileTaskDescriptor descriptor,
|
||||
DOMString[] urls,
|
||||
ExecuteTaskCallback callback);
|
||||
static void searchFiles(
|
||||
SearchFilesParams searchParams, SearchFilesCallback callback);
|
||||
static void setDefaultTask(
|
||||
fileManagerPrivate.FileTaskDescriptor descriptor,
|
||||
DOMString[] urls,
|
||||
DOMString[] mimeTypes,
|
||||
SimpleCallback callback);
|
||||
static void getFileTasks(
|
||||
DOMString[] urls,
|
||||
DOMString[] dlpSourceUrls,
|
||||
GetFileTasksCallback callback);
|
||||
static void getDisallowedTransfers(
|
||||
DOMString[] entries,
|
||||
DOMString destinationEntry,
|
||||
boolean isMove,
|
||||
GetDisallowedTransfersCallback callback);
|
||||
static void getDlpMetadata(
|
||||
DOMString[] entries,
|
||||
GetDlpMetadataCallback callback);
|
||||
static void getDriveQuotaMetadata(
|
||||
DOMString url,
|
||||
GetDriveQuotaMetadataCallback callback);
|
||||
static void validatePathNameLength(
|
||||
DOMString parentUrl,
|
||||
DOMString name,
|
||||
ValidatePathNameLengthCallback callback);
|
||||
static void getDirectorySize(
|
||||
DOMString url,
|
||||
GetDirectorySizeCallback callback);
|
||||
static void getVolumeRoot(
|
||||
fileManagerPrivate.GetVolumeRootOptions options,
|
||||
GetVolumeRootCallback callback);
|
||||
static void getRecentFiles(
|
||||
fileManagerPrivate.SourceRestriction restriction,
|
||||
DOMString query,
|
||||
long cutoff_days,
|
||||
fileManagerPrivate.FileCategory file_category,
|
||||
boolean invalidate_cache,
|
||||
GetRecentFilesCallback callback);
|
||||
static void sharePathsWithCrostini(
|
||||
DOMString vmName, DOMString[] urls,
|
||||
boolean persist,
|
||||
SimpleCallback callback);
|
||||
static void unsharePathWithCrostini(
|
||||
DOMString vmName, DOMString url,
|
||||
SimpleCallback callback);
|
||||
static void getCrostiniSharedPaths(
|
||||
boolean observeFirstForSession,
|
||||
DOMString vmName,
|
||||
GetCrostiniSharedPathsCallback callback);
|
||||
static void getLinuxPackageInfo(
|
||||
DOMString url,
|
||||
GetLinuxPackageInfoCallback callback);
|
||||
static void installLinuxPackage(
|
||||
DOMString url,
|
||||
InstallLinuxPackageCallback callback);
|
||||
static void importCrostiniImage(DOMString url);
|
||||
static void toggleAddedToHoldingSpace(
|
||||
DOMString[] urls, boolean add,
|
||||
optional SimpleCallback callback);
|
||||
static void startIOTask(
|
||||
fileManagerPrivate.IoTaskType type,
|
||||
DOMString[] urls,
|
||||
IOTaskParams params,
|
||||
optional IOTaskIdCallback callback);
|
||||
static void parseTrashInfoFiles(
|
||||
DOMString[] urls,
|
||||
ParseTrashInfoFilesCallback callback);
|
||||
};
|
||||
};
|
||||
+833
@@ -0,0 +1,833 @@
|
||||
// Copyright 2013 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.fileSystemProvider</code> API to create file systems,
|
||||
// that can be accessible from the file manager on Chrome OS.
|
||||
[implemented_in="chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.h"]
|
||||
namespace fileSystemProvider {
|
||||
// Error codes used by providing extensions in response to requests as well
|
||||
// as in case of errors when calling methods of the API. For success,
|
||||
// <code>"OK"</code> must be used.
|
||||
enum ProviderError {
|
||||
OK,
|
||||
FAILED,
|
||||
IN_USE,
|
||||
EXISTS,
|
||||
NOT_FOUND,
|
||||
ACCESS_DENIED,
|
||||
TOO_MANY_OPENED,
|
||||
NO_MEMORY,
|
||||
NO_SPACE,
|
||||
NOT_A_DIRECTORY,
|
||||
INVALID_OPERATION,
|
||||
SECURITY,
|
||||
ABORT,
|
||||
NOT_A_FILE,
|
||||
NOT_EMPTY,
|
||||
INVALID_URL,
|
||||
IO
|
||||
};
|
||||
|
||||
// Mode of opening a file. Used by $(ref:onOpenFileRequested).
|
||||
enum OpenFileMode {
|
||||
READ,
|
||||
WRITE
|
||||
};
|
||||
|
||||
// Type of a change detected on the observed directory.
|
||||
enum ChangeType {
|
||||
CHANGED,
|
||||
DELETED
|
||||
};
|
||||
|
||||
// List of common actions. <code>"SHARE"</code> is for sharing files with
|
||||
// others. <code>"SAVE_FOR_OFFLINE"</code> for pinning (saving for offline
|
||||
// access). <code>"OFFLINE_NOT_NECESSARY"</code> for notifying that the file
|
||||
// doesn't need to be stored for offline access anymore.
|
||||
// Used by $(ref:onGetActionsRequested) and $(ref:onExecuteActionRequested).
|
||||
enum CommonActionId {
|
||||
SAVE_FOR_OFFLINE,
|
||||
OFFLINE_NOT_NECESSARY,
|
||||
SHARE
|
||||
};
|
||||
|
||||
// Cloud storage representation of a file system entry.
|
||||
dictionary CloudIdentifier {
|
||||
// Identifier for the cloud storage provider (e.g. 'drive.google.com').
|
||||
DOMString providerName;
|
||||
|
||||
// The provider's identifier for the given file/directory.
|
||||
DOMString id;
|
||||
};
|
||||
|
||||
// Information relating to files that are served by a cloud file system.
|
||||
dictionary CloudFileInfo {
|
||||
// A tag that represents the version of the file.
|
||||
DOMString? versionTag;
|
||||
};
|
||||
|
||||
// Represents metadata of a file or a directory.
|
||||
dictionary EntryMetadata {
|
||||
// True if it is a directory. Must be provided if requested in
|
||||
// <code>options</code>.
|
||||
boolean? isDirectory;
|
||||
|
||||
// Name of this entry (not full path name). Must not contain '/'. For root
|
||||
// it must be empty. Must be provided if requested in <code>options</code>.
|
||||
DOMString? name;
|
||||
|
||||
// File size in bytes. Must be provided if requested in
|
||||
// <code>options</code>.
|
||||
double? size;
|
||||
|
||||
// The last modified time of this entry. Must be provided if requested in
|
||||
// <code>options</code>.
|
||||
[instanceOf=Date] object? modificationTime;
|
||||
|
||||
// Mime type for the entry. Always optional, but should be provided if
|
||||
// requested in <code>options</code>.
|
||||
DOMString? mimeType;
|
||||
|
||||
// Thumbnail image as a data URI in either PNG, JPEG or WEBP format, at most
|
||||
// 32 KB in size. Optional, but can be provided only when explicitly
|
||||
// requested by the $(ref:onGetMetadataRequested) event.
|
||||
DOMString? thumbnail;
|
||||
|
||||
// Cloud storage representation of this entry. Must be provided if requested
|
||||
// in <code>options</code> and the file is backed by cloud storage. For
|
||||
// local files not backed by cloud storage, it should be undefined when
|
||||
// requested.
|
||||
CloudIdentifier? cloudIdentifier;
|
||||
|
||||
// Information that identifies a specific file in the underlying cloud file
|
||||
// system. Must be provided if requested in <code>options</code> and the
|
||||
// file is backed by cloud storage.
|
||||
CloudFileInfo? cloudFileInfo;
|
||||
};
|
||||
|
||||
// Represents a watcher.
|
||||
dictionary Watcher {
|
||||
// The path of the entry being observed.
|
||||
DOMString entryPath;
|
||||
|
||||
// Whether watching should include all child entries recursively. It can be
|
||||
// true for directories only.
|
||||
boolean recursive;
|
||||
|
||||
// Tag used by the last notification for the watcher.
|
||||
DOMString? lastTag;
|
||||
};
|
||||
|
||||
// Represents an opened file.
|
||||
dictionary OpenedFile {
|
||||
// A request ID to be be used by consecutive read/write and close requests.
|
||||
long openRequestId;
|
||||
|
||||
// The path of the opened file.
|
||||
DOMString filePath;
|
||||
|
||||
// Whether the file was opened for reading or writing.
|
||||
OpenFileMode mode;
|
||||
};
|
||||
|
||||
// Represents a mounted file system.
|
||||
dictionary FileSystemInfo {
|
||||
// The identifier of the file system.
|
||||
DOMString fileSystemId;
|
||||
|
||||
// A human-readable name for the file system.
|
||||
DOMString displayName;
|
||||
|
||||
// Whether the file system supports operations which may change contents
|
||||
// of the file system (such as creating, deleting or writing to files).
|
||||
boolean writable;
|
||||
|
||||
// The maximum number of files that can be opened at once. If 0, then not
|
||||
// limited.
|
||||
long openedFilesLimit;
|
||||
|
||||
// List of currently opened files.
|
||||
OpenedFile[] openedFiles;
|
||||
|
||||
// Whether the file system supports the <code>tag</code> field for observing
|
||||
// directories.
|
||||
boolean? supportsNotifyTag;
|
||||
|
||||
// List of watchers.
|
||||
Watcher[] watchers;
|
||||
};
|
||||
|
||||
// Options for the $(ref:mount) method.
|
||||
dictionary MountOptions {
|
||||
// The string indentifier of the file system. Must be unique per each
|
||||
// extension.
|
||||
DOMString fileSystemId;
|
||||
|
||||
// A human-readable name for the file system.
|
||||
DOMString displayName;
|
||||
|
||||
// Whether the file system supports operations which may change contents
|
||||
// of the file system (such as creating, deleting or writing to files).
|
||||
boolean? writable;
|
||||
|
||||
// The maximum number of files that can be opened at once. If not specified,
|
||||
// or 0, then not limited.
|
||||
long? openedFilesLimit;
|
||||
|
||||
// Whether the file system supports the <code>tag</code> field for observed
|
||||
// directories.
|
||||
boolean? supportsNotifyTag;
|
||||
|
||||
// Whether the framework should resume the file system at the next sign-in
|
||||
// session. True by default.
|
||||
boolean? persistent;
|
||||
};
|
||||
|
||||
// Options for the $(ref:unmount) method.
|
||||
dictionary UnmountOptions {
|
||||
// The identifier of the file system to be unmounted.
|
||||
DOMString fileSystemId;
|
||||
};
|
||||
|
||||
// Options for the $(ref:onUnmountRequested) event.
|
||||
dictionary UnmountRequestedOptions {
|
||||
// The identifier of the file system to be unmounted.
|
||||
DOMString fileSystemId;
|
||||
|
||||
// The unique identifier of this request.
|
||||
long requestId;
|
||||
};
|
||||
|
||||
// Options for the $(ref:onGetMetadataRequested) event.
|
||||
dictionary GetMetadataRequestedOptions {
|
||||
// The identifier of the file system related to this operation.
|
||||
DOMString fileSystemId;
|
||||
|
||||
// The unique identifier of this request.
|
||||
long requestId;
|
||||
|
||||
// The path of the entry to fetch metadata about.
|
||||
DOMString entryPath;
|
||||
|
||||
// Set to <code>true</code> if <code>is_directory</code> value is requested.
|
||||
boolean isDirectory;
|
||||
|
||||
// Set to <code>true</code> if <code>name</code> value is requested.
|
||||
boolean name;
|
||||
|
||||
// Set to <code>true</code> if <code>size</code> value is requested.
|
||||
boolean size;
|
||||
|
||||
// Set to <code>true</code> if <code>modificationTime</code> value is
|
||||
// requested.
|
||||
boolean modificationTime;
|
||||
|
||||
// Set to <code>true</code> if <code>mimeType</code> value is requested.
|
||||
boolean mimeType;
|
||||
|
||||
// Set to <code>true</code> if <code>thumbnail</code> value is requested.
|
||||
boolean thumbnail;
|
||||
|
||||
// Set to <code>true</code> if <code>cloudIdentifier</code> value is
|
||||
// requested.
|
||||
boolean cloudIdentifier;
|
||||
|
||||
// Set to <code>true</code> if <code>cloudFileInfo</code> value is
|
||||
// requested.
|
||||
boolean cloudFileInfo;
|
||||
};
|
||||
|
||||
// Options for the $(ref:onGetActionsRequested) event.
|
||||
dictionary GetActionsRequestedOptions {
|
||||
// The identifier of the file system related to this operation.
|
||||
DOMString fileSystemId;
|
||||
|
||||
// The unique identifier of this request.
|
||||
long requestId;
|
||||
|
||||
// List of paths of entries for the list of actions.
|
||||
DOMString[] entryPaths;
|
||||
};
|
||||
|
||||
// Options for the $(ref:onReadDirectoryRequested) event.
|
||||
dictionary ReadDirectoryRequestedOptions {
|
||||
// The identifier of the file system related to this operation.
|
||||
DOMString fileSystemId;
|
||||
|
||||
// The unique identifier of this request.
|
||||
long requestId;
|
||||
|
||||
// The path of the directory which contents are requested.
|
||||
DOMString directoryPath;
|
||||
|
||||
// Set to <code>true</code> if <code>is_directory</code> value is requested.
|
||||
boolean isDirectory;
|
||||
|
||||
// Set to <code>true</code> if <code>name</code> value is requested.
|
||||
boolean name;
|
||||
|
||||
// Set to <code>true</code> if <code>size</code> value is requested.
|
||||
boolean size;
|
||||
|
||||
// Set to <code>true</code> if <code>modificationTime</code> value is
|
||||
// requested.
|
||||
boolean modificationTime;
|
||||
|
||||
// Set to <code>true</code> if <code>mimeType</code> value is requested.
|
||||
boolean mimeType;
|
||||
|
||||
// Set to <code>true</code> if <code>thumbnail</code> value is requested.
|
||||
boolean thumbnail;
|
||||
};
|
||||
|
||||
// Options for the $(ref:onOpenFileRequested) event.
|
||||
dictionary OpenFileRequestedOptions {
|
||||
// The identifier of the file system related to this operation.
|
||||
DOMString fileSystemId;
|
||||
|
||||
// A request ID which will be used by consecutive read/write and close
|
||||
// requests.
|
||||
long requestId;
|
||||
|
||||
// The path of the file to be opened.
|
||||
DOMString filePath;
|
||||
|
||||
// Whether the file will be used for reading or writing.
|
||||
OpenFileMode mode;
|
||||
};
|
||||
|
||||
// Options for the $(ref:onCloseFileRequested) event.
|
||||
dictionary CloseFileRequestedOptions {
|
||||
// The identifier of the file system related to this operation.
|
||||
DOMString fileSystemId;
|
||||
|
||||
// The unique identifier of this request.
|
||||
long requestId;
|
||||
|
||||
// A request ID used to open the file.
|
||||
long openRequestId;
|
||||
};
|
||||
|
||||
// Options for the $(ref:onReadFileRequested) event.
|
||||
dictionary ReadFileRequestedOptions {
|
||||
// The identifier of the file system related to this operation.
|
||||
DOMString fileSystemId;
|
||||
|
||||
// The unique identifier of this request.
|
||||
long requestId;
|
||||
|
||||
// A request ID used to open the file.
|
||||
long openRequestId;
|
||||
|
||||
// Position in the file (in bytes) to start reading from.
|
||||
double offset;
|
||||
|
||||
// Number of bytes to be returned.
|
||||
double length;
|
||||
};
|
||||
|
||||
// Options for the $(ref:onCreateDirectoryRequested) event.
|
||||
dictionary CreateDirectoryRequestedOptions {
|
||||
// The identifier of the file system related to this operation.
|
||||
DOMString fileSystemId;
|
||||
|
||||
// The unique identifier of this request.
|
||||
long requestId;
|
||||
|
||||
// The path of the directory to be created.
|
||||
DOMString directoryPath;
|
||||
|
||||
// Whether the operation is recursive (for directories only).
|
||||
boolean recursive;
|
||||
};
|
||||
|
||||
// Options for the $(ref:onDeleteEntryRequested) event.
|
||||
dictionary DeleteEntryRequestedOptions {
|
||||
// The identifier of the file system related to this operation.
|
||||
DOMString fileSystemId;
|
||||
|
||||
// The unique identifier of this request.
|
||||
long requestId;
|
||||
|
||||
// The path of the entry to be deleted.
|
||||
DOMString entryPath;
|
||||
|
||||
// Whether the operation is recursive (for directories only).
|
||||
boolean recursive;
|
||||
};
|
||||
|
||||
// Options for the $(ref:onCreateFileRequested) event.
|
||||
dictionary CreateFileRequestedOptions {
|
||||
// The identifier of the file system related to this operation.
|
||||
DOMString fileSystemId;
|
||||
|
||||
// The unique identifier of this request.
|
||||
long requestId;
|
||||
|
||||
// The path of the file to be created.
|
||||
DOMString filePath;
|
||||
};
|
||||
|
||||
// Options for the $(ref:onCopyEntryRequested) event.
|
||||
dictionary CopyEntryRequestedOptions {
|
||||
// The identifier of the file system related to this operation.
|
||||
DOMString fileSystemId;
|
||||
|
||||
// The unique identifier of this request.
|
||||
long requestId;
|
||||
|
||||
// The source path of the entry to be copied.
|
||||
DOMString sourcePath;
|
||||
|
||||
// The destination path for the copy operation.
|
||||
DOMString targetPath;
|
||||
};
|
||||
|
||||
// Options for the $(ref:onMoveEntryRequested) event.
|
||||
dictionary MoveEntryRequestedOptions {
|
||||
// The identifier of the file system related to this operation.
|
||||
DOMString fileSystemId;
|
||||
|
||||
// The unique identifier of this request.
|
||||
long requestId;
|
||||
|
||||
// The source path of the entry to be moved into a new place.
|
||||
DOMString sourcePath;
|
||||
|
||||
// The destination path for the copy operation.
|
||||
DOMString targetPath;
|
||||
};
|
||||
|
||||
// Options for the $(ref:onTruncateRequested) event.
|
||||
dictionary TruncateRequestedOptions {
|
||||
// The identifier of the file system related to this operation.
|
||||
DOMString fileSystemId;
|
||||
|
||||
// The unique identifier of this request.
|
||||
long requestId;
|
||||
|
||||
// The path of the file to be truncated.
|
||||
DOMString filePath;
|
||||
|
||||
// Number of bytes to be retained after the operation completes.
|
||||
double length;
|
||||
};
|
||||
|
||||
// Options for the $(ref:onWriteFileRequested) event.
|
||||
dictionary WriteFileRequestedOptions {
|
||||
// The identifier of the file system related to this operation.
|
||||
DOMString fileSystemId;
|
||||
|
||||
// The unique identifier of this request.
|
||||
long requestId;
|
||||
|
||||
// A request ID used to open the file.
|
||||
long openRequestId;
|
||||
|
||||
// Position in the file (in bytes) to start writing the bytes from.
|
||||
double offset;
|
||||
|
||||
// Buffer of bytes to be written to the file.
|
||||
ArrayBuffer data;
|
||||
};
|
||||
|
||||
// Options for the $(ref:onAbortRequested) event.
|
||||
dictionary AbortRequestedOptions {
|
||||
// The identifier of the file system related to this operation.
|
||||
DOMString fileSystemId;
|
||||
|
||||
// The unique identifier of this request.
|
||||
long requestId;
|
||||
|
||||
// An ID of the request to be aborted.
|
||||
long operationRequestId;
|
||||
};
|
||||
|
||||
// Options for the $(ref:onAddWatcherRequested) event.
|
||||
dictionary AddWatcherRequestedOptions {
|
||||
// The identifier of the file system related to this operation.
|
||||
DOMString fileSystemId;
|
||||
|
||||
// The unique identifier of this request.
|
||||
long requestId;
|
||||
|
||||
// The path of the entry to be observed.
|
||||
DOMString entryPath;
|
||||
|
||||
// Whether observing should include all child entries recursively. It can be
|
||||
// true for directories only.
|
||||
boolean recursive;
|
||||
};
|
||||
|
||||
// Options for the $(ref:onRemoveWatcherRequested) event.
|
||||
dictionary RemoveWatcherRequestedOptions {
|
||||
// The identifier of the file system related to this operation.
|
||||
DOMString fileSystemId;
|
||||
|
||||
// The unique identifier of this request.
|
||||
long requestId;
|
||||
|
||||
// The path of the watched entry.
|
||||
DOMString entryPath;
|
||||
|
||||
// Mode of the watcher.
|
||||
boolean recursive;
|
||||
};
|
||||
|
||||
// Information about an action for an entry.
|
||||
dictionary Action {
|
||||
// The identifier of the action. Any string or $(ref:CommonActionId) for
|
||||
// common actions.
|
||||
DOMString id;
|
||||
|
||||
// The title of the action. It may be ignored for common actions.
|
||||
DOMString? title;
|
||||
};
|
||||
|
||||
// Options for the $(ref:onExecuteActionRequested) event.
|
||||
dictionary ExecuteActionRequestedOptions {
|
||||
// The identifier of the file system related to this operation.
|
||||
DOMString fileSystemId;
|
||||
|
||||
// The unique identifier of this request.
|
||||
long requestId;
|
||||
|
||||
// The set of paths of the entries to be used for the action.
|
||||
DOMString[] entryPaths;
|
||||
|
||||
// The identifier of the action to be executed.
|
||||
DOMString actionId;
|
||||
};
|
||||
|
||||
// Information about a change happened to an entry within the observed
|
||||
// directory (including the entry itself).
|
||||
dictionary Change {
|
||||
// The path of the changed entry.
|
||||
DOMString entryPath;
|
||||
|
||||
// The type of the change which happened to the entry.
|
||||
ChangeType changeType;
|
||||
|
||||
// Information relating to the file if backed by a cloud file system.
|
||||
CloudFileInfo? cloudFileInfo;
|
||||
};
|
||||
|
||||
// Options for the $(ref:notify) method.
|
||||
dictionary NotifyOptions {
|
||||
// The identifier of the file system related to this change.
|
||||
DOMString fileSystemId;
|
||||
|
||||
// The path of the observed entry.
|
||||
DOMString observedPath;
|
||||
|
||||
// Mode of the observed entry.
|
||||
boolean recursive;
|
||||
|
||||
// The type of the change which happened to the observed entry. If it is
|
||||
// DELETED, then the observed entry will be automatically removed from the
|
||||
// list of observed entries.
|
||||
ChangeType changeType;
|
||||
|
||||
// List of changes to entries within the observed directory (including the
|
||||
// entry itself)
|
||||
Change[]? changes;
|
||||
|
||||
// Tag for the notification. Required if the file system was mounted with
|
||||
// the <code>supportsNotifyTag</code> option. Note, that this flag is
|
||||
// necessary to provide notifications about changes which changed even
|
||||
// when the system was shutdown.
|
||||
DOMString? tag;
|
||||
};
|
||||
|
||||
// Options for the $(ref:onConfigureRequested) event.
|
||||
dictionary ConfigureRequestedOptions {
|
||||
// The identifier of the file system to be configured.
|
||||
DOMString fileSystemId;
|
||||
|
||||
// The unique identifier of this request.
|
||||
long requestId;
|
||||
};
|
||||
|
||||
// Callback to receive the result of $(ref:getAll) function.
|
||||
callback GetAllCallback = void(FileSystemInfo[] fileSystems);
|
||||
|
||||
// Callback to receive the result of $(ref:get) function.
|
||||
callback GetCallback = void(FileSystemInfo fileSystem);
|
||||
|
||||
// Callback to be called by the providing extension in case of a success.
|
||||
[nocompile] callback ProviderSuccessCallback = void();
|
||||
|
||||
// Callback to be called by the providing extension in case of an error.
|
||||
// Any error code is allowed except <code>OK</code>.
|
||||
[nocompile] callback ProviderErrorCallback = void(ProviderError error);
|
||||
|
||||
// Success callback for the $(ref:onGetMetadataRequested) event.
|
||||
[nocompile] callback MetadataCallback = void(EntryMetadata metadata);
|
||||
|
||||
// Success callback for the $(ref:onGetActionsRequested) event.
|
||||
[nocompile] callback ActionsCallback = void(Action[] actions);
|
||||
|
||||
// Success callback for the $(ref:onReadDirectoryRequested) event. If more
|
||||
// entries will be returned, then <code>hasMore</code> must be true, and it
|
||||
// has to be called again with additional entries. If no more entries are
|
||||
// available, then <code>hasMore</code> must be set to false.
|
||||
[nocompile] callback EntriesCallback = void(
|
||||
EntryMetadata[] entries, boolean hasMore);
|
||||
|
||||
// Success callback for the $(ref:onReadFileRequested) event. If more
|
||||
// data will be returned, then <code>hasMore</code> must be true, and it
|
||||
// has to be called again with additional entries. If no more data is
|
||||
// available, then <code>hasMore</code> must be set to false.
|
||||
[nocompile] callback FileDataCallback = void(
|
||||
ArrayBuffer data, boolean hasMore);
|
||||
|
||||
// Success callback for the $(ref:onOpenFileRequested) event.
|
||||
[nocompile] callback OpenFileSuccessCallback = void(
|
||||
optional EntryMetadata metadata);
|
||||
|
||||
// A generic result callback to indicate success or failure.
|
||||
callback ResultCallback = void();
|
||||
|
||||
interface Functions {
|
||||
// Mounts a file system with the given <code>fileSystemId</code> and
|
||||
// <code>displayName</code>. <code>displayName</code> will be shown in the
|
||||
// left panel of the Files app. <code>displayName</code> can contain any
|
||||
// characters including '/', but cannot be an empty string.
|
||||
// <code>displayName</code> must be descriptive but doesn't have to be
|
||||
// unique. The <code>fileSystemId</code> must not be an empty string.
|
||||
//
|
||||
// Depending on the type of the file system being mounted, the
|
||||
// <code>source</code> option must be set appropriately.
|
||||
//
|
||||
// In case of an error, $(ref:runtime.lastError) will be set with a
|
||||
// corresponding error code.
|
||||
static void mount(
|
||||
MountOptions options,
|
||||
optional ResultCallback callback);
|
||||
|
||||
// Unmounts a file system with the given <code>fileSystemId</code>. It
|
||||
// must be called after $(ref:onUnmountRequested) is invoked. Also,
|
||||
// the providing extension can decide to perform unmounting if not requested
|
||||
// (eg. in case of lost connection, or a file error).
|
||||
//
|
||||
// In case of an error, $(ref:runtime.lastError) will be set with a
|
||||
// corresponding error code.
|
||||
static void unmount(
|
||||
UnmountOptions options,
|
||||
optional ResultCallback callback);
|
||||
|
||||
// Returns all file systems mounted by the extension.
|
||||
static void getAll(GetAllCallback callback);
|
||||
|
||||
// Returns information about a file system with the passed
|
||||
// <code>fileSystemId</code>.
|
||||
static void get(
|
||||
DOMString fileSystemId,
|
||||
GetCallback callback);
|
||||
|
||||
// Notifies about changes in the watched directory at
|
||||
// <code>observedPath</code> in <code>recursive</code> mode. If the file
|
||||
// system is mounted with <code>supportsNotifyTag</code>, then
|
||||
// <code>tag</code> must be provided, and all changes since the last
|
||||
// notification always reported, even if the system was shutdown. The last
|
||||
// tag can be obtained with $(ref:getAll).
|
||||
//
|
||||
// To use, the <code>file_system_provider.notify</code> manifest option
|
||||
// must be set to true.
|
||||
//
|
||||
// Value of <code>tag</code> can be any string which is unique per call,
|
||||
// so it's possible to identify the last registered notification. Eg. if
|
||||
// the providing extension starts after a reboot, and the last registered
|
||||
// notification's tag is equal to "123", then it should call $(ref:notify)
|
||||
// for all changes which happened since the change tagged as "123". It
|
||||
// cannot be an empty string.
|
||||
//
|
||||
// Not all providers are able to provide a tag, but if the file system has
|
||||
// a changelog, then the tag can be eg. a change number, or a revision
|
||||
// number.
|
||||
//
|
||||
// Note that if a parent directory is removed, then all descendant entries
|
||||
// are also removed, and if they are watched, then the API must be notified
|
||||
// about the fact. Also, if a directory is renamed, then all descendant
|
||||
// entries are in fact removed, as there is no entry under their original
|
||||
// paths anymore.
|
||||
//
|
||||
// In case of an error, $(ref:runtime.lastError) will be set
|
||||
// will a corresponding error code.
|
||||
static void notify(
|
||||
NotifyOptions options,
|
||||
optional ResultCallback callback);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Raised when unmounting for the file system with the
|
||||
// <code>fileSystemId</code> identifier is requested. In the response, the
|
||||
// $(ref:unmount) API method must be called together with
|
||||
// <code>successCallback</code>. If unmounting is not possible (eg. due to
|
||||
// a pending operation), then <code>errorCallback</code> must be called.
|
||||
[maxListeners=1] static void onUnmountRequested(
|
||||
UnmountRequestedOptions options,
|
||||
ProviderSuccessCallback successCallback,
|
||||
ProviderErrorCallback errorCallback);
|
||||
|
||||
// Raised when metadata of a file or a directory at <code>entryPath</code>
|
||||
// is requested. The metadata must be returned with the
|
||||
// <code>successCallback</code> call. In case of an error,
|
||||
// <code>errorCallback</code> must be called.
|
||||
[maxListeners=1] static void onGetMetadataRequested(
|
||||
GetMetadataRequestedOptions options,
|
||||
MetadataCallback successCallback,
|
||||
ProviderErrorCallback errorCallback);
|
||||
|
||||
// Raised when a list of actions for a set of files or directories at
|
||||
// <code>entryPaths</code> is requested. All of the returned actions must
|
||||
// be applicable to each entry. If there are no such actions, an empty array
|
||||
// should be returned. The actions must be returned with the
|
||||
// <code>successCallback</code> call. In case of an error,
|
||||
// <code>errorCallback</code> must be called.
|
||||
[maxListeners=1] static void onGetActionsRequested(
|
||||
GetActionsRequestedOptions options,
|
||||
ActionsCallback successCallback,
|
||||
ProviderErrorCallback errorCallback);
|
||||
|
||||
// Raised when contents of a directory at <code>directoryPath</code> are
|
||||
// requested. The results must be returned in chunks by calling the
|
||||
// <code>successCallback</code> several times. In case of an error,
|
||||
// <code>errorCallback</code> must be called.
|
||||
[maxListeners=1] static void onReadDirectoryRequested(
|
||||
ReadDirectoryRequestedOptions options,
|
||||
EntriesCallback successCallback,
|
||||
ProviderErrorCallback errorCallback);
|
||||
|
||||
// Raised when opening a file at <code>filePath</code> is requested. If the
|
||||
// file does not exist, then the operation must fail. Maximum number of
|
||||
// files opened at once can be specified with <code>MountOptions</code>.
|
||||
[maxListeners=1] static void onOpenFileRequested(
|
||||
OpenFileRequestedOptions options,
|
||||
OpenFileSuccessCallback successCallback,
|
||||
ProviderErrorCallback errorCallback);
|
||||
|
||||
// Raised when opening a file previously opened with
|
||||
// <code>openRequestId</code> is requested to be closed.
|
||||
[maxListeners=1] static void onCloseFileRequested(
|
||||
CloseFileRequestedOptions options,
|
||||
ProviderSuccessCallback successCallback,
|
||||
ProviderErrorCallback errorCallback);
|
||||
|
||||
// Raised when reading contents of a file opened previously with
|
||||
// <code>openRequestId</code> is requested. The results must be returned in
|
||||
// chunks by calling <code>successCallback</code> several times. In case of
|
||||
// an error, <code>errorCallback</code> must be called.
|
||||
[maxListeners=1] static void onReadFileRequested(
|
||||
ReadFileRequestedOptions options,
|
||||
FileDataCallback successCallback,
|
||||
ProviderErrorCallback errorCallback);
|
||||
|
||||
// Raised when creating a directory is requested. The operation must fail
|
||||
// with the EXISTS error if the target directory already exists.
|
||||
// If <code>recursive</code> is true, then all of the missing directories
|
||||
// on the directory path must be created.
|
||||
[maxListeners=1] static void onCreateDirectoryRequested(
|
||||
CreateDirectoryRequestedOptions options,
|
||||
ProviderSuccessCallback successCallback,
|
||||
ProviderErrorCallback errorCallback);
|
||||
|
||||
// Raised when deleting an entry is requested. If <code>recursive</code> is
|
||||
// true, and the entry is a directory, then all of the entries inside
|
||||
// must be recursively deleted as well.
|
||||
[maxListeners=1] static void onDeleteEntryRequested(
|
||||
DeleteEntryRequestedOptions options,
|
||||
ProviderSuccessCallback successCallback,
|
||||
ProviderErrorCallback errorCallback);
|
||||
|
||||
// Raised when creating a file is requested. If the file already exists,
|
||||
// then <code>errorCallback</code> must be called with the
|
||||
// <code>"EXISTS"</code> error code.
|
||||
[maxListeners=1] static void onCreateFileRequested(
|
||||
CreateFileRequestedOptions options,
|
||||
ProviderSuccessCallback successCallback,
|
||||
ProviderErrorCallback errorCallback);
|
||||
|
||||
// Raised when copying an entry (recursively if a directory) is requested.
|
||||
// If an error occurs, then <code>errorCallback</code> must be called.
|
||||
[maxListeners=1] static void onCopyEntryRequested(
|
||||
CopyEntryRequestedOptions options,
|
||||
ProviderSuccessCallback successCallback,
|
||||
ProviderErrorCallback errorCallback);
|
||||
|
||||
// Raised when moving an entry (recursively if a directory) is requested.
|
||||
// If an error occurs, then <code>errorCallback</code> must be called.
|
||||
[maxListeners=1] static void onMoveEntryRequested(
|
||||
MoveEntryRequestedOptions options,
|
||||
ProviderSuccessCallback successCallback,
|
||||
ProviderErrorCallback errorCallback);
|
||||
|
||||
// Raised when truncating a file to a desired length is requested.
|
||||
// If an error occurs, then <code>errorCallback</code> must be called.
|
||||
[maxListeners=1] static void onTruncateRequested(
|
||||
TruncateRequestedOptions options,
|
||||
ProviderSuccessCallback successCallback,
|
||||
ProviderErrorCallback errorCallback);
|
||||
|
||||
// Raised when writing contents to a file opened previously with
|
||||
// <code>openRequestId</code> is requested.
|
||||
[maxListeners=1] static void onWriteFileRequested(
|
||||
WriteFileRequestedOptions options,
|
||||
ProviderSuccessCallback successCallback,
|
||||
ProviderErrorCallback errorCallback);
|
||||
|
||||
// Raised when aborting an operation with <code>operationRequestId</code>
|
||||
// is requested. The operation executed with <code>operationRequestId</code>
|
||||
// must be immediately stopped and <code>successCallback</code> of this
|
||||
// abort request executed. If aborting fails, then
|
||||
// <code>errorCallback</code> must be called. Note, that callbacks of the
|
||||
// aborted operation must not be called, as they will be ignored. Despite
|
||||
// calling <code>errorCallback</code>, the request may be forcibly aborted.
|
||||
[maxListeners=1] static void onAbortRequested(
|
||||
AbortRequestedOptions options,
|
||||
ProviderSuccessCallback successCallback,
|
||||
ProviderErrorCallback errorCallback);
|
||||
|
||||
// Raised when showing a configuration dialog for <code>fileSystemId</code>
|
||||
// is requested. If it's handled, the
|
||||
// <code>file_system_provider.configurable</code> manfiest option must be
|
||||
// set to true.
|
||||
[maxListeners=1] static void onConfigureRequested(
|
||||
ConfigureRequestedOptions options,
|
||||
ProviderSuccessCallback successCallback,
|
||||
ProviderErrorCallback errorCallback);
|
||||
|
||||
// Raised when showing a dialog for mounting a new file system is requested.
|
||||
// If the extension/app is a file handler, then this event shouldn't be
|
||||
// handled. Instead <code>app.runtime.onLaunched</code> should be handled in
|
||||
// order to mount new file systems when a file is opened. For multiple
|
||||
// mounts, the <code>file_system_provider.multiple_mounts</code> manifest
|
||||
// option must be set to true.
|
||||
[maxListeners=1] static void onMountRequested(
|
||||
ProviderSuccessCallback successCallback,
|
||||
ProviderErrorCallback errorCallback);
|
||||
|
||||
// Raised when setting a new directory watcher is requested. If an error
|
||||
// occurs, then <code>errorCallback</code> must be called.
|
||||
[maxListeners=1] static void onAddWatcherRequested(
|
||||
AddWatcherRequestedOptions options,
|
||||
ProviderSuccessCallback successCallback,
|
||||
ProviderErrorCallback errorCallback);
|
||||
|
||||
// Raised when the watcher should be removed. If an error occurs, then
|
||||
// <code>errorCallback</code> must be called.
|
||||
[maxListeners=1] static void onRemoveWatcherRequested(
|
||||
RemoveWatcherRequestedOptions options,
|
||||
ProviderSuccessCallback successCallback,
|
||||
ProviderErrorCallback errorCallback);
|
||||
|
||||
// Raised when executing an action for a set of files or directories is\
|
||||
// requested. After the action is completed, <code>successCallback</code>
|
||||
// must be called. On error, <code>errorCallback</code> must be called.
|
||||
[maxListeners=1] static void onExecuteActionRequested(
|
||||
ExecuteActionRequestedOptions options,
|
||||
ProviderSuccessCallback successCallback,
|
||||
ProviderErrorCallback errorCallback);
|
||||
};
|
||||
};
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
// Copyright 2014 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Internal, used by fileSystemProvider's custom bindings. These functions are
|
||||
// called when events' callbacks are invoked.
|
||||
[implemented_in="chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.h",
|
||||
nodoc]
|
||||
namespace fileSystemProviderInternal {
|
||||
interface Functions {
|
||||
// Internal. Callback for mount requests.
|
||||
static void respondToMountRequest(
|
||||
long requestId,
|
||||
fileSystemProvider.ProviderError error,
|
||||
long executionTime);
|
||||
|
||||
// Internal. Success callback of the <code>onUnmountRequested</code>
|
||||
// event. Must be called when unmounting is completed.
|
||||
static void unmountRequestedSuccess(
|
||||
DOMString fileSystemId,
|
||||
long requestId,
|
||||
long executionTime);
|
||||
|
||||
// Internal. Success callback of the <code>onGetMetadataRequested</code>
|
||||
// event. Must be called if metadata is available.
|
||||
static void getMetadataRequestedSuccess(
|
||||
DOMString fileSystemId,
|
||||
long requestId,
|
||||
fileSystemProvider.EntryMetadata metadata,
|
||||
long executionTime);
|
||||
|
||||
// Internal. Success callback of the <code>onGetActionsRequested</code>
|
||||
// event. Must be called if actions are available.
|
||||
static void getActionsRequestedSuccess(
|
||||
DOMString fileSystemId,
|
||||
long requestId,
|
||||
fileSystemProvider.Action[] actions,
|
||||
long executionTime);
|
||||
|
||||
// Internal. Success callback of the <code>onReadDirectoryRequested</code>
|
||||
// event. Can be called multiple times per request.
|
||||
static void readDirectoryRequestedSuccess(
|
||||
DOMString fileSystemId,
|
||||
long requestId,
|
||||
fileSystemProvider.EntryMetadata[] entries,
|
||||
boolean hasMore,
|
||||
long executionTime);
|
||||
|
||||
// Internal. Success callback of the <code>onReadFileRequested</code>
|
||||
// event. Can be called multiple times per request.
|
||||
static void readFileRequestedSuccess(
|
||||
DOMString fileSystemId,
|
||||
long requestId,
|
||||
ArrayBuffer data,
|
||||
boolean hasMore,
|
||||
long executionTime);
|
||||
|
||||
// Internal. Success callback of the <code>onOpenFileRequested</code>
|
||||
// event.
|
||||
static void openFileRequestedSuccess(
|
||||
DOMString fileSystemId,
|
||||
long requestId,
|
||||
long executionTime,
|
||||
optional fileSystemProvider.EntryMetadata metadata);
|
||||
|
||||
// Internal. Success callback of all of the operation requests, which do not
|
||||
// return any value. Must be called in case of a success.
|
||||
static void operationRequestedSuccess(
|
||||
DOMString fileSystemId,
|
||||
long requestId,
|
||||
long executionTime);
|
||||
|
||||
// Internal. Error callback of all of the operation requests. Must be called
|
||||
// if an operation fails.
|
||||
static void operationRequestedError(
|
||||
DOMString fileSystemId,
|
||||
long requestId,
|
||||
fileSystemProvider.ProviderError error,
|
||||
long executionTime);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -0,0 +1,243 @@
|
||||
// Copyright 2013 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.identity</code> API to get OAuth2 access tokens.
|
||||
namespace identity {
|
||||
|
||||
dictionary AccountInfo {
|
||||
// A unique identifier for the account. This ID will not change
|
||||
// for the lifetime of the account.
|
||||
DOMString id;
|
||||
};
|
||||
|
||||
enum AccountStatus {
|
||||
// Specifies that Sync is enabled for the primary account.
|
||||
SYNC,
|
||||
// Specifies the existence of a primary account, if any.
|
||||
ANY
|
||||
};
|
||||
|
||||
dictionary ProfileDetails {
|
||||
// A status of the primary account signed into a profile whose
|
||||
// <code>ProfileUserInfo</code> should be returned. Defaults to
|
||||
// <code>SYNC</code> account status.
|
||||
AccountStatus? accountStatus;
|
||||
};
|
||||
|
||||
dictionary ProfileUserInfo {
|
||||
// An email address for the user account signed into the current
|
||||
// profile. Empty if the user is not signed in or the
|
||||
// <code>identity.email</code> manifest permission is not
|
||||
// specified.
|
||||
DOMString email;
|
||||
|
||||
// A unique identifier for the account. This ID will not change
|
||||
// for the lifetime of the account. Empty if the user is not
|
||||
// signed in or (in M41+) the <code>identity.email</code>
|
||||
// manifest permission is not specified.
|
||||
DOMString id;
|
||||
};
|
||||
|
||||
dictionary TokenDetails {
|
||||
// Fetching a token may require the user to sign-in to Chrome, or
|
||||
// approve the application's requested scopes. If the interactive
|
||||
// flag is <code>true</code>, <code>getAuthToken</code> will
|
||||
// prompt the user as necessary. When the flag is
|
||||
// <code>false</code> or omitted, <code>getAuthToken</code> will
|
||||
// return failure any time a prompt would be required.
|
||||
boolean? interactive;
|
||||
|
||||
// The account ID whose token should be returned. If not specified, the
|
||||
// function will use an account from the Chrome profile: the Sync account if
|
||||
// there is one, or otherwise the first Google web account.
|
||||
AccountInfo? account;
|
||||
|
||||
// A list of OAuth2 scopes to request.
|
||||
//
|
||||
// When the <code>scopes</code> field is present, it overrides the
|
||||
// list of scopes specified in manifest.json.
|
||||
DOMString[]? scopes;
|
||||
|
||||
// The <code>enableGranularPermissions</code> flag allows extensions to
|
||||
// opt-in early to the granular permissions consent screen, in which
|
||||
// requested permissions are granted or denied individually.
|
||||
boolean? enableGranularPermissions;
|
||||
};
|
||||
|
||||
dictionary InvalidTokenDetails {
|
||||
// The specific token that should be removed from the cache.
|
||||
DOMString token;
|
||||
};
|
||||
|
||||
dictionary WebAuthFlowDetails {
|
||||
// The URL that initiates the auth flow.
|
||||
DOMString url;
|
||||
|
||||
// Whether to launch auth flow in interactive mode.
|
||||
//
|
||||
// Since some auth flows may immediately redirect to a result URL,
|
||||
// <code>launchWebAuthFlow</code> hides its web view until the first
|
||||
// navigation either redirects to the final URL, or finishes loading a page
|
||||
// meant to be displayed.
|
||||
//
|
||||
// If the <code>interactive</code> flag is <code>true</code>, the window
|
||||
// will be displayed when a page load completes. If the flag is
|
||||
// <code>false</code> or omitted, <code>launchWebAuthFlow</code> will return
|
||||
// with an error if the initial navigation does not complete the flow.
|
||||
//
|
||||
// For flows that use JavaScript for redirection,
|
||||
// <code>abortOnLoadForNonInteractive</code> can be set to <code>false</code>
|
||||
// in combination with setting <code>timeoutMsForNonInteractive</code> to give
|
||||
// the page a chance to perform any redirects.
|
||||
boolean? interactive;
|
||||
|
||||
// Whether to terminate <code>launchWebAuthFlow</code> for non-interactive
|
||||
// requests after the page loads. This parameter does not affect interactive
|
||||
// flows.
|
||||
//
|
||||
// When set to <code>true</code> (default) the flow will terminate
|
||||
// immediately after the page loads. When set to <code>false</code>, the
|
||||
// flow will only terminate after the
|
||||
// <code>timeoutMsForNonInteractive</code> passes. This is useful for
|
||||
// identity providers that use JavaScript to perform redirections after the
|
||||
// page loads.
|
||||
boolean? abortOnLoadForNonInteractive;
|
||||
|
||||
// The maximum amount of time, in miliseconds,
|
||||
// <code>launchWebAuthFlow</code> is allowed to run in non-interactive mode
|
||||
// in total. Only has an effect if <code>interactive</code> is
|
||||
// <code>false</code>.
|
||||
long? timeoutMsForNonInteractive;
|
||||
};
|
||||
|
||||
dictionary GetAuthTokenResult {
|
||||
// The specific token associated with the request.
|
||||
DOMString? token;
|
||||
|
||||
// A list of OAuth2 scopes granted to the extension.
|
||||
DOMString[]? grantedScopes;
|
||||
};
|
||||
|
||||
callback GetAuthTokenCallback = void (GetAuthTokenResult result);
|
||||
callback GetAccountsCallback = void (AccountInfo[] accounts);
|
||||
callback GetProfileUserInfoCallback = void (ProfileUserInfo userInfo);
|
||||
callback InvalidateAuthTokenCallback = void ();
|
||||
callback ClearAllCachedAuthTokensCallback = void ();
|
||||
callback LaunchWebAuthFlowCallback = void (optional DOMString responseUrl);
|
||||
|
||||
interface Functions {
|
||||
// Retrieves a list of AccountInfo objects describing the accounts
|
||||
// present on the profile.
|
||||
//
|
||||
// <code>getAccounts</code> is only supported on dev channel.
|
||||
static void getAccounts(GetAccountsCallback callback);
|
||||
|
||||
// Gets an OAuth2 access token using the client ID and scopes
|
||||
// specified in the <a
|
||||
// href="/docs/apps/app_identity#update_manifest"><code>oauth2</code>
|
||||
// section of manifest.json</a>.
|
||||
//
|
||||
// The Identity API caches access tokens in memory, so it's ok to
|
||||
// call <code>getAuthToken</code> non-interactively any time a token is
|
||||
// required. The token cache automatically handles expiration.
|
||||
//
|
||||
// For a good user experience it is important interactive token requests are
|
||||
// initiated by UI in your app explaining what the authorization is for.
|
||||
// Failing to do this will cause your users to get authorization requests,
|
||||
// or Chrome sign in screens if they are not signed in, with with no
|
||||
// context. In particular, do not use <code>getAuthToken</code>
|
||||
// interactively when your app is first launched.
|
||||
//
|
||||
// Note: When called with a callback, instead of returning an object this
|
||||
// function will return the two properties as separate arguments passed to
|
||||
// the callback.
|
||||
//
|
||||
// |details| : Token options.
|
||||
// |callback| : Called with an OAuth2 access token as specified by the
|
||||
// manifest, or undefined if there was an error. The
|
||||
// <code>grantedScopes</code> parameter is populated since Chrome 87. When
|
||||
// available, this parameter contains the list of granted scopes
|
||||
// corresponding with the returned token.
|
||||
static void getAuthToken(
|
||||
optional TokenDetails details,
|
||||
optional GetAuthTokenCallback callback);
|
||||
|
||||
// Retrieves email address and obfuscated gaia id of the user
|
||||
// signed into a profile.
|
||||
//
|
||||
// Requires the <code>identity.email</code> manifest permission. Otherwise,
|
||||
// returns an empty result.
|
||||
//
|
||||
// This API is different from identity.getAccounts in two
|
||||
// ways. The information returned is available offline, and it
|
||||
// only applies to the primary account for the profile.
|
||||
//
|
||||
// |details|: Profile options.
|
||||
// |callback|: Called with the <code>ProfileUserInfo</code> of the primary
|
||||
// Chrome account, of an empty <code>ProfileUserInfo</code> if the account
|
||||
// with given <code>details</code> doesn't exist.
|
||||
static void getProfileUserInfo(
|
||||
optional ProfileDetails details,
|
||||
GetProfileUserInfoCallback callback);
|
||||
|
||||
// Removes an OAuth2 access token from the Identity API's token cache.
|
||||
//
|
||||
// If an access token is discovered to be invalid, it should be
|
||||
// passed to removeCachedAuthToken to remove it from the
|
||||
// cache. The app may then retrieve a fresh token with
|
||||
// <code>getAuthToken</code>.
|
||||
//
|
||||
// |details| : Token information.
|
||||
// |callback| : Called when the token has been removed from the cache.
|
||||
static void removeCachedAuthToken(
|
||||
InvalidTokenDetails details,
|
||||
optional InvalidateAuthTokenCallback callback);
|
||||
|
||||
// Resets the state of the Identity API:
|
||||
// <ul>
|
||||
// <li>Removes all OAuth2 access tokens from the token cache</li>
|
||||
// <li>Removes user's account preferences</li>
|
||||
// <li>De-authorizes the user from all auth flows</li>
|
||||
// </ul>
|
||||
//
|
||||
// |callback| : Called when the state has been cleared.
|
||||
static void clearAllCachedAuthTokens(
|
||||
ClearAllCachedAuthTokensCallback callback);
|
||||
|
||||
// Starts an auth flow at the specified URL.
|
||||
//
|
||||
// This method enables auth flows with non-Google identity
|
||||
// providers by launching a web view and navigating it to the
|
||||
// first URL in the provider's auth flow. When the provider
|
||||
// redirects to a URL matching the pattern
|
||||
// <code>https://<app-id>.chromiumapp.org/*</code>, the
|
||||
// window will close, and the final redirect URL will be passed to
|
||||
// the <var>callback</var> function.
|
||||
//
|
||||
// For a good user experience it is important interactive auth flows are
|
||||
// initiated by UI in your app explaining what the authorization is for.
|
||||
// Failing to do this will cause your users to get authorization requests
|
||||
// with no context. In particular, do not launch an interactive auth flow
|
||||
// when your app is first launched.
|
||||
//
|
||||
// |details| : WebAuth flow options.
|
||||
// |callback| : Called with the URL redirected back to your application.
|
||||
static void launchWebAuthFlow(
|
||||
WebAuthFlowDetails details,
|
||||
LaunchWebAuthFlowCallback callback);
|
||||
|
||||
// Generates a redirect URL to be used in |launchWebAuthFlow|.
|
||||
//
|
||||
// The generated URLs match the pattern
|
||||
// <code>https://<app-id>.chromiumapp.org/*</code>.
|
||||
//
|
||||
// |path| : The path appended to the end of the generated URL.
|
||||
[nocompile] static DOMString getRedirectURL(optional DOMString path);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Fired when signin state changes for an account on the user's profile.
|
||||
static void onSignInChanged(AccountInfo account, boolean signedIn);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
// Copyright 2013 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// An API to test IDL schema specifications.
|
||||
namespace idltest {
|
||||
|
||||
callback LongArrayCallback = void(long[] array);
|
||||
callback ArrayBufferCallback = void(ArrayBuffer buffer);
|
||||
|
||||
interface Functions {
|
||||
// Functions for testing binary data request/response parameters. The first
|
||||
// two just return back the bytes they were passed in an array.
|
||||
static void sendArrayBuffer(
|
||||
ArrayBuffer input,
|
||||
LongArrayCallback callback);
|
||||
|
||||
// TODO(asargent) - we currently can't have [instanceOf=ArrayBufferView],
|
||||
// I think because ArrayBufferView isn't an instantiable type. The best
|
||||
// we might be able to do is have a 'choices' list including all the
|
||||
// typed array subclasses like Uint8Array, Uint16Array, Float32Array, etc.
|
||||
static void sendArrayBufferView(
|
||||
[instanceOf=Uint8Array] ArrayBufferView input,
|
||||
LongArrayCallback callback);
|
||||
static void getArrayBuffer(ArrayBufferCallback callback);
|
||||
|
||||
// This function should not have C++ code autogenerated (the variable name
|
||||
// |switch| should cause compile errors if it does). But the name should
|
||||
// get defined and made visible from within extensions/apps code.
|
||||
[nocompile] static void nocompileFunc(long switch);
|
||||
};
|
||||
|
||||
};
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
// Copyright 2023 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// imageLoaderPrivate API.
|
||||
// This is a private API used by the ChromeOS FilesApp ImageLoader extension.
|
||||
[platforms=("chromeos"),
|
||||
implemented_in="chrome/browser/ash/extensions/file_manager/image_loader_private_api.h"]
|
||||
namespace imageLoaderPrivate {
|
||||
// |thumbnailDataUrl| A data URL for the thumbnail; |thumbnailDataUrl| is
|
||||
// empty if no thumbnail was available.
|
||||
callback GetThumbnailCallback = void(DOMString thumbnailDataUrl);
|
||||
|
||||
interface Functions {
|
||||
// For a file in DriveFS, retrieves its thumbnail. If |cropToSquare| is
|
||||
// true, returns a thumbnail appropriate for file list or grid views;
|
||||
// otherwise, returns a thumbnail appropriate for quickview.
|
||||
[doesNotSupportPromises]
|
||||
static void getDriveThumbnail(DOMString url,
|
||||
boolean cropToSquare,
|
||||
GetThumbnailCallback callback);
|
||||
|
||||
// For a local PDF file, retrieves its thumbnail with a given |width| and
|
||||
// |height|.
|
||||
[doesNotSupportPromises]
|
||||
static void getPdfThumbnail(DOMString url,
|
||||
long width,
|
||||
long height,
|
||||
GetThumbnailCallback callback);
|
||||
|
||||
// Retrieves a thumbnail of an ARC DocumentsProvider file, closely matching
|
||||
// the hinted size specified by |widthHint| and |heightHint|, but not
|
||||
// necessarily the exact size. |callback| is called with thumbnail data
|
||||
// encoded as a data URL. If the document does not support thumbnails,
|
||||
// |callback| is called with an empty string.
|
||||
// Note: The thumbnail data may originate from third-party application code,
|
||||
// and is untrustworthy (Security).
|
||||
[doesNotSupportPromises]
|
||||
static void getArcDocumentsProviderThumbnail(DOMString url,
|
||||
long widthHint,
|
||||
long heightHint,
|
||||
GetThumbnailCallback callback);
|
||||
};
|
||||
};
|
||||
|
||||
+145
@@ -0,0 +1,145 @@
|
||||
// Copyright 2013 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.image_writer</code> API to write images to
|
||||
// removable media.
|
||||
//
|
||||
// See the design doc for a detailed description of this API.
|
||||
// https://goo.gl/KzMEFq
|
||||
namespace imageWriterPrivate {
|
||||
// The different stages of a write call.
|
||||
//
|
||||
// <dl>
|
||||
// <dt>confirmation</dt>
|
||||
// <dd>The process starts by prompting the user for confirmation.</dd>
|
||||
// <dt>download</dt>
|
||||
// <dd>The image file is being download if a remote image was
|
||||
// requested.</dd>
|
||||
// <dt>verifyDownload</dt>
|
||||
// <dd>The download is being verified to match the image hash, if
|
||||
// provided</dd>
|
||||
// <dt>unzip</dt>
|
||||
// <dd>The image is being extracted from the downloaded zip file</dd>
|
||||
// <dt>write</dt>
|
||||
// <dd>The image is being written to disk.</dd>
|
||||
// <dt>verifyWrite</dt>
|
||||
// <dt>The system is verifying that the written image matches the
|
||||
// downloaded image.</dd>
|
||||
// <dl>
|
||||
enum Stage {
|
||||
confirmation,
|
||||
download,
|
||||
verifyDownload,
|
||||
unzip,
|
||||
write,
|
||||
verifyWrite,
|
||||
unknown
|
||||
};
|
||||
|
||||
// Options for writing an image.
|
||||
dictionary UrlWriteOptions {
|
||||
// If present, verify that the downloaded image matches this hash.
|
||||
DOMString? imageHash;
|
||||
// If true, save the downloaded image as a file using the user's downloads
|
||||
// preferences.
|
||||
boolean? saveAsDownload;
|
||||
};
|
||||
|
||||
dictionary ProgressInfo {
|
||||
// The $(ref:Stage) that the write process is currently in.
|
||||
Stage stage;
|
||||
// Current progress within the stage.
|
||||
long percentComplete;
|
||||
};
|
||||
|
||||
dictionary RemovableStorageDevice {
|
||||
DOMString storageUnitId;
|
||||
double capacity;
|
||||
DOMString vendor;
|
||||
DOMString model;
|
||||
boolean removable;
|
||||
};
|
||||
|
||||
callback WriteImageCallback = void ();
|
||||
callback WriteCancelCallback = void ();
|
||||
callback ListRemovableStorageDevicesCallback = void (RemovableStorageDevice[] devices);
|
||||
callback DestroyPartitionsCallback = void ();
|
||||
|
||||
interface Functions {
|
||||
// Write an image to the disk downloaded from the provided URL. The
|
||||
// callback will be called when the entire operation completes, either
|
||||
// successfully or on error.
|
||||
//
|
||||
// |storageUnitId|: The identifier for the storage unit
|
||||
// |imageUrl|: The url of the image to download which will be written
|
||||
// to the storage unit identified by |storageUnitId|
|
||||
// |options|: Optional parameters if comparing the download with a given
|
||||
// hash or saving the download to the users Downloads folder instead of a
|
||||
// temporary directory is desired
|
||||
// |callback|: The callback which signifies that the write operation has
|
||||
// been started by the system and provides a unique ID for this operation.
|
||||
static void writeFromUrl(
|
||||
DOMString storageUnitId,
|
||||
DOMString imageUrl,
|
||||
optional UrlWriteOptions options,
|
||||
WriteImageCallback callback);
|
||||
|
||||
// Write an image to the disk, prompting the user to supply the image from
|
||||
// a local file. The callback will be called when the entire operation
|
||||
// completes, either successfully or on error.
|
||||
//
|
||||
// |storageUnitId|: The identifier for the storage unit
|
||||
// |fileEntry|: The FileEntry object of the image to be burned.
|
||||
// |callback|: The callback which signifies that the write operation has
|
||||
// been started by the system and provides a unique ID for this operation.
|
||||
static void writeFromFile(
|
||||
DOMString storageUnitId,
|
||||
[instanceOf=FileEntry] object fileEntry,
|
||||
WriteImageCallback callback);
|
||||
|
||||
// Cancel a current write operation.
|
||||
//
|
||||
// |callback|: The callback which is triggered with the write is
|
||||
// successfully cancelled, passing the $(ref:ProgressInfo) of the operation at
|
||||
// the time it was cancelled.
|
||||
static void cancelWrite(WriteCancelCallback callback);
|
||||
|
||||
// Destroys the partition table of a disk, effectively erasing it. This is
|
||||
// a fairly quick operation and so it does not have complex stages or
|
||||
// progress information, just a write phase.
|
||||
//
|
||||
// |storageUnitId|: The identifier of the storage unit to wipe
|
||||
// |callback|: A callback that triggers when the operation has been
|
||||
// successfully started.
|
||||
static void destroyPartitions(
|
||||
DOMString storageUnitId,
|
||||
DestroyPartitionsCallback callback);
|
||||
|
||||
// List all the removable block devices currently attached to the system.
|
||||
// |callback|: A callback called with a list of removable storage devices
|
||||
static void listRemovableStorageDevices(
|
||||
ListRemovableStorageDevicesCallback callback);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Fires periodically throughout the writing operation and at least once per
|
||||
// stage.
|
||||
static void onWriteProgress(ProgressInfo info);
|
||||
|
||||
// Fires when the write operation has completely finished, such as all
|
||||
// devices being finalized and resources released.
|
||||
static void onWriteComplete();
|
||||
|
||||
// Fires when an error occured during writing, passing the $(ref:ProgressInfo)
|
||||
// of the operation at the time the error occured.
|
||||
static void onWriteError(ProgressInfo info, DOMString error);
|
||||
|
||||
// Fires when a removable storage device is inserted.
|
||||
static void onDeviceInserted(RemovableStorageDevice device);
|
||||
|
||||
// Fires when a removable storage device is removed.
|
||||
static void onDeviceRemoved(RemovableStorageDevice device);
|
||||
};
|
||||
|
||||
};
|
||||
+183
@@ -0,0 +1,183 @@
|
||||
// Copyright 2015 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.languageSettingsPrivate</code> API to get or change
|
||||
// language and input method settings.
|
||||
namespace languageSettingsPrivate {
|
||||
enum MoveType {
|
||||
TOP,
|
||||
UP,
|
||||
DOWN,
|
||||
UNKNOWN
|
||||
};
|
||||
|
||||
dictionary Language {
|
||||
// The unique code identifying the language.
|
||||
DOMString code;
|
||||
|
||||
// The name of the language, in the current UI language.
|
||||
DOMString displayName;
|
||||
|
||||
// The name of the language as it is in its own language.
|
||||
DOMString nativeDisplayName;
|
||||
|
||||
// Whether the UI can be displayed in this language. Defaults to false.
|
||||
boolean? supportsUI;
|
||||
|
||||
// Whether this language can be used for spell checking. Defaults to false.
|
||||
boolean? supportsSpellcheck;
|
||||
|
||||
// Whether this language has translations for the current target language.
|
||||
// Defaults to false.
|
||||
boolean? supportsTranslate;
|
||||
|
||||
// Whether this language is prohibited as a UI locale (not in the list of
|
||||
// the 'AllowedLanguages' policy). Defaults to false.
|
||||
boolean? isProhibitedLanguage;
|
||||
};
|
||||
|
||||
dictionary SpellcheckDictionaryStatus {
|
||||
// The language code of the dictionary that the status describes.
|
||||
DOMString languageCode;
|
||||
|
||||
// Whether the dictionary is ready (has been loaded from disk or
|
||||
// successfully downloaded).
|
||||
boolean isReady;
|
||||
|
||||
// Whether the dictionary is being downloaded. Defaults to false.
|
||||
boolean? isDownloading;
|
||||
|
||||
// Whether the dictionary download failed. Defaults to false.
|
||||
boolean? downloadFailed;
|
||||
};
|
||||
|
||||
dictionary InputMethod {
|
||||
// The ID of the input method descriptor.
|
||||
DOMString id;
|
||||
|
||||
// The human-readable name of the input method.
|
||||
DOMString displayName;
|
||||
|
||||
// The language codes this input method supports.
|
||||
DOMString[] languageCodes;
|
||||
|
||||
// The search terms for the input method.
|
||||
DOMString[] tags;
|
||||
|
||||
// True if the input method is enabled.
|
||||
boolean? enabled;
|
||||
|
||||
// True if the input method extension has an options page.
|
||||
boolean? hasOptionsPage;
|
||||
|
||||
// True if the input method is not allowed by policy.
|
||||
boolean? isProhibitedByPolicy;
|
||||
};
|
||||
|
||||
dictionary InputMethodLists {
|
||||
// The list of component extension input methods.
|
||||
InputMethod[] componentExtensionImes;
|
||||
|
||||
// The list of third-party extension input methods.
|
||||
InputMethod[] thirdPartyExtensionImes;
|
||||
};
|
||||
|
||||
callback GetLanguageListCallback = void (Language[] languages);
|
||||
callback GetAlwaysTranslateLanguagesCallback =
|
||||
void (DOMString[] languageCodes);
|
||||
callback GetNeverTranslateLanguagesCallback =
|
||||
void (DOMString[] languageCodes);
|
||||
callback GetInputMethodListsCallback = void (InputMethodLists lists);
|
||||
callback GetSpellcheckWordsCallback = void (DOMString[] words);
|
||||
callback GetTranslateTargetLanguageCallback = void (DOMString languageCode);
|
||||
callback GetSpellcheckDictionaryStatusesCallback =
|
||||
void (SpellcheckDictionaryStatus[] status);
|
||||
|
||||
interface Functions {
|
||||
// Gets languages available for translate, spell checking, input and locale.
|
||||
static void getLanguageList(
|
||||
GetLanguageListCallback callback);
|
||||
|
||||
// Enables a language, adding it to the Accept-Language list (used to decide
|
||||
// which languages to translate, generate the Accept-Language header, etc.).
|
||||
static void enableLanguage(DOMString languageCode);
|
||||
|
||||
// Disables a language, removing it from the Accept-Language list.
|
||||
static void disableLanguage(DOMString languageCode);
|
||||
|
||||
// Enables or disables translation for a given language.
|
||||
static void setEnableTranslationForLanguage(
|
||||
DOMString languageCode, boolean enable);
|
||||
|
||||
// Moves a language inside the language list.
|
||||
static void moveLanguage(DOMString languageCode, MoveType moveType);
|
||||
|
||||
// Gets languages that should always be automatically translated.
|
||||
static void getAlwaysTranslateLanguages(
|
||||
GetAlwaysTranslateLanguagesCallback callback);
|
||||
|
||||
// Sets whether a given language should always be automatically translated.
|
||||
static void setLanguageAlwaysTranslateState(
|
||||
DOMString languageCode, boolean alwaysTranslate);
|
||||
|
||||
// Gets languages that should never be offered to translate.
|
||||
static void getNeverTranslateLanguages(
|
||||
GetNeverTranslateLanguagesCallback callback);
|
||||
|
||||
// Gets the current status of the chosen spell check dictionaries.
|
||||
static void getSpellcheckDictionaryStatuses(
|
||||
GetSpellcheckDictionaryStatusesCallback callback);
|
||||
|
||||
// Gets the custom spell check words, in sorted order.
|
||||
static void getSpellcheckWords(
|
||||
GetSpellcheckWordsCallback callback);
|
||||
|
||||
// Adds a word to the custom dictionary.
|
||||
static void addSpellcheckWord(DOMString word);
|
||||
|
||||
// Removes a word from the custom dictionary.
|
||||
static void removeSpellcheckWord(DOMString word);
|
||||
|
||||
// Gets the translate target language (in most cases, the display locale).
|
||||
static void getTranslateTargetLanguage(
|
||||
GetTranslateTargetLanguageCallback callback);
|
||||
|
||||
// Sets the translate target language given a language code.
|
||||
static void setTranslateTargetLanguage(DOMString languageCode);
|
||||
|
||||
// Gets all supported input methods, including third-party IMEs.
|
||||
// Chrome OS only.
|
||||
static void getInputMethodLists(
|
||||
GetInputMethodListsCallback callback);
|
||||
|
||||
// Adds the input method to the current user's list of enabled input
|
||||
// methods, enabling the input method for the current user. Chrome OS only.
|
||||
static void addInputMethod(DOMString inputMethodId);
|
||||
|
||||
// Removes the input method from the current user's list of enabled input
|
||||
// methods, disabling the input method for the current user. Chrome OS only.
|
||||
static void removeInputMethod(DOMString inputMethodId);
|
||||
|
||||
// Tries to download the dictionary after a failed download.
|
||||
static void retryDownloadDictionary(DOMString languageCode);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Called when the pref for the dictionaries used for spell checking changes
|
||||
// or the status of one of the spell check dictionaries changes.
|
||||
static void onSpellcheckDictionariesChanged(
|
||||
SpellcheckDictionaryStatus[] statuses);
|
||||
|
||||
// Called when words are added to and/or removed from the custom spell check
|
||||
// dictionary.
|
||||
static void onCustomDictionaryChanged(
|
||||
DOMString[] wordsAdded, DOMString[] wordsRemoved);
|
||||
|
||||
// Called when an input method is added.
|
||||
static void onInputMethodAdded(DOMString inputMethodId);
|
||||
|
||||
// Called when an input method is removed.
|
||||
static void onInputMethodRemoved(DOMString inputMethodId);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,180 @@
|
||||
// Copyright 2019 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.login</code> API to launch and exit user sessions.
|
||||
[platforms=("chromeos", "lacros"),
|
||||
implemented_in="chrome/browser/chromeos/extensions/login_screen/login/login_api.h"]
|
||||
namespace login {
|
||||
callback VoidCallback = void ();
|
||||
callback StringCallback = void (DOMString result);
|
||||
dictionary SamlUserSessionProperties {
|
||||
// User's email address.
|
||||
DOMString email;
|
||||
|
||||
// User's Gaia ID.
|
||||
DOMString gaiaId;
|
||||
|
||||
// User's password.
|
||||
DOMString password;
|
||||
|
||||
// Oauth_code cookie set in the SAML handshake.
|
||||
DOMString oauthCode;
|
||||
};
|
||||
|
||||
interface Functions {
|
||||
// Launches a managed guest session if one is set up via the admin console.
|
||||
// If there are several managed guest sessions set up, it will launch the
|
||||
// first available one.
|
||||
// |password|: If provided, the launched managed guest session will be
|
||||
// lockable, and can only be unlocked by calling
|
||||
// $(ref:unlockManagedGuestSession) with the same password.
|
||||
// |callback|: Note: If the function succeeds, the callback is not
|
||||
// guaranteed to be invoked as the extension will be disabled when the
|
||||
// session starts. Use this callback only to handle the failure case by
|
||||
// checking $(ref:runtime.lastError).
|
||||
static void launchManagedGuestSession(
|
||||
optional DOMString password,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Exits the current session.
|
||||
// |dataForNextLoginAttempt|: If set, stores data which can be read by
|
||||
// $(ref:fetchDataForNextLoginAttempt) from the login screen. If unset, any
|
||||
// currently stored data will be cleared.
|
||||
static void exitCurrentSession(
|
||||
optional DOMString dataForNextLoginAttempt,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Reads the $(ref:dataForNextLoginAttempt) set by
|
||||
// $(ref:exitCurrentSession). Clears the previously stored data after
|
||||
// reading so it can only be read once.
|
||||
// |callback|: Called with the stored data, or an empty string if there was
|
||||
// no previously stored data.
|
||||
static void fetchDataForNextLoginAttempt(
|
||||
StringCallback callback);
|
||||
|
||||
// Deprecated. Please use $(ref:lockCurrentSession) instead.
|
||||
[deprecated="Use $(ref:lockCurrentSession) instead."]
|
||||
static void lockManagedGuestSession(optional VoidCallback callback);
|
||||
|
||||
// Locks the current session. The session has to be either a user session or
|
||||
// a Managed Guest Session launched by $(ref:launchManagedGuestSession) with
|
||||
// a password.
|
||||
static void lockCurrentSession(
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Deprecated. Please use $(ref:unlockCurrentSession) instead.
|
||||
[deprecated="Use $(ref:unlockCurrentSession) instead."]
|
||||
static void unlockManagedGuestSession(
|
||||
DOMString password,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Unlocks the current session. The session has to be either a user session
|
||||
// or a Managed Guest Session launched by $(ref:launchManagedGuestSession)
|
||||
// with a password. The session will unlock if the provided password matches
|
||||
// the one used to launch the session.
|
||||
// |password|: The password which will be used to unlock the session.
|
||||
// |callback|: Note: If the function succeeds, the callback is not
|
||||
// guaranteed to be invoked as the extension will be disabled when the
|
||||
// session starts. Use this callback only to handle the failure case by
|
||||
// checking $(ref:runtime.lastError).
|
||||
static void unlockCurrentSession(
|
||||
DOMString password,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Launches a SAML-backed user session.
|
||||
// |properties|: User's email address, gaia ID, password and oauth_code.
|
||||
// |callback|: Note: If the function succeeds, the callback is not
|
||||
// guaranteed to be invoked as the extension will be disabled when the
|
||||
// session starts. Use this callback only to handle the failure case by
|
||||
// checking $(ref:runtime.lastError).
|
||||
static void launchSamlUserSession(
|
||||
SamlUserSessionProperties properties,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Starts a ChromeOS Managed Guest Session which will host the shared user
|
||||
// sessions. An initial shared session is entered with |password| as the
|
||||
// password. When this shared session is locked, it can only be unlocked by
|
||||
// the same extension calling $(ref:unlockSharedSession) with the same
|
||||
// password.
|
||||
// Fails when another shared ChromeOS Managed Guest Session has already
|
||||
// been launched. Can only be called from the login screen.
|
||||
// |password|: The password which can be used to unlock the shared session.
|
||||
// |callback|: Note: If the function succeeds, the callback is not
|
||||
// guaranteed to be invoked as the extension will be disabled when the
|
||||
// session starts. Use this callback only to handle the failure case by
|
||||
// checking $(ref:runtime.lastError).
|
||||
static void launchSharedManagedGuestSession(
|
||||
DOMString password,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Enters the shared session with the given password. If the session is
|
||||
// locked, it can only be unlocked by calling $(ref:unlockSharedSession)
|
||||
// with the same password.
|
||||
// Fails if calling extension is not the same as the one which called
|
||||
// $(ref:launchSharedManagedGuestSession) or there is already a shared
|
||||
// session running. Can only be called from the lock screen.
|
||||
// |password|: The password which can be used to unlock the shared session.
|
||||
// |callback|: Note: If the function succeeds, the callback is not
|
||||
// guaranteed to be invoked as the extension will be disabled when the
|
||||
// session starts. Use this callback only to handle the failure case by
|
||||
// checking $(ref:runtime.lastError).
|
||||
static void enterSharedSession(
|
||||
DOMString password,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Unlocks the shared session with the provided password. Fails if the
|
||||
// password does not match the one provided to
|
||||
// $(ref:launchSharedManagedGuestSession) or $(ref:enterSharedSession).
|
||||
// Fails if the calling extension is not the same as the one which called
|
||||
// $(ref:launchSharedManagedGuestSession) or if there is no existing shared
|
||||
// session. Can only be called from the lock screen.
|
||||
// |password|: The password used to unlock the shared session.
|
||||
// |callback|: Note: If the function succeeds, the callback is not
|
||||
// guaranteed to be invoked as the extension will be disabled when the
|
||||
// session starts. Use this callback only to handle the failure case by
|
||||
// checking $(ref:runtime.lastError).
|
||||
static void unlockSharedSession(
|
||||
DOMString password,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Ends the shared session. Security- and privacy-sensitive data in the
|
||||
// session will be cleaned up on a best effort basis.
|
||||
// The calling extension does not have to be the same one which called
|
||||
// $(ref:launchSharedManagedGuestSession). Can be called from both the
|
||||
// lock screen or in session.
|
||||
// Fails if there is no existing shared session.
|
||||
// |callback|: Invoked after cleanup operations have finished and the
|
||||
// session is locked.
|
||||
static void endSharedSession(
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Sets data for the next login attempt. The data can be retrieved by
|
||||
// calling $(ref:fetchDataForNextLoginAttempt). The data is cleared when
|
||||
// it is fetched so it can only be read once.
|
||||
// |dataForNextLoginAttempt|: The data to be set.
|
||||
static void setDataForNextLoginAttempt(
|
||||
DOMString dataForNextLoginAttempt,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Dispatches a $(ref:onRequestExternalLogout) event. Called from the login
|
||||
// screen extension on the lock screen.
|
||||
static void requestExternalLogout(
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Dispatches a $(ref:onExternalLogoutDone) event. Called from the
|
||||
// in-session extension.
|
||||
static void notifyExternalLogoutDone(
|
||||
optional VoidCallback callback);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Event dispatched when an external logout is requested. The in-session
|
||||
// extension listens for this event.
|
||||
static void onRequestExternalLogout();
|
||||
|
||||
// Event dispatched when an external logout is completed. The login screen
|
||||
// extension on the lock screen listens for this event.
|
||||
static void onExternalLogoutDone();
|
||||
};
|
||||
};
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
// Copyright 2019 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.loginScreenStorage</code> API to store persistent data
|
||||
// from the login screen or inject data into the session.
|
||||
[platforms=("chromeos", "lacros"),
|
||||
implemented_in="chrome/browser/chromeos/extensions/login_screen/login_screen_storage/login_screen_storage_api.h"]
|
||||
namespace loginScreenStorage {
|
||||
callback StoreCallback = void ();
|
||||
callback RetrieveCallback = void (DOMString data);
|
||||
|
||||
interface Functions {
|
||||
// Stores persistent data from the login screen. This data can be accessed
|
||||
// later using $(ref:retrievePersistentData) by any extension from the
|
||||
// specified extension ids. This method will fail if called while a user
|
||||
// session is active.
|
||||
// |extensionIds|: IDs of the extensions that should have access to the
|
||||
// stored data.
|
||||
// |data|: The data to store.
|
||||
static void storePersistentData(
|
||||
DOMString[] extensionIds,
|
||||
DOMString data,
|
||||
StoreCallback callback);
|
||||
|
||||
// Retrieves persistent data that was previously stored using
|
||||
// $(ref:storePersistentData) for the caller's extension ID.
|
||||
// |ownerId|: ID of the extension that saved the data that the caller is
|
||||
// trying to retrieve.
|
||||
static void retrievePersistentData(
|
||||
DOMString ownerId,
|
||||
RetrieveCallback callback);
|
||||
|
||||
// Stores credentials for later access from the user session. This method
|
||||
// will fail if called while a user session is active.
|
||||
// |extensionId|: ID of the in-session extension that should have access to
|
||||
// these credentials. Credentials stored using this method are deleted on
|
||||
// session exit.
|
||||
// |credentials|: The credentials to store.
|
||||
static void storeCredentials(
|
||||
DOMString extensionId,
|
||||
DOMString credentials,
|
||||
StoreCallback callback);
|
||||
|
||||
// Retrieves credentials that were previosly stored using
|
||||
// $(ref:storeCredentials). The caller's extension ID should be the same as
|
||||
// the extension id passed to the $(ref:storeCredentials).
|
||||
static void retrieveCredentials(
|
||||
RetrieveCallback callback);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
// Copyright 2019 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.loginScreenUi</code> API to show and hide custom
|
||||
// login UI.
|
||||
[platforms=("chromeos"),
|
||||
implemented_in="chrome/browser/ash/extensions/login_screen_ui/login_screen_ui_api.h"]
|
||||
namespace loginScreenUi {
|
||||
|
||||
dictionary ShowOptions {
|
||||
// Relative url of the contents to show.
|
||||
DOMString url;
|
||||
|
||||
// Whether the user can close the window, defaults to false.
|
||||
boolean? userCanClose;
|
||||
};
|
||||
|
||||
// Callback that does not take arguments.
|
||||
callback SimpleCallback = void ();
|
||||
|
||||
interface Functions {
|
||||
// Opens a window, which is visible on top of the login and lock screen.
|
||||
// |options|: Options for the custom login UI window.
|
||||
static void show(
|
||||
ShowOptions options,
|
||||
optional SimpleCallback callback);
|
||||
|
||||
// Closes the login/lock screen UI window previously opened by this
|
||||
// extension.
|
||||
static void close(optional SimpleCallback callback);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,55 @@
|
||||
// Copyright 2019 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.loginState</code> API to read and monitor the login
|
||||
// state.
|
||||
[platforms=("chromeos", "lacros"),
|
||||
implemented_in="chrome/browser/chromeos/extensions/login_screen/login_state/login_state_api.h"]
|
||||
namespace loginState {
|
||||
enum ProfileType {
|
||||
// Specifies that the extension is in the signin profile.
|
||||
SIGNIN_PROFILE,
|
||||
|
||||
// Specifies that the extension is in the user profile.
|
||||
USER_PROFILE
|
||||
};
|
||||
|
||||
enum SessionState {
|
||||
// Specifies that the session state is unknown.
|
||||
UNKNOWN,
|
||||
|
||||
// Specifies that the user is in the out-of-box-experience screen.
|
||||
IN_OOBE_SCREEN,
|
||||
|
||||
// Specifies that the user is in the login screen.
|
||||
IN_LOGIN_SCREEN,
|
||||
|
||||
// Specifies that the user is in the session.
|
||||
IN_SESSION,
|
||||
|
||||
// Specifies that the user is in the lock screen.
|
||||
IN_LOCK_SCREEN,
|
||||
|
||||
// Specifies that the device is in RMA mode, finalizing repairs.
|
||||
IN_RMA_SCREEN
|
||||
};
|
||||
|
||||
callback ProfileTypeCallback = void (ProfileType result);
|
||||
callback SessionStateCallback = void (SessionState result);
|
||||
|
||||
interface Functions {
|
||||
// Gets the type of the profile the extension is in.
|
||||
static void getProfileType(ProfileTypeCallback callback);
|
||||
|
||||
// Gets the current session state.
|
||||
static void getSessionState(
|
||||
SessionStateCallback callback);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Dispatched when the session state changes. <code>sessionState</code>
|
||||
// is the new session state.
|
||||
static void onSessionStateChanged(SessionState sessionState);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,53 @@
|
||||
// Copyright 2013 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.mdns</code> API to discover services over mDNS.
|
||||
// This comprises a subset of the features of the NSD spec:
|
||||
// http://www.w3.org/TR/discovery-api/
|
||||
namespace mdns {
|
||||
|
||||
// Represents a mDNS/DNS-SD service.
|
||||
dictionary MDnsService {
|
||||
// The service name of an mDNS advertised service,
|
||||
// <instance_name>.<service_type>.
|
||||
DOMString serviceName;
|
||||
|
||||
// The host:port pair of an mDNS advertised service.
|
||||
DOMString serviceHostPort;
|
||||
|
||||
// The IP address of an mDNS advertised service.
|
||||
DOMString ipAddress;
|
||||
|
||||
// Metadata for an mDNS advertised service.
|
||||
DOMString[] serviceData;
|
||||
};
|
||||
|
||||
// Callback invoked after ForceDiscovery() has started.
|
||||
callback VoidCallback = void();
|
||||
|
||||
interface Functions {
|
||||
// Immediately issues a multicast DNS query for all service types.
|
||||
// |callback| is invoked immediately. At a later time, queries will be
|
||||
// sent, and any service events will be fired.
|
||||
static void forceDiscovery(VoidCallback callback);
|
||||
};
|
||||
|
||||
interface Properties {
|
||||
// The maximum number of service instances that will be included in
|
||||
// onServiceList events. If more instances are available, they may be
|
||||
// truncated from the onServiceList event.
|
||||
[value=2048] static long MAX_SERVICE_INSTANCES_PER_EVENT();
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Event fired to inform clients of the current complete set of known
|
||||
// available services. Clients should only need to store the list from the
|
||||
// most recent event. The service type that the extension is interested in
|
||||
// discovering should be specified as the event filter with the
|
||||
// 'serviceType' key. Not specifying an event filter will not start any
|
||||
// discovery listeners.
|
||||
[supportsFilters=true, maxListeners=10] static void onServiceList(
|
||||
MDnsService[] services);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,218 @@
|
||||
// Copyright 2013 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.notifications</code> API to create rich notifications
|
||||
// using templates and show these notifications to users in the system tray.
|
||||
namespace notifications {
|
||||
[noinline_doc] enum TemplateType {
|
||||
// Contains an icon, title, message, expandedMessage, and up to two
|
||||
// buttons.
|
||||
basic,
|
||||
|
||||
// Contains an icon, title, message, expandedMessage, image, and up
|
||||
// to two buttons.
|
||||
[deprecated="The image is not visible for Mac OS X users."]
|
||||
image,
|
||||
|
||||
// Contains an icon, title, message, items, and up to two buttons.
|
||||
// Users on Mac OS X only see the first item.
|
||||
list,
|
||||
|
||||
// Contains an icon, title, message, progress, and up to two buttons.
|
||||
progress
|
||||
};
|
||||
|
||||
enum PermissionLevel {
|
||||
// Specifies that the user has elected to show notifications
|
||||
// from the app or extension. This is the default at install time.
|
||||
granted,
|
||||
|
||||
// Specifies that the user has elected not to show notifications
|
||||
// from the app or extension.
|
||||
denied
|
||||
};
|
||||
|
||||
dictionary NotificationItem {
|
||||
// Title of one item of a list notification.
|
||||
DOMString title;
|
||||
|
||||
// Additional details about this item.
|
||||
DOMString message;
|
||||
};
|
||||
|
||||
[nodoc] dictionary NotificationBitmap {
|
||||
long width;
|
||||
long height;
|
||||
ArrayBuffer? data;
|
||||
};
|
||||
|
||||
dictionary NotificationButton {
|
||||
DOMString title;
|
||||
[deprecated="Button icons not visible for Mac OS X users."]
|
||||
DOMString? iconUrl;
|
||||
[nodoc] NotificationBitmap? iconBitmap;
|
||||
};
|
||||
|
||||
dictionary NotificationOptions {
|
||||
// Which type of notification to display.
|
||||
// <em>Required for $(ref:notifications.create)</em> method.
|
||||
TemplateType? type;
|
||||
|
||||
// A URL to the sender's avatar, app icon, or a thumbnail for image
|
||||
// notifications.
|
||||
//
|
||||
// URLs can be a data URL, a blob URL, or a URL relative to a resource
|
||||
// within this extension's .crx file
|
||||
// <aside class="note"><b>Note:</b>This value is required for the
|
||||
// $(ref:notifications.create)<code>()</code> method.</aside>
|
||||
DOMString? iconUrl;
|
||||
[nodoc] NotificationBitmap? iconBitmap;
|
||||
|
||||
// A URL to the app icon mask. URLs have the same restrictions as
|
||||
// $(ref:notifications.NotificationOptions.iconUrl iconUrl).
|
||||
//
|
||||
// The app icon mask should be in alpha channel, as only the alpha channel
|
||||
// of the image will be considered.
|
||||
[deprecated="The app icon mask is not visible for Mac OS X users."]
|
||||
DOMString? appIconMaskUrl;
|
||||
[nodoc] NotificationBitmap? appIconMaskBitmap;
|
||||
|
||||
// Title of the notification (e.g. sender name for email).
|
||||
// <aside class="note"><b>Note:</b>This value is required for the
|
||||
// $(ref:notifications.create)<code>()</code> method.</aside>
|
||||
DOMString? title;
|
||||
|
||||
// Main notification content.
|
||||
// <aside class="note"><b>Note:</b>This value is required for the
|
||||
// $(ref:notifications.create)<code>()</code> method.</aside>
|
||||
DOMString? message;
|
||||
|
||||
// Alternate notification content with a lower-weight font.
|
||||
DOMString? contextMessage;
|
||||
|
||||
// Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero
|
||||
// is default. On platforms that don't support a notification center
|
||||
// (Windows, Linux & Mac), -2 and -1 result in an error as notifications
|
||||
// with those priorities will not be shown at all.
|
||||
long? priority;
|
||||
|
||||
// A timestamp associated with the notification, in milliseconds past the
|
||||
// epoch (e.g. <code>Date.now() + n</code>).
|
||||
double? eventTime;
|
||||
|
||||
// Text and icons for up to two notification action buttons.
|
||||
NotificationButton[]? buttons;
|
||||
|
||||
// Secondary notification content.
|
||||
[nodoc] DOMString? expandedMessage;
|
||||
|
||||
// A URL to the image thumbnail for image-type notifications.
|
||||
// URLs have the same restrictions as
|
||||
// $(ref:notifications.NotificationOptions.iconUrl iconUrl).
|
||||
[deprecated="The image is not visible for Mac OS X users."]
|
||||
DOMString? imageUrl;
|
||||
[nodoc] NotificationBitmap? imageBitmap;
|
||||
|
||||
// Items for multi-item notifications. Users on Mac OS X only see the first
|
||||
// item.
|
||||
NotificationItem[]? items;
|
||||
|
||||
// Current progress ranges from 0 to 100.
|
||||
long? progress;
|
||||
|
||||
[deprecated="This UI hint is ignored as of Chrome 67"]
|
||||
boolean? isClickable;
|
||||
|
||||
// Indicates that the notification should remain visible on screen until the
|
||||
// user activates or dismisses the notification. This defaults to false.
|
||||
boolean? requireInteraction;
|
||||
|
||||
// Indicates that no sounds or vibrations should be made when the
|
||||
// notification is being shown. This defaults to false.
|
||||
boolean? silent;
|
||||
};
|
||||
|
||||
callback CreateCallback = void (DOMString notificationId);
|
||||
|
||||
callback UpdateCallback = void (boolean wasUpdated);
|
||||
|
||||
callback ClearCallback = void (boolean wasCleared);
|
||||
|
||||
callback GetAllCallback = void (object notifications);
|
||||
|
||||
callback PermissionLevelCallback = void (PermissionLevel level);
|
||||
|
||||
interface Functions {
|
||||
// Creates and displays a notification.
|
||||
// |notificationId|: Identifier of the notification. If not set or empty, an
|
||||
// ID will automatically be generated. If it matches an existing
|
||||
// notification, this method first clears that notification before
|
||||
// proceeding with the create operation. The identifier may not be longer
|
||||
// than 500 characters.
|
||||
//
|
||||
// The <code>notificationId</code> parameter is required before Chrome 42.
|
||||
// |options|: Contents of the notification.
|
||||
// |callback|: Returns the notification id (either supplied or generated)
|
||||
// that represents the created notification.
|
||||
//
|
||||
// The callback is required before Chrome 42.
|
||||
static void create(
|
||||
optional DOMString notificationId,
|
||||
NotificationOptions options,
|
||||
optional CreateCallback callback);
|
||||
|
||||
// Updates an existing notification.
|
||||
// |notificationId|: The id of the notification to be updated. This is
|
||||
// returned by $(ref:notifications.create) method.
|
||||
// |options|: Contents of the notification to update to.
|
||||
// |callback|: Called to indicate whether a matching notification existed.
|
||||
//
|
||||
// The callback is required before Chrome 42.
|
||||
static void update(
|
||||
DOMString notificationId,
|
||||
NotificationOptions options,
|
||||
optional UpdateCallback callback);
|
||||
|
||||
// Clears the specified notification.
|
||||
// |notificationId|: The id of the notification to be cleared. This is
|
||||
// returned by $(ref:notifications.create) method.
|
||||
// |callback|: Called to indicate whether a matching notification existed.
|
||||
//
|
||||
// The callback is required before Chrome 42.
|
||||
static void clear(
|
||||
DOMString notificationId,
|
||||
optional ClearCallback callback);
|
||||
|
||||
// Retrieves all the notifications of this app or extension.
|
||||
// |callback|: Returns the set of notification_ids currently in the system.
|
||||
static void getAll(GetAllCallback callback);
|
||||
|
||||
// Retrieves whether the user has enabled notifications from this app
|
||||
// or extension.
|
||||
// |callback|: Returns the current permission level.
|
||||
static void getPermissionLevel(
|
||||
PermissionLevelCallback callback);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// The notification closed, either by the system or by user action.
|
||||
static void onClosed(DOMString notificationId, boolean byUser);
|
||||
|
||||
// The user clicked in a non-button area of the notification.
|
||||
static void onClicked(DOMString notificationId);
|
||||
|
||||
// The user pressed a button in the notification.
|
||||
static void onButtonClicked(DOMString notificationId, long buttonIndex);
|
||||
|
||||
// The user changes the permission level. As of Chrome 47, only ChromeOS
|
||||
// has UI that dispatches this event.
|
||||
static void onPermissionLevelChanged(PermissionLevel level);
|
||||
|
||||
// The user clicked on a link for the app's notification settings. As of
|
||||
// Chrome 47, only ChromeOS has UI that dispatches this event.
|
||||
// As of Chrome 65, that UI has been removed from ChromeOS, too.
|
||||
[deprecated="Custom notification settings button is no longer supported."]
|
||||
static void onShowSettings();
|
||||
};
|
||||
};
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
// Copyright 2023 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.odfsConfigPrivate</code> API to configure the
|
||||
// Microsoft OneDrive integration.
|
||||
[implemented_in = "chrome/browser/chromeos/extensions/odfs_config_private/odfs_config_private_api.h",
|
||||
modernised_enums]
|
||||
namespace odfsConfigPrivate {
|
||||
|
||||
enum Mount {
|
||||
allowed,
|
||||
disallowed,
|
||||
automated
|
||||
};
|
||||
|
||||
dictionary MountInfo {
|
||||
Mount mode;
|
||||
};
|
||||
|
||||
dictionary AccountRestrictionsInfo {
|
||||
DOMString[] restrictions;
|
||||
};
|
||||
|
||||
callback GetMountCallback = void(MountInfo mount);
|
||||
callback GetAccountRestrictionsCallback = void(
|
||||
AccountRestrictionsInfo restrictions);
|
||||
callback ShowAutomatedMountErrorCallback = void();
|
||||
callback BoolCallback = void(boolean result);
|
||||
|
||||
interface Functions {
|
||||
// Returns the OneDrive mount mode from the admin policy.
|
||||
// |callback|: Invoked when the policy value was retrieved.
|
||||
static void getMount(
|
||||
GetMountCallback callback);
|
||||
|
||||
// Returns the OneDrive account restrictions from the admin policy.
|
||||
// |callback|: Invoked when the policy value was retrieved.
|
||||
static void getAccountRestrictions(
|
||||
GetAccountRestrictionsCallback callback);
|
||||
|
||||
// Shows a notification that the automated mount failed.
|
||||
static void showAutomatedMountError(
|
||||
ShowAutomatedMountErrorCallback callback);
|
||||
|
||||
// Returns whether the FileSystemProviderCloudFileSystem feature flag is
|
||||
// enabled.
|
||||
static void isCloudFileSystemEnabled(BoolCallback callback);
|
||||
|
||||
// Returns whether the FileSystemProviderContentCache feature flag is
|
||||
// enabled.
|
||||
static void isContentCacheEnabled(BoolCallback callback);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Fired when the OneDrive mount mode changed.
|
||||
// |event|: A OneDrive mount mode changed event.
|
||||
static void onMountChanged(MountInfo event);
|
||||
|
||||
// Fired when the OneDrive restrictions changed.
|
||||
// |event|: A OneDrive restrictions changed event.
|
||||
static void onAccountRestrictionsChanged(
|
||||
AccountRestrictionsInfo event);
|
||||
};
|
||||
|
||||
};
|
||||
+622
@@ -0,0 +1,622 @@
|
||||
// Copyright 2015 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.passwordsPrivate</code> API to add or remove password
|
||||
// data from the settings UI.
|
||||
namespace passwordsPrivate {
|
||||
// Possible reasons why a plaintext password was requested.
|
||||
enum PlaintextReason {
|
||||
// The user wants to view the password.
|
||||
VIEW,
|
||||
// The user wants to copy the password.
|
||||
COPY,
|
||||
// The user wants to edit the password.
|
||||
EDIT
|
||||
};
|
||||
|
||||
enum ExportProgressStatus {
|
||||
// No export was started.
|
||||
NOT_STARTED,
|
||||
// Data is being written to the destination.
|
||||
IN_PROGRESS,
|
||||
// Data has been written.
|
||||
SUCCEEDED,
|
||||
// The user rejected the file selection prompts.
|
||||
FAILED_CANCELLED,
|
||||
// Writing to the destination failed.
|
||||
FAILED_WRITE_FAILED
|
||||
};
|
||||
|
||||
enum CompromiseType {
|
||||
// If the credentials was leaked by a data breach.
|
||||
LEAKED,
|
||||
// If the credentials was reused on a phishing site.
|
||||
PHISHED,
|
||||
// If the credentials have a password which was reused by other credentials.
|
||||
REUSED,
|
||||
// If the credentials have a weak password.
|
||||
WEAK
|
||||
};
|
||||
|
||||
enum PasswordStoreSet {
|
||||
// Corresponds to profile-scoped password store.
|
||||
DEVICE,
|
||||
// Corresponds to Gaia-account-scoped password store (i.e. account store).
|
||||
ACCOUNT,
|
||||
// Corresponds to both profile-scoped and Gaia-account-scoped password
|
||||
// stores.
|
||||
DEVICE_AND_ACCOUNT
|
||||
};
|
||||
|
||||
enum PasswordCheckState {
|
||||
// idle state, e.g. after successfully running to completion.
|
||||
IDLE,
|
||||
// Running, following an explicit user action to start the check.
|
||||
RUNNING,
|
||||
// Canceled, entered when the user explicitly cancels a check.
|
||||
CANCELED,
|
||||
// Offline, the user is offline.
|
||||
OFFLINE,
|
||||
// The user is not signed into Chrome.
|
||||
SIGNED_OUT,
|
||||
// The user does not have any passwords saved.
|
||||
NO_PASSWORDS,
|
||||
// The user hit the quota limit.
|
||||
QUOTA_LIMIT,
|
||||
// Any other error state.
|
||||
OTHER_ERROR
|
||||
};
|
||||
|
||||
enum ImportResultsStatus {
|
||||
// Any other error state.
|
||||
UNKNOWN_ERROR,
|
||||
// Data was fully or partially imported.
|
||||
SUCCESS,
|
||||
// Failed to read provided file.
|
||||
IO_ERROR,
|
||||
// Header is missing, invalid or could not be read.
|
||||
BAD_FORMAT,
|
||||
// File selection dismissed.
|
||||
DISMISSED,
|
||||
// Size of the chosen file exceeds the limit.
|
||||
MAX_FILE_SIZE,
|
||||
// User has already started the import flow in a different window.
|
||||
IMPORT_ALREADY_ACTIVE,
|
||||
// User tried to import too many passwords from one file.
|
||||
NUM_PASSWORDS_EXCEEDED,
|
||||
// Conflicts found and they need to be resolved by the user.
|
||||
CONFLICTS
|
||||
};
|
||||
|
||||
enum ImportEntryStatus {
|
||||
// Any other error state.
|
||||
UNKNOWN_ERROR,
|
||||
// Missing password field.
|
||||
MISSING_PASSWORD,
|
||||
// Missing url field.
|
||||
MISSING_URL,
|
||||
// Bad url formatting.
|
||||
INVALID_URL,
|
||||
// URL contains non-ASCII chars.
|
||||
NON_ASCII_URL,
|
||||
// URL is too long.
|
||||
LONG_URL,
|
||||
// Password is too long.
|
||||
LONG_PASSWORD,
|
||||
// Username is too long.
|
||||
LONG_USERNAME,
|
||||
// Credential is already stored in profile store.
|
||||
CONFLICT_PROFILE,
|
||||
// Credential is already stored in account store.
|
||||
CONFLICT_ACCOUNT,
|
||||
// Note is too long.
|
||||
LONG_NOTE,
|
||||
// Concatenation of imported and local notes is too long.
|
||||
LONG_CONCATENATED_NOTE,
|
||||
// Valid credential.
|
||||
VALID
|
||||
};
|
||||
|
||||
enum FamilyFetchStatus {
|
||||
// Unknown or network error.
|
||||
UNKNOWN_ERROR,
|
||||
// No family members found.
|
||||
NO_MEMBERS,
|
||||
// At least one family member found.
|
||||
SUCCESS
|
||||
};
|
||||
|
||||
dictionary PublicKey {
|
||||
// The value of the public key.
|
||||
DOMString value;
|
||||
// The version of the public key.
|
||||
long version;
|
||||
};
|
||||
|
||||
dictionary RecipientInfo {
|
||||
// User ID of the recipient.
|
||||
DOMString userId;
|
||||
// Email of the recipient.
|
||||
DOMString email;
|
||||
// Name of the recipient.
|
||||
DOMString displayName;
|
||||
// Profile image URL of the recipient.
|
||||
DOMString profileImageUrl;
|
||||
// Whether the user can receive passwords.
|
||||
boolean isEligible;
|
||||
// The public key of the recipient.
|
||||
PublicKey? publicKey;
|
||||
};
|
||||
|
||||
dictionary FamilyFetchResults {
|
||||
// Status of the family members fetch.
|
||||
FamilyFetchStatus status;
|
||||
// List of family members.
|
||||
RecipientInfo[] familyMembers;
|
||||
};
|
||||
|
||||
dictionary ImportEntry {
|
||||
// The parsing status of individual row that represents
|
||||
// credential during import process.
|
||||
ImportEntryStatus status;
|
||||
// The url of the credential.
|
||||
DOMString url;
|
||||
// The username of the credential.
|
||||
DOMString username;
|
||||
// The password of the credential.
|
||||
DOMString password;
|
||||
// Unique identifier of the credential.
|
||||
long id;
|
||||
};
|
||||
|
||||
dictionary ImportResults {
|
||||
// General status of the triggered passwords import process.
|
||||
ImportResultsStatus status;
|
||||
// Number of successfully imported passwords.
|
||||
long numberImported;
|
||||
// Possibly emtpy, list of credentials that couldn't be imported.
|
||||
ImportEntry[] displayedEntries;
|
||||
// Name of file that user has chosen for the import.
|
||||
DOMString fileName;
|
||||
};
|
||||
|
||||
dictionary UrlCollection {
|
||||
// The signon realm of the credential.
|
||||
DOMString signonRealm;
|
||||
|
||||
// A human readable version of the URL of the credential's origin. For
|
||||
// android credentials this is usually App name.
|
||||
DOMString shown;
|
||||
|
||||
// The URL that will be linked to when an entry is clicked.
|
||||
DOMString link;
|
||||
};
|
||||
|
||||
// Information specific to compromised credentials.
|
||||
dictionary CompromisedInfo {
|
||||
// The timestamp of when this credential was determined to be compromised.
|
||||
// Specified in milliseconds since the UNIX epoch. Intended to be passed to
|
||||
// the JavaScript Date() constructor.
|
||||
double compromiseTime;
|
||||
|
||||
// The elapsed time since this credential was determined to be compromised.
|
||||
// This is passed as an already formatted string, since JavaScript lacks the
|
||||
// required formatting APIs. Example: "5 minutes ago"
|
||||
DOMString elapsedTimeSinceCompromise;
|
||||
|
||||
// The types of credential issues.
|
||||
CompromiseType[] compromiseTypes;
|
||||
|
||||
// Indicates whether this credential is muted.
|
||||
boolean isMuted;
|
||||
};
|
||||
|
||||
// Structure which hold required information to display a link.
|
||||
dictionary DomainInfo {
|
||||
// A human readable version of the URL of the credential's origin. For
|
||||
// android credentials this is usually the app name.
|
||||
DOMString name;
|
||||
|
||||
// The URL that will be linked to when an entry is clicked.
|
||||
DOMString url;
|
||||
|
||||
// The signon_realm of corresponding PasswordForm.
|
||||
DOMString signonRealm;
|
||||
};
|
||||
|
||||
// Entry used to display a password in the settings UI.
|
||||
dictionary PasswordUiEntry {
|
||||
// The URL collection corresponding to this saved password entry.
|
||||
DomainInfo[] affiliatedDomains;
|
||||
|
||||
// The username used in conjunction with the saved password.
|
||||
DOMString username;
|
||||
|
||||
// If this is a passkey, the user's display name. Empty otherwise.
|
||||
DOMString? displayName;
|
||||
|
||||
// The password of the credential. Empty by default, only set if explicitly
|
||||
// requested.
|
||||
DOMString? password;
|
||||
|
||||
// Text shown if the password was obtained via a federated identity.
|
||||
DOMString? federationText;
|
||||
|
||||
// An index to refer back to a unique password entry record.
|
||||
long id;
|
||||
|
||||
// Corresponds to where the credential is stored.
|
||||
PasswordStoreSet storedIn;
|
||||
|
||||
// Indicates whether this credential is a passkey.
|
||||
boolean isPasskey;
|
||||
|
||||
// The value of the attached note.
|
||||
DOMString? note;
|
||||
|
||||
// The URL where the insecure password can be changed. Might be not set for
|
||||
// Android apps.
|
||||
DOMString? changePasswordUrl;
|
||||
|
||||
// Additional information in case a credential is compromised.
|
||||
CompromisedInfo? compromisedInfo;
|
||||
|
||||
// The timestamp of when this credential was created, or undefined if not a
|
||||
// passkey. Specified in milliseconds since the UNIX epoch. Intended to be
|
||||
// passed to the JavaScript Date() constructor.
|
||||
double? creationTime;
|
||||
};
|
||||
|
||||
// Group representing affiliated PasswordUiEntries.
|
||||
dictionary CredentialGroup {
|
||||
// Group name being displayed.
|
||||
DOMString name;
|
||||
|
||||
// Icon url for the given group.
|
||||
DOMString iconUrl;
|
||||
|
||||
// Entries in the group.
|
||||
PasswordUiEntry[] entries;
|
||||
};
|
||||
|
||||
dictionary ExceptionEntry {
|
||||
// The URL collection corresponding to this exception entry.
|
||||
UrlCollection urls;
|
||||
|
||||
// An id to refer back to a unique exception entry record.
|
||||
long id;
|
||||
};
|
||||
|
||||
dictionary PasswordExportProgress {
|
||||
// The current status of the export task.
|
||||
ExportProgressStatus status;
|
||||
|
||||
// If |status| is $ref(ExportProgressStatus.SUCCEEDED), this will
|
||||
// be the full path of the written file.
|
||||
DOMString? filePath;
|
||||
|
||||
// If |status| is $ref(ExportProgressStatus.FAILED_WRITE_FAILED), this will
|
||||
// be the name of the selected folder to export to.
|
||||
DOMString? folderName;
|
||||
};
|
||||
|
||||
// Object describing the current state of the password check. The check could
|
||||
// be in any of the above described states.
|
||||
dictionary PasswordCheckStatus {
|
||||
// The state of the password check.
|
||||
PasswordCheckState state;
|
||||
|
||||
// Total number of saved passwords.
|
||||
long? totalNumberOfPasswords;
|
||||
|
||||
// How many passwords have already been processed. Populated if and only if
|
||||
// the password check is currently running.
|
||||
long? alreadyProcessed;
|
||||
|
||||
// How many passwords are remaining in the queue. Populated if and only if
|
||||
// the password check is currently running.
|
||||
long? remainingInQueue;
|
||||
|
||||
// The elapsed time since the last full password check was performed. This
|
||||
// is passed as a string, since JavaScript lacks the required formatting
|
||||
// APIs. If no check has been performed yet this is not set.
|
||||
DOMString? elapsedTimeSinceLastCheck;
|
||||
};
|
||||
|
||||
// Object describing a password entry to be saved and storage to be used.
|
||||
dictionary AddPasswordOptions {
|
||||
// The url to save the password for.
|
||||
DOMString url;
|
||||
|
||||
// The username to save the password for.
|
||||
DOMString username;
|
||||
|
||||
// The password value to be saved.
|
||||
DOMString password;
|
||||
|
||||
// The note attached the password.
|
||||
DOMString note;
|
||||
|
||||
// True for account store, false for device store.
|
||||
boolean useAccountStore;
|
||||
};
|
||||
|
||||
// An object holding an array of PasswordUiEntries.
|
||||
dictionary PasswordUiEntryList {
|
||||
PasswordUiEntry[] entries;
|
||||
};
|
||||
|
||||
callback PlaintextPasswordCallback = void(DOMString password);
|
||||
callback PasswordListCallback = void(PasswordUiEntry[] entries);
|
||||
callback CredentialsGroupCallback = void(CredentialGroup[] entries);
|
||||
callback ExceptionListCallback = void(ExceptionEntry[] exceptions);
|
||||
callback ExportProgressStatusCallback = void(ExportProgressStatus status);
|
||||
callback VoidCallback = void();
|
||||
callback OptInCallback = void(boolean optedIn);
|
||||
callback PasswordCheckStatusCallback = void(PasswordCheckStatus status);
|
||||
callback ImportPasswordsCallback = void(ImportResults results);
|
||||
callback FetchFamilyResultsCallback = void(FamilyFetchResults results);
|
||||
callback IsAccountStoreDefaultCallback = void(boolean isDefault);
|
||||
callback GetUrlCollectionCallback = void(UrlCollection urlCollection);
|
||||
callback CredentialsWithReusedPasswordCallback =
|
||||
void(PasswordUiEntryList[] entries);
|
||||
callback PasswordManagerPinAvailableCallback = void(boolean available);
|
||||
callback PasswordManagerPinChangedCallback = void(boolean success);
|
||||
callback DisconnectCloudAuthenticatorCallback = void(boolean success);
|
||||
callback IsConnectedToCloudAuthenticatorCallback = void(boolean connected);
|
||||
callback DeleteAllPasswordManagerDataCallback = void(boolean success);
|
||||
callback AuthenticationResultCallback = void(boolean result);
|
||||
|
||||
interface Functions {
|
||||
// Function that logs that the Passwords page was accessed from the Chrome
|
||||
// Settings WebUI.
|
||||
static void recordPasswordsPageAccessInSettings();
|
||||
|
||||
// Changes the credential. Not all attributes can be updated.
|
||||
// Optional attributes that are not set will be unchanged.
|
||||
// Returns a promise that resolves if successful, and rejects otherwise.
|
||||
// |credential|: The credential to update. This will be matched to the
|
||||
// existing credential by id.
|
||||
static void changeCredential(
|
||||
PasswordUiEntry credential,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Removes the credential corresponding to |id| in |fromStores|. If no
|
||||
// credential for this pair exists, this function is a no-op.
|
||||
// |id|: The id for the credential being removed.
|
||||
// |fromStores|: The store(s) from which the credential is being removed.
|
||||
static void removeCredential(long id, PasswordStoreSet fromStores);
|
||||
|
||||
// Removes the saved password exception corresponding to |id|. If
|
||||
// no exception with this id exists, this function is a no-op. This will
|
||||
// remove exception from both stores.
|
||||
// |id|: The id for the exception url entry is being removed.
|
||||
static void removePasswordException(long id);
|
||||
|
||||
// Undoes the last removal of saved password(s) or exception(s).
|
||||
static void undoRemoveSavedPasswordOrException();
|
||||
|
||||
// Returns the plaintext password corresponding to |id|. Note that on
|
||||
// some operating systems, this call may result in an OS-level
|
||||
// reauthentication. Once the password has been fetched, it will be returned
|
||||
// via |callback|.
|
||||
// |id|: The id for the password entry being being retrieved.
|
||||
// |reason|: The reason why the plaintext password is requested.
|
||||
// |callback|: The callback that gets invoked with the retrieved password.
|
||||
static void requestPlaintextPassword(
|
||||
long id,
|
||||
PlaintextReason reason,
|
||||
PlaintextPasswordCallback callback);
|
||||
|
||||
// Returns the PasswordUiEntries (with |password|, |note| field filled) corresponding
|
||||
// to |ids|. Note that on some operating systems, this call may result in an
|
||||
// OS-level reauthentication. Once the PasswordUiEntry has been fetched, it
|
||||
// will be returned via |callback|.
|
||||
// |ids|: Ids for the password entries being retrieved.
|
||||
// |callback|: The callback that gets invoked with the retrieved
|
||||
// PasswordUiEntries.
|
||||
static void requestCredentialsDetails(
|
||||
long[] ids,
|
||||
PasswordListCallback callback);
|
||||
|
||||
// Returns the list of saved passwords.
|
||||
// |callback|: Called with the list of saved passwords.
|
||||
static void getSavedPasswordList(
|
||||
PasswordListCallback callback);
|
||||
|
||||
// Returns the list of Credential groups.
|
||||
// |callback|: Called with the list of groups.
|
||||
static void getCredentialGroups(CredentialsGroupCallback callback);
|
||||
|
||||
// Returns the list of password exceptions.
|
||||
// |callback|: Called with the list of password exceptions.
|
||||
static void getPasswordExceptionList(
|
||||
ExceptionListCallback callback);
|
||||
|
||||
// Moves passwords currently stored on the device to being stored in the
|
||||
// signed-in, non-syncing Google Account. For each id, the result is a
|
||||
// no-op if any of these is true: |id| is invalid; |id| corresponds to a
|
||||
// password already stored in the account; or the user is not using the
|
||||
// account-scoped password storage.
|
||||
// |ids|: The ids for the password entries being moved.
|
||||
static void movePasswordsToAccount(long[] ids);
|
||||
|
||||
// Fetches family members (password share recipients).
|
||||
static void fetchFamilyMembers(
|
||||
FetchFamilyResultsCallback callback);
|
||||
|
||||
// Sends sharing invitations to the recipients.
|
||||
// |id|: The id of the password entry to be shared.
|
||||
// |recipients|: The list of selected recipients.
|
||||
// |callback|: The callback that gets invoked on success.
|
||||
static void sharePassword(
|
||||
long id,
|
||||
RecipientInfo[] recipients,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Triggers the Password Manager password import functionality.
|
||||
static void importPasswords(
|
||||
PasswordStoreSet toStore,
|
||||
ImportPasswordsCallback callback);
|
||||
|
||||
// Resumes the password import process when user has selected which
|
||||
// passwords to replace.
|
||||
// |selectedIds|: The ids of passwords that need to be replaced.
|
||||
static void continueImport(
|
||||
long[] selectedIds,
|
||||
ImportPasswordsCallback callback);
|
||||
|
||||
// Resets the PasswordImporter if it is in the CONFLICTS/FINISHED state
|
||||
// and the user closes the dialog. Only when the PasswordImporter is in
|
||||
// FINISHED state, |deleteFile| option is taken into account.
|
||||
// |deleteFile|: Whether to trigger deletion of the last imported file.
|
||||
static void resetImporter(
|
||||
boolean deleteFile,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Triggers the Password Manager password export functionality. Completion
|
||||
// Will be signaled by the onPasswordsFileExportProgress event.
|
||||
// |callback| will be called when the request is started or rejected. If
|
||||
// rejected $(ref:runtime.lastError) will be set to
|
||||
// <code>'in-progress'</code> or <code>'reauth-failed'</code>.
|
||||
static void exportPasswords(VoidCallback callback);
|
||||
|
||||
// Requests the export progress status. This is the same as the last value
|
||||
// seen on the onPasswordsFileExportProgress event. This function is useful
|
||||
// for checking if an export has already been initiated from an older tab,
|
||||
// where we might have missed the original event.
|
||||
static void requestExportProgressStatus(
|
||||
ExportProgressStatusCallback callback);
|
||||
|
||||
// Requests the account-storage opt-in state of the current user.
|
||||
static void isOptedInForAccountStorage(
|
||||
OptInCallback callback);
|
||||
|
||||
// Triggers the opt-in or opt-out flow for the account storage.
|
||||
static void optInForAccountStorage(boolean optIn);
|
||||
|
||||
// Requests the latest insecure credentials.
|
||||
static void getInsecureCredentials(
|
||||
PasswordListCallback callback);
|
||||
|
||||
// Requests group of credentials which reuse passwords. Each group contains
|
||||
// credentials with the same password value.
|
||||
static void getCredentialsWithReusedPassword(
|
||||
CredentialsWithReusedPasswordCallback callback);
|
||||
|
||||
// Requests to mute |credential| from the password store.
|
||||
// Invokes |callback| on completion.
|
||||
static void muteInsecureCredential(
|
||||
PasswordUiEntry credential, optional VoidCallback callback);
|
||||
|
||||
// Requests to unmute |credential| from the password store.
|
||||
// Invokes |callback| on completion.
|
||||
static void unmuteInsecureCredential(
|
||||
PasswordUiEntry credential, optional VoidCallback callback);
|
||||
|
||||
// Starts a check for insecure passwords. Invokes |callback| on completion.
|
||||
static void startPasswordCheck(
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Returns the current status of the check via |callback|.
|
||||
static void getPasswordCheckStatus(
|
||||
PasswordCheckStatusCallback callback);
|
||||
|
||||
// Requests whether the account store is a default location for saving
|
||||
// passwords. False means the device store is a default one. Must be called
|
||||
// when the current user has already opted-in for account storage.
|
||||
static void isAccountStoreDefault(
|
||||
IsAccountStoreDefaultCallback callback);
|
||||
|
||||
// Requests whether the given |url| meets the requirements to save a
|
||||
// password for it (e.g. valid, has proper scheme etc.) and returns the
|
||||
// corresponding URLCollection on success. Otherwise it raises an error.
|
||||
static void getUrlCollection(
|
||||
DOMString url,
|
||||
GetUrlCollectionCallback callback);
|
||||
|
||||
// Saves a new password entry described by the given |options|. Invokes
|
||||
// |callback| or raises an error depending on whether the operation
|
||||
// succeeded.
|
||||
// |options|: Details about a new password and storage to be used.
|
||||
// |callback|: The callback that gets invoked on success.
|
||||
static void addPassword(
|
||||
AddPasswordOptions options,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Restarts the authentication timeout timer if the user is authenticated.
|
||||
// |callback|: The callback that gets invoked on success.
|
||||
static void extendAuthValidity(
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Switches Biometric authentication before filling state after
|
||||
// successful authentication.
|
||||
// |callback|: The callback that gets invoked with the authentication
|
||||
// result.
|
||||
[platforms = ("win", "mac")] static void
|
||||
switchBiometricAuthBeforeFillingState(
|
||||
AuthenticationResultCallback callback);
|
||||
|
||||
// Shows a dialog for creating a shortcut for the Password Manager page.
|
||||
static void showAddShortcutDialog();
|
||||
|
||||
// Opens a file with exported passwords in the OS shell.
|
||||
static void showExportedFileInShell(DOMString file_path);
|
||||
|
||||
// Shows a dialog for changing the Password Manager PIN.
|
||||
static void changePasswordManagerPin(
|
||||
optional PasswordManagerPinChangedCallback callback);
|
||||
|
||||
// Checks whether changing Password Manager PIN is possible.
|
||||
static void isPasswordManagerPinAvailable(
|
||||
PasswordManagerPinAvailableCallback callback);
|
||||
|
||||
// Disconnects the Chrome client from the cloud authenticator.
|
||||
static void disconnectCloudAuthenticator(
|
||||
DisconnectCloudAuthenticatorCallback callback);
|
||||
|
||||
// Checks whether the Chrome client is registered with/connected to
|
||||
// the cloud authenticator.
|
||||
static void isConnectedToCloudAuthenticator(
|
||||
IsConnectedToCloudAuthenticatorCallback callback);
|
||||
|
||||
// Deletes all password manager data (passwords, passkeys, etc.)
|
||||
// |callback|: The callback that gets invoked with true on successful
|
||||
// deletion and false on failure (e.g. not all data was deleted).
|
||||
static void deleteAllPasswordManagerData(
|
||||
DeleteAllPasswordManagerDataCallback callback);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Fired when the saved passwords list has changed, meaning that an entry
|
||||
// has been added or removed.
|
||||
// |entries|: The updated list of password entries.
|
||||
static void onSavedPasswordsListChanged(PasswordUiEntry[] entries);
|
||||
|
||||
// Fired when the password exceptions list has changed, meaning that an
|
||||
// entry has been added or removed.
|
||||
// |exceptions|: The updated list of password exceptions.
|
||||
static void onPasswordExceptionsListChanged(ExceptionEntry[] exceptions);
|
||||
|
||||
// Fired when the status of the export has changed.
|
||||
// |status|: The progress status and an optional UI message.
|
||||
static void onPasswordsFileExportProgress(PasswordExportProgress status);
|
||||
|
||||
// Fired when the opt-in state for the account-scoped storage has changed.
|
||||
// |optedIn|: The new opt-in state.
|
||||
static void onAccountStorageOptInStateChanged(boolean optedIn);
|
||||
|
||||
// Fired when the insecure credentials changed.
|
||||
// |insecureCredentials|: The updated insecure credentials.
|
||||
static void onInsecureCredentialsChanged(
|
||||
PasswordUiEntry[] insecureCredentials);
|
||||
|
||||
// Fired when the status of the password check changes.
|
||||
// |status|: The updated status of the password check.
|
||||
static void onPasswordCheckStatusChanged(PasswordCheckStatus status);
|
||||
|
||||
// Fired when the password manager access timed out.
|
||||
static void onPasswordManagerAuthTimeout();
|
||||
};
|
||||
};
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
// 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.
|
||||
|
||||
// Use the <code>chrome.pdfViewerPrivate</code> API for specific browser
|
||||
// functionality that the PDF Viewer needs from outside the PDF plugin. This API
|
||||
// is exclusively for the PDF Viewer.
|
||||
namespace pdfViewerPrivate {
|
||||
// Nearly identical to mimeHandlerPrivate.StreamInfo, but without a mime type
|
||||
// nor a response header field. Those fields are unused by the PDF viewer.
|
||||
dictionary StreamInfo {
|
||||
// The original URL that was intercepted.
|
||||
DOMString originalUrl;
|
||||
|
||||
// The URL that the stream can be read from.
|
||||
DOMString streamUrl;
|
||||
|
||||
// The ID of the tab that opened the stream. If the stream is not opened in
|
||||
// a tab, it will be -1.
|
||||
long tabId;
|
||||
|
||||
// Whether the stream is embedded within another document.
|
||||
boolean embedded;
|
||||
};
|
||||
|
||||
// Identical to mimeHandlerPrivate.StreamInfo.
|
||||
dictionary PdfPluginAttributes {
|
||||
// The background color in ARGB format for painting. Since the background
|
||||
// color is an unsigned 32-bit integer which can be outside the range of
|
||||
// "long" type, define it as a "double" type here.
|
||||
double backgroundColor;
|
||||
|
||||
// Indicates whether the plugin allows to execute JavaScript and maybe XFA.
|
||||
// Loading XFA for PDF forms will automatically be disabled if this flag is
|
||||
// false.
|
||||
boolean allowJavascript;
|
||||
};
|
||||
|
||||
callback GetStreamInfoCallback = void(StreamInfo streamInfo);
|
||||
callback IsAllowedLocalFileAccessCallback = void(boolean result);
|
||||
callback VoidCallback = void();
|
||||
|
||||
interface Functions {
|
||||
// Returns the StreamInfo for the stream for this context if there is one.
|
||||
static void getStreamInfo(
|
||||
GetStreamInfoCallback callback);
|
||||
|
||||
// Determines if the given URL should be allowed to access local files from
|
||||
// the PDF Viewer. |callback|: Called with true if URL should be allowed to
|
||||
// access local files from the PDF Viewer, false otherwise.
|
||||
static void isAllowedLocalFileAccess(
|
||||
DOMString url,
|
||||
IsAllowedLocalFileAccessCallback callback);
|
||||
|
||||
// Sets the current tab title to `title` for a full-page PDF.
|
||||
static void setPdfDocumentTitle(
|
||||
DOMString title,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Sets PDF plugin attributes in the stream for this context if there is
|
||||
// one.
|
||||
static void setPdfPluginAttributes(
|
||||
PdfPluginAttributes attributes,
|
||||
optional VoidCallback callback);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Fired when the browser wants the listener to perform a save.
|
||||
// `streamUrl`: Unique ID for the instance that should perform the save.
|
||||
static void onSave(DOMString streamUrl);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,185 @@
|
||||
// Copyright 2015 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.platformKeys</code> API to access client certificates
|
||||
// managed by the platform. If the user or policy grants the permission, an
|
||||
// extension can use such a certficate in its custom authentication protocol.
|
||||
// E.g. this allows usage of platform managed certificates in third party VPNs
|
||||
// (see $(ref:vpnProvider chrome.vpnProvider)).
|
||||
namespace platformKeys {
|
||||
[noinline_doc] dictionary Match {
|
||||
// The DER encoding of a X.509 certificate.
|
||||
ArrayBuffer certificate;
|
||||
|
||||
// The
|
||||
// <a href="http://www.w3.org/TR/WebCryptoAPI/#key-algorithm-dictionary">
|
||||
// KeyAlgorithm</a> of the certified key. This contains algorithm
|
||||
// parameters that are inherent to the key of the certificate (e.g. the key
|
||||
// length). Other parameters like the hash function used by the sign
|
||||
// function are not included.
|
||||
object keyAlgorithm;
|
||||
};
|
||||
|
||||
enum ClientCertificateType {
|
||||
rsaSign,
|
||||
ecdsaSign
|
||||
};
|
||||
|
||||
// Analogous to TLS1.1's CertificateRequest.
|
||||
// See http://tools.ietf.org/html/rfc4346#section-7.4.4 .
|
||||
dictionary ClientCertificateRequest {
|
||||
// This field is a list of the types of certificates requested, sorted in
|
||||
// order of the server's preference. Only certificates of a type contained
|
||||
// in this list will be retrieved. If <code>certificateTypes</code> is the
|
||||
// empty list, however, certificates of any type will be returned.
|
||||
ClientCertificateType[] certificateTypes;
|
||||
|
||||
// List of distinguished names of certificate authorities allowed by the
|
||||
// server. Each entry must be a DER-encoded X.509 DistinguishedName.
|
||||
ArrayBuffer[] certificateAuthorities;
|
||||
};
|
||||
|
||||
dictionary SelectDetails {
|
||||
// Only certificates that match this request will be returned.
|
||||
ClientCertificateRequest request;
|
||||
|
||||
// If given, the <code>selectClientCertificates</code> operates on this
|
||||
// list. Otherwise, obtains the list of all certificates from the platform's
|
||||
// certificate stores that are available to this extensions.
|
||||
// Entries that the extension doesn't have permission for or which doesn't
|
||||
// match the request, are removed.
|
||||
ArrayBuffer[]? clientCerts;
|
||||
|
||||
// If true, the filtered list is presented to the user to manually select a
|
||||
// certificate and thereby granting the extension access to the
|
||||
// certificate(s) and key(s). Only the selected certificate(s) will be
|
||||
// returned. If is false, the list is reduced to all certificates that the
|
||||
// extension has been granted access to (automatically or manually).
|
||||
boolean interactive;
|
||||
};
|
||||
|
||||
dictionary VerificationDetails {
|
||||
// Each chain entry must be the DER encoding of a X.509 certificate, the
|
||||
// first entry must be the server certificate and each entry must certify
|
||||
// the entry preceding it.
|
||||
ArrayBuffer[] serverCertificateChain;
|
||||
|
||||
// The hostname of the server to verify the certificate for, e.g. the server
|
||||
// that presented the <code>serverCertificateChain</code>.
|
||||
DOMString hostname;
|
||||
};
|
||||
|
||||
dictionary VerificationResult {
|
||||
// The result of the trust verification: true if trust for the given
|
||||
// verification details could be established and false if trust is rejected
|
||||
// for any reason.
|
||||
boolean trusted;
|
||||
|
||||
// If the trust verification failed, this array contains the errors reported
|
||||
// by the underlying network layer. Otherwise, this array is empty.
|
||||
//
|
||||
// <strong>Note:</strong> This list is meant for debugging only and may not
|
||||
// contain all relevant errors. The errors returned may change in future
|
||||
// revisions of this API, and are not guaranteed to be forwards or backwards
|
||||
// compatible.
|
||||
DOMString[] debug_errors;
|
||||
};
|
||||
|
||||
// |matches|: The list of certificates that match the request, that the
|
||||
// extension has permission for and, if <code>interactive</code> is true, that
|
||||
// were selected by the user.
|
||||
callback SelectCallback = void (Match[] matches);
|
||||
|
||||
// The public and private
|
||||
// <a href="http://www.w3.org/TR/WebCryptoAPI/#dfn-CryptoKey">CryptoKey</a>
|
||||
// of a certificate which can only be used with
|
||||
// $(ref:platformKeys.subtleCrypto).
|
||||
// |privateKey|: Might be <code>null</code> if this extension does not have
|
||||
// access to it.
|
||||
callback GetKeyPairCallback = void (object publicKey,
|
||||
optional object privateKey);
|
||||
|
||||
callback VerificationCallback = void (VerificationResult result);
|
||||
|
||||
interface Functions {
|
||||
// This method filters from a list of client certificates the ones that
|
||||
// are known to the platform, match <code>request</code> and for which the
|
||||
// extension has permission to access the certificate and its private key.
|
||||
// If <code>interactive</code> is true, the user is presented a dialog where
|
||||
// they can select from matching certificates and grant the extension access
|
||||
// to the certificate.
|
||||
// The selected/filtered client certificates will be passed to
|
||||
// <code>callback</code>.
|
||||
[nocompile] static void selectClientCertificates(
|
||||
SelectDetails details,
|
||||
SelectCallback callback);
|
||||
|
||||
// Passes the key pair of <code>certificate</code> for usage with
|
||||
// $(ref:platformKeys.subtleCrypto) to <code>callback</code>.
|
||||
// |certificate|: The certificate of a $(ref:Match) returned by
|
||||
// $(ref:selectClientCertificates).
|
||||
// |parameters|: Determines signature/hash algorithm parameters additionally
|
||||
// to the parameters fixed by the key itself. The same parameters are
|
||||
// accepted as by WebCrypto's <a
|
||||
// href="http://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-importKey">importKey</a>
|
||||
// function, e.g. <code>RsaHashedImportParams</code> for a RSASSA-PKCS1-v1_5
|
||||
// key and <code>EcKeyImportParams</code> for EC key.
|
||||
// Additionally for RSASSA-PKCS1-v1_5 keys, hashing algorithm name parameter
|
||||
// can be specified with one of the following values: "none", "SHA-1",
|
||||
// "SHA-256", "SHA-384", or "SHA-512", e.g.
|
||||
// <code>{"hash": { "name": "none" } }</code>. The sign function will then
|
||||
// apply PKCS#1 v1.5 padding but not hash the given data.
|
||||
// <p>Currently, this method only supports the "RSASSA-PKCS1-v1_5" and
|
||||
// "ECDSA" algorithms.</p>
|
||||
[nocompile, doesNotSupportPromises=
|
||||
"Multi-parameter callback crbug.com/1313625"]
|
||||
static void getKeyPair(ArrayBuffer certificate,
|
||||
object parameters,
|
||||
GetKeyPairCallback callback);
|
||||
|
||||
// Passes the key pair identified by <code>publicKeySpkiDer</code> for
|
||||
// usage with $(ref:platformKeys.subtleCrypto) to <code>callback</code>.
|
||||
// |publicKeySpkiDer|: A DER-encoded X.509 SubjectPublicKeyInfo, obtained
|
||||
// e.g. by calling WebCrypto's exportKey function with format="spki".
|
||||
// |parameters|: Provides signature and hash algorithm parameters, in
|
||||
// addition to those fixed by the key itself. The same parameters are
|
||||
// accepted as by WebCrypto's <a
|
||||
// href="http://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-importKey">importKey</a>
|
||||
// function, e.g. <code>RsaHashedImportParams</code> for a RSASSA-PKCS1-v1_5
|
||||
// key. For RSASSA-PKCS1-v1_5 keys, we need to also pass a "hash" parameter
|
||||
// <code>{ "hash": { "name": string } }</code>. The "hash" parameter
|
||||
// represents the name of the hashing algorithm to be used in the digest
|
||||
// operation before a sign. It is possible to pass "none" as the hash name,
|
||||
// in which case the sign function will apply PKCS#1 v1.5 padding and but
|
||||
// not hash the given data.
|
||||
// <p>Currently, this method supports the "ECDSA" algorithm with
|
||||
// named-curve P-256 and "RSASSA-PKCS1-v1_5" algorithm with one of the
|
||||
// hashing algorithms "none", "SHA-1", "SHA-256", "SHA-384", and
|
||||
// "SHA-512".</p>
|
||||
[nocompile, doesNotSupportPromises=
|
||||
"Multi-parameter callback crbug.com/1313625"]
|
||||
static void getKeyPairBySpki(ArrayBuffer publicKeySpkiDer,
|
||||
object parameters,
|
||||
GetKeyPairCallback callback);
|
||||
|
||||
// An implementation of WebCrypto's
|
||||
// <a href="http://www.w3.org/TR/WebCryptoAPI/#subtlecrypto-interface">
|
||||
// SubtleCrypto</a>
|
||||
// that allows crypto operations on keys of client certificates that are
|
||||
// available to this extension.
|
||||
[nocompile] static object subtleCrypto();
|
||||
|
||||
// Checks whether <code>details.serverCertificateChain</code> can be trusted
|
||||
// for <code>details.hostname</code> according to the trust settings of the
|
||||
// platform.
|
||||
// Note: The actual behavior of the trust verification is not fully
|
||||
// specified and might change in the future.
|
||||
// The API implementation verifies certificate expiration, validates the
|
||||
// certification path and checks trust by a known CA.
|
||||
// The implementation is supposed to respect the EKU serverAuth and to
|
||||
// support subject alternative names.
|
||||
static void verifyTLSServerCertificate(VerificationDetails details,
|
||||
VerificationCallback callback);
|
||||
};
|
||||
};
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
// Copyright 2015 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Internal API for to implement the platformKeys and enterprise.platformKeys
|
||||
// APIs.
|
||||
[implemented_in = "chrome/browser/extensions/api/platform_keys/platform_keys_api.h"]
|
||||
namespace platformKeysInternal {
|
||||
callback SelectCallback = void (platformKeys.Match[] certs);
|
||||
|
||||
// Invoked by <code>sign</code>.
|
||||
// |signature| The signature, a octet string.
|
||||
callback SignCallback = void(ArrayBuffer signature);
|
||||
|
||||
// Called back by <code>getPublicKey</code>.
|
||||
// |publicKey| The Subject Public Key Info (see X.509) of the requested
|
||||
// certificate.
|
||||
// |algorithm| A partial WebCrypto KeyAlgorithm containing all information
|
||||
// that is available from the Subject Public Key Info. It does not contain
|
||||
// signature/hash parameters.
|
||||
callback GetPublicKeyCallback = void(ArrayBuffer publicKey, object algorithm);
|
||||
|
||||
interface Functions {
|
||||
// See documentation in platformKeys.
|
||||
static void selectClientCertificates(
|
||||
platformKeys.SelectDetails details,
|
||||
SelectCallback callback);
|
||||
|
||||
// Internal version of platformKeys.subtleCrypto.sign and
|
||||
// enterprise.platformKeys.Token.subtleCrypto.sign.
|
||||
// |tokenId| The id of a Token returned by |getTokens|.
|
||||
// |publicKey| The Subject Public Key Info of a key previously generated by
|
||||
// |generateKey| in DER encoding.
|
||||
// |algorithmName| The name of the algorithm used to generate the key pair.
|
||||
// |hashAlgorithmName| The recognized algorithm name of the hash algorithm,
|
||||
// as specified by WebCrypto, that will be used to digest |data|
|
||||
// before signing. Currently supported are: SHA-{1,256,384,512}.
|
||||
// If instead the algorithm name "none" is provided, no hashing will be
|
||||
// applied, the data is PKCS#1 v1.5 padded but not hashed.
|
||||
// TODO(pneubeck): use an enum once supported:
|
||||
// http://www.crbug.com/385539 .
|
||||
// |data| The data to sign.
|
||||
// |callback| Called back with the signature of |data|.
|
||||
// TODO: Instead of ArrayBuffer should be (ArrayBuffer or ArrayBufferView),
|
||||
// or at least (ArrayBuffer or Uint8Array).
|
||||
static void sign(DOMString tokenId,
|
||||
ArrayBuffer publicKey,
|
||||
DOMString algorithmName,
|
||||
DOMString hashAlgorithmName,
|
||||
ArrayBuffer data,
|
||||
SignCallback callback);
|
||||
|
||||
// Checks whether <code>certificate</code> certifies a key that allows usage
|
||||
// of the WebCrypto algorithm <code>algorithmName</code>. If so, calls back
|
||||
// <code>callback</code> with the key info and a WebCrypto
|
||||
// <code>KeyAlgorithm</code> dictionary describing the key's algorithm. The
|
||||
// <code>name</code> property will equal <code>algorithmName</code>.
|
||||
// Otherwise, calls back with an error.
|
||||
[doesNotSupportPromises="Multi-parameter callback crbug.com/1313625"]
|
||||
static void getPublicKey(ArrayBuffer certificate,
|
||||
DOMString algorithmName,
|
||||
GetPublicKeyCallback callback);
|
||||
|
||||
// Takes as arguments a <code>publicKeySpkiDer</code> and
|
||||
// <code>algorithmName</code>. Checks if <code>publicKeySpkiDer</code> is
|
||||
// not empty and if the <code>algorithmName</code> specified is supported.
|
||||
// If so, calls back <code>callback</code> with the key info and a WebCrypto
|
||||
// <code>KeyAlgorithm</code> dictionary describing the key's algorithm. The
|
||||
// <code>name</code> property will equal <code>algorithmName</code>.
|
||||
// Otherwise, calls back with an error.
|
||||
[doesNotSupportPromises="Multi-parameter callback crbug.com/1313625"]
|
||||
static void getPublicKeyBySpki(ArrayBuffer publicKeySpkiDer,
|
||||
DOMString algorithmName,
|
||||
GetPublicKeyCallback callback);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,203 @@
|
||||
// Copyright 2019 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.printing</code> API to send print jobs to printers
|
||||
// installed on Chromebook.
|
||||
[platforms=("chromeos", "lacros"),
|
||||
implemented_in="chrome/browser/extensions/api/printing/printing_api.h"]
|
||||
namespace printing {
|
||||
dictionary SubmitJobRequest {
|
||||
// The print job to be submitted.
|
||||
// The only supported content type is "application/pdf", and the
|
||||
// <a href="https://developers.google.com/cloud-print/docs/cdd#cjt">Cloud Job Ticket</a>
|
||||
// shouldn't include <code>FitToPageTicketItem</code>,
|
||||
// <code>PageRangeTicketItem</code>, <code>ReverseOrderTicketItem</code>
|
||||
// and <code>VendorTicketItem</code> fields since they are
|
||||
// irrelevant for native printing. All other fields must be present.
|
||||
printerProvider.PrintJob job;
|
||||
|
||||
// Used internally to store the blob uuid after parameter customization and
|
||||
// shouldn't be populated by the extension.
|
||||
[nodoc] DOMString? documentBlobUuid;
|
||||
};
|
||||
|
||||
// The status of $(ref:submitJob) request.
|
||||
enum SubmitJobStatus {
|
||||
// Sent print job request is accepted.
|
||||
OK,
|
||||
|
||||
// Sent print job request is rejected by the user.
|
||||
USER_REJECTED
|
||||
};
|
||||
|
||||
// Response for $(ref:submitJob) request.
|
||||
dictionary SubmitJobResponse {
|
||||
// The status of the request.
|
||||
SubmitJobStatus status;
|
||||
|
||||
// The id of created print job. This is a unique identifier among all print
|
||||
// jobs on the device. If status is not OK, jobId will be null.
|
||||
DOMString? jobId;
|
||||
};
|
||||
|
||||
// The source of the printer.
|
||||
enum PrinterSource {
|
||||
// Printer was added by user.
|
||||
USER,
|
||||
|
||||
// Printer was added via policy.
|
||||
POLICY
|
||||
};
|
||||
|
||||
// Description of the printer.
|
||||
dictionary Printer {
|
||||
// The printer's identifier; guaranteed to be unique among printers on the
|
||||
// device.
|
||||
DOMString id;
|
||||
|
||||
// The name of the printer.
|
||||
DOMString name;
|
||||
|
||||
// The human-readable description of the printer.
|
||||
DOMString description;
|
||||
|
||||
// The printer URI. This can be used by extensions to choose the printer for
|
||||
// the user.
|
||||
DOMString uri;
|
||||
|
||||
// The source of the printer (user or policy configured).
|
||||
PrinterSource source;
|
||||
|
||||
// The flag which shows whether the printer fits
|
||||
// <a href="https://chromium.org/administrators/policy-list-3#DefaultPrinterSelection">
|
||||
// DefaultPrinterSelection</a> rules.
|
||||
// Note that several printers could be flagged.
|
||||
boolean isDefault;
|
||||
|
||||
// The value showing how recent the printer was used for printing from
|
||||
// Chrome. The lower the value is the more recent the printer was used. The
|
||||
// minimum value is 0. Missing value indicates that the printer wasn't used
|
||||
// recently. This value is guaranteed to be unique amongst printers.
|
||||
long? recentlyUsedRank;
|
||||
};
|
||||
|
||||
// The status of the printer.
|
||||
enum PrinterStatus {
|
||||
// The door of the printer is open. Printer still accepts print jobs.
|
||||
DOOR_OPEN,
|
||||
|
||||
// The tray of the printer is missing. Printer still accepts print jobs.
|
||||
TRAY_MISSING,
|
||||
|
||||
// The printer is out of ink. Printer still accepts print jobs.
|
||||
OUT_OF_INK,
|
||||
|
||||
// The printer is out of paper. Printer still accepts print jobs.
|
||||
OUT_OF_PAPER,
|
||||
|
||||
// The output area of the printer (e.g. tray) is full. Printer still accepts
|
||||
// print jobs.
|
||||
OUTPUT_FULL,
|
||||
|
||||
// The printer has a paper jam. Printer still accepts print jobs.
|
||||
PAPER_JAM,
|
||||
|
||||
// Some generic issue. Printer still accepts print jobs.
|
||||
GENERIC_ISSUE,
|
||||
|
||||
// The printer is stopped and doesn't print but still accepts print jobs.
|
||||
STOPPED,
|
||||
|
||||
// The printer is unreachable and doesn't accept print jobs.
|
||||
UNREACHABLE,
|
||||
|
||||
// The SSL certificate is expired. Printer accepts jobs but they fail.
|
||||
EXPIRED_CERTIFICATE,
|
||||
|
||||
// The printer is available.
|
||||
AVAILABLE
|
||||
};
|
||||
|
||||
// Response for $(ref:getPrinterInfo) request.
|
||||
dictionary GetPrinterInfoResponse {
|
||||
// Printer capabilities in
|
||||
// <a href="https://developers.google.com/cloud-print/docs/cdd#cdd">
|
||||
// CDD format</a>.
|
||||
// The property may be missing.
|
||||
object? capabilities;
|
||||
|
||||
// The status of the printer.
|
||||
PrinterStatus status;
|
||||
};
|
||||
|
||||
// Status of the print job.
|
||||
enum JobStatus {
|
||||
// Print job is received on Chrome side but was not processed yet.
|
||||
PENDING,
|
||||
|
||||
// Print job is sent for printing.
|
||||
IN_PROGRESS,
|
||||
|
||||
// Print job was interrupted due to some error.
|
||||
FAILED,
|
||||
|
||||
// Print job was canceled by the user or via API.
|
||||
CANCELED,
|
||||
|
||||
// Print job was printed without any errors.
|
||||
PRINTED
|
||||
};
|
||||
|
||||
callback SubmitJobCallback = void(SubmitJobResponse response);
|
||||
callback CancelJobCallback = void();
|
||||
callback GetPrintersCallback = void(Printer[] printers);
|
||||
callback GetPrinterInfoCallback = void(GetPrinterInfoResponse response);
|
||||
|
||||
interface Functions {
|
||||
// Submits the job for printing. If the extension is not listed in
|
||||
// the <a href="https://chromeenterprise.google/policies/#PrintingAPIExtensionsAllowlist">
|
||||
// <code>PrintingAPIExtensionsAllowlist</code></a> policy,
|
||||
// the user is prompted to accept the print job.<br/>
|
||||
// Before Chrome 120, this function did not return a promise.
|
||||
static void submitJob(
|
||||
SubmitJobRequest request,
|
||||
SubmitJobCallback callback);
|
||||
|
||||
// Cancels previously submitted job.
|
||||
// |jobId|: The id of the print job to cancel. This should be the same id
|
||||
// received in a $(ref:SubmitJobResponse).
|
||||
static void cancelJob(
|
||||
DOMString jobId,
|
||||
CancelJobCallback callback);
|
||||
|
||||
// Returns the list of available printers on the device. This includes
|
||||
// manually added, enterprise and discovered printers.
|
||||
static void getPrinters(GetPrintersCallback callback);
|
||||
|
||||
// Returns the status and capabilities of the printer in
|
||||
// <a href="https://developers.google.com/cloud-print/docs/cdd#cdd">
|
||||
// CDD format</a>.
|
||||
// This call will fail with a runtime error if no printers with given id are
|
||||
// installed.
|
||||
static void getPrinterInfo(
|
||||
DOMString printerId,
|
||||
GetPrinterInfoCallback callback);
|
||||
};
|
||||
|
||||
interface Properties {
|
||||
// The maximum number of times that $(ref:submitJob) can be called per
|
||||
// minute.
|
||||
[value=40] static long MAX_SUBMIT_JOB_CALLS_PER_MINUTE();
|
||||
|
||||
// The maximum number of times that $(ref:getPrinterInfo) can be called per
|
||||
// minute.
|
||||
[value=20] static long MAX_GET_PRINTER_INFO_CALLS_PER_MINUTE();
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Event fired when the status of the job is changed.
|
||||
// This is only fired for the jobs created by this extension.
|
||||
static void onJobStatusChanged(DOMString jobId, JobStatus status);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,157 @@
|
||||
// Copyright 2019 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.printingMetrics</code> API to fetch data about
|
||||
// printing usage.
|
||||
[platforms=("chromeos", "lacros"),
|
||||
implemented_in="chrome/browser/chromeos/extensions/printing_metrics/printing_metrics_api.h"]
|
||||
namespace printingMetrics {
|
||||
// The source of the print job.
|
||||
enum PrintJobSource {
|
||||
// Specifies that the job was created from the Print Preview page
|
||||
// initiated by the user.
|
||||
PRINT_PREVIEW,
|
||||
|
||||
// Specifies that the job was created from an Android App.
|
||||
ANDROID_APP,
|
||||
|
||||
// Specifies that the job was created by extension via Chrome API.
|
||||
EXTENSION,
|
||||
|
||||
// Specifies that the job was created by an Isolated Web App via API.
|
||||
ISOLATED_WEB_APP
|
||||
};
|
||||
|
||||
// Specifies the final status of the print job.
|
||||
enum PrintJobStatus {
|
||||
// Specifies that the print job was interrupted due to some error.
|
||||
FAILED,
|
||||
|
||||
// Specifies that the print job was canceled by the user or via API.
|
||||
CANCELED,
|
||||
|
||||
// Specifies that the print job was printed without any errors.
|
||||
PRINTED
|
||||
};
|
||||
|
||||
// The source of the printer.
|
||||
enum PrinterSource {
|
||||
// Specifies that the printer was added by user.
|
||||
USER,
|
||||
|
||||
// Specifies that the printer was added via policy.
|
||||
POLICY
|
||||
};
|
||||
|
||||
enum ColorMode {
|
||||
// Specifies that black and white mode was used.
|
||||
BLACK_AND_WHITE,
|
||||
|
||||
// Specifies that color mode was used.
|
||||
COLOR
|
||||
};
|
||||
|
||||
enum DuplexMode {
|
||||
// Specifies that one-sided printing was used.
|
||||
ONE_SIDED,
|
||||
|
||||
// Specifies that two-sided printing was used, flipping on long edge.
|
||||
TWO_SIDED_LONG_EDGE,
|
||||
|
||||
// Specifies that two-sided printing was used, flipping on short edge.
|
||||
TWO_SIDED_SHORT_EDGE
|
||||
};
|
||||
|
||||
// The size of requested media.
|
||||
dictionary MediaSize {
|
||||
// Width (in micrometers) of the media used for printing.
|
||||
long width;
|
||||
|
||||
// Height (in micrometers) of the media used for printing.
|
||||
long height;
|
||||
|
||||
// Vendor-provided ID, e.g. "iso_a3_297x420mm" or "na_index-3x5_3x5in".
|
||||
// Possible values are values of "media" IPP attribute and can be found on
|
||||
// <a href="https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xhtml">
|
||||
// IANA page</a> .
|
||||
DOMString vendorId;
|
||||
};
|
||||
|
||||
// The requested settings of print job.
|
||||
dictionary PrintSettings {
|
||||
// The requested color mode.
|
||||
ColorMode color;
|
||||
|
||||
// The requested duplex mode.
|
||||
DuplexMode duplex;
|
||||
|
||||
// The requested media size.
|
||||
MediaSize mediaSize;
|
||||
|
||||
// The requested number of copies.
|
||||
long copies;
|
||||
};
|
||||
|
||||
// The printer info.
|
||||
dictionary Printer {
|
||||
// Displayed name of the printer.
|
||||
DOMString name;
|
||||
|
||||
// The full path for the printer.
|
||||
// Contains protocol, hostname, port, and queue.
|
||||
DOMString uri;
|
||||
|
||||
// The source of the printer.
|
||||
PrinterSource source;
|
||||
};
|
||||
|
||||
// Print job information.
|
||||
dictionary PrintJobInfo {
|
||||
// The ID of the job.
|
||||
DOMString id;
|
||||
|
||||
// The title of the document which was printed.
|
||||
DOMString title;
|
||||
|
||||
// Source showing who initiated the print job.
|
||||
PrintJobSource source;
|
||||
|
||||
// ID of source. Null if source is PRINT_PREVIEW or ANDROID_APP.
|
||||
DOMString? sourceId;
|
||||
|
||||
// The final status of the job.
|
||||
PrintJobStatus status;
|
||||
|
||||
// The job creation time (in milliseconds past the Unix epoch).
|
||||
double creationTime;
|
||||
|
||||
// The job completion time (in milliseconds past the Unix epoch).
|
||||
double completionTime;
|
||||
|
||||
// The info about the printer which printed the document.
|
||||
Printer printer;
|
||||
|
||||
// The settings of the print job.
|
||||
PrintSettings settings;
|
||||
|
||||
// The number of pages in the document.
|
||||
long numberOfPages;
|
||||
|
||||
// The status of the printer.
|
||||
printing.PrinterStatus printer_status;
|
||||
};
|
||||
|
||||
callback GetPrintJobsCallback = void(PrintJobInfo[] jobs);
|
||||
|
||||
interface Functions {
|
||||
// Returns the list of the finished print jobs.
|
||||
static void getPrintJobs(GetPrintJobsCallback callback);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Event fired when the print job is finished.
|
||||
// This includes any of termination statuses: FAILED, CANCELED and PRINTED.
|
||||
static void onPrintJobFinished(PrintJobInfo jobInfo);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,183 @@
|
||||
// Copyright 2016 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.processes</code> API to interact with the browser's
|
||||
// processes.
|
||||
namespace processes {
|
||||
// The types of the browser processes.
|
||||
enum ProcessType {
|
||||
browser,
|
||||
renderer,
|
||||
extension,
|
||||
notification,
|
||||
plugin,
|
||||
worker,
|
||||
nacl,
|
||||
service_worker,
|
||||
utility,
|
||||
gpu,
|
||||
other
|
||||
};
|
||||
|
||||
// An object that represents a Chrome task running on a process. Several tasks
|
||||
// can share the same process.
|
||||
dictionary TaskInfo {
|
||||
// The title of the task.
|
||||
DOMString title;
|
||||
// Optional tab ID, if this task represents a tab running on a renderer
|
||||
// process.
|
||||
long? tabId;
|
||||
};
|
||||
|
||||
// The Cache object contains information about the size and utilization of a
|
||||
// cache used by the browser.
|
||||
dictionary Cache {
|
||||
// The size of the cache, in bytes.
|
||||
double size;
|
||||
// The part of the cache that is utilized, in bytes.
|
||||
double liveSize;
|
||||
};
|
||||
|
||||
// An object containing information about one of the browser's processes.
|
||||
dictionary Process {
|
||||
// Unique ID of the process provided by the browser.
|
||||
long id;
|
||||
// The ID of the process, as provided by the OS.
|
||||
long osProcessId;
|
||||
// The type of process.
|
||||
ProcessType type;
|
||||
// The profile which the process is associated with.
|
||||
DOMString profile;
|
||||
// The debugging port for Native Client processes. Zero for other process
|
||||
// types and for NaCl processes that do not have debugging enabled.
|
||||
long naclDebugPort;
|
||||
// Array of TaskInfos representing the tasks running on this process.
|
||||
TaskInfo[] tasks;
|
||||
// The most recent measurement of the process's CPU usage, expressed as the
|
||||
// percentage of a single CPU core used in total, by all of the process's
|
||||
// threads. This gives a value from zero to CpuInfo.numOfProcessors*100,
|
||||
// which can exceed 100% in multi-threaded processes.
|
||||
// Only available when receiving the object as part of a callback from
|
||||
// onUpdated or onUpdatedWithMemory.
|
||||
double? cpu;
|
||||
// The most recent measurement of the process network usage, in bytes per
|
||||
// second. Only available when receiving the object as part of a callback
|
||||
// from onUpdated or onUpdatedWithMemory.
|
||||
double? network;
|
||||
// The most recent measurement of the process private memory usage, in
|
||||
// bytes. Only available when receiving the object as part of a callback
|
||||
// from onUpdatedWithMemory or getProcessInfo with the includeMemory flag.
|
||||
double? privateMemory;
|
||||
// The most recent measurement of the process JavaScript allocated memory,
|
||||
// in bytes. Only available when receiving the object as part of a callback
|
||||
// from onUpdated or onUpdatedWithMemory.
|
||||
double? jsMemoryAllocated;
|
||||
// The most recent measurement of the process JavaScript memory used, in
|
||||
// bytes. Only available when receiving the object as part of a callback
|
||||
// from onUpdated or onUpdatedWithMemory.
|
||||
double? jsMemoryUsed;
|
||||
// The most recent measurement of the process's SQLite memory usage, in
|
||||
// bytes. Only available when receiving the object as part of a callback
|
||||
// from onUpdated or onUpdatedWithMemory.
|
||||
double? sqliteMemory;
|
||||
// The most recent information about the image cache for the process. Only
|
||||
// available when receiving the object as part of a callback from onUpdated
|
||||
// or onUpdatedWithMemory.
|
||||
Cache? imageCache;
|
||||
// The most recent information about the script cache for the process. Only
|
||||
// available when receiving the object as part of a callback from onUpdated
|
||||
// or onUpdatedWithMemory.
|
||||
Cache? scriptCache;
|
||||
// The most recent information about the CSS cache for the process. Only
|
||||
// available when receiving the object as part of a callback from onUpdated
|
||||
// or onUpdatedWithMemory.
|
||||
Cache? cssCache;
|
||||
};
|
||||
|
||||
// A callback to report the status of the termination.
|
||||
// |didTerminate|: True if terminating the process was successful, and false
|
||||
// otherwise.
|
||||
callback TerminateCallback = void(boolean didTerminate);
|
||||
|
||||
// A callback to return the ID of the renderer process of a tab.
|
||||
// |processId|: Process ID of the tab's renderer process.
|
||||
callback GetProcessIdForTabCallback = void(long processId);
|
||||
|
||||
// A callback called when the processes information is collected.
|
||||
// |processes|: A dictionary of $(ref:Process) objects for each requested
|
||||
// process that is a live child process of the current browser process,
|
||||
// indexed by process ID. Metrics requiring aggregation over time will not be
|
||||
// populated in each Process object.
|
||||
callback GetProcessInfoCallback = void(object processes);
|
||||
|
||||
interface Functions {
|
||||
// Returns the ID of the renderer process for the specified tab.
|
||||
// |tabId|: The ID of the tab for which the renderer process ID is to be
|
||||
// returned.
|
||||
static void getProcessIdForTab(
|
||||
long tabId,
|
||||
GetProcessIdForTabCallback callback);
|
||||
|
||||
// Terminates the specified renderer process. Equivalent to visiting
|
||||
// about:crash, but without changing the tab's URL.
|
||||
// |processId|: The ID of the process to be terminated.
|
||||
static void terminate(
|
||||
long processId,
|
||||
optional TerminateCallback callback);
|
||||
|
||||
// Retrieves the process information for each process ID specified.
|
||||
// |processIds|: The list of process IDs or single process ID for which
|
||||
// to return the process information. An empty list indicates all processes
|
||||
// are requested.
|
||||
// |includeMemory|: True if detailed memory usage is required. Note,
|
||||
// collecting memory usage information incurs extra CPU usage and should
|
||||
// only be queried for when needed.
|
||||
static void getProcessInfo(
|
||||
(long or long[]) processIds,
|
||||
boolean includeMemory,
|
||||
GetProcessInfoCallback callback);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Fired each time the Task Manager updates its process statistics,
|
||||
// providing the dictionary of updated Process objects, indexed by process
|
||||
// ID.
|
||||
// |processes|: A dictionary of updated $(ref:Process) objects for each live
|
||||
// process in the browser, indexed by process ID. Metrics requiring
|
||||
// aggregation over time will be populated in each Process object.
|
||||
static void onUpdated(object processes);
|
||||
|
||||
// Fired each time the Task Manager updates its process statistics,
|
||||
// providing the dictionary of updated Process objects, indexed by process
|
||||
// ID. Identical to onUpdate, with the addition of memory usage details
|
||||
// included in each Process object. Note, collecting memory usage
|
||||
// information incurs extra CPU usage and should only be listened for when
|
||||
// needed.
|
||||
// |processes|: A dictionary of updated $(ref:Process) objects for each live
|
||||
// process in the browser, indexed by process ID. Memory usage details will
|
||||
// be included in each Process object.
|
||||
static void onUpdatedWithMemory(object processes);
|
||||
|
||||
// Fired each time a process is created, providing the corrseponding Process
|
||||
// object.
|
||||
// |process|: Details of the process that was created. Metrics requiring
|
||||
// aggregation over time will not be populated in the object.
|
||||
static void onCreated(Process process);
|
||||
|
||||
// Fired each time a process becomes unresponsive, providing the
|
||||
// corrseponding Process object.
|
||||
// |process|: Details of the unresponsive process. Metrics requiring
|
||||
// aggregation over time will not be populated in the object. Only available
|
||||
// for renderer processes.
|
||||
static void onUnresponsive(Process process);
|
||||
|
||||
// Fired each time a process is terminated, providing the type of exit.
|
||||
// |processId|: The ID of the process that exited.
|
||||
// |exitType|: The type of exit that occurred for the process - normal,
|
||||
// abnormal, killed, crashed. Only available for renderer processes.
|
||||
// |exitCode|: The exit code if the process exited abnormally. Only
|
||||
// available for renderer processes.
|
||||
static void onExited(long processId, long exitType, long exitCode);
|
||||
};
|
||||
};
|
||||
+153
@@ -0,0 +1,153 @@
|
||||
// Copyright 2016 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.quickUnlockPrivate</code> API to change whether the
|
||||
// lock screen is enabled and which modes are allowed (active) for unlocking a
|
||||
// Chrome OS device from the lock screen. The API is also used to set quick
|
||||
// unlock credentials.
|
||||
// Note: The API is named 'quickUnlock' for historical reasons but it should be
|
||||
// used for all lock screen settings.
|
||||
// Note: This API can not be used to actually unlock the device.
|
||||
|
||||
[platforms=("chromeos", "lacros")]
|
||||
namespace quickUnlockPrivate {
|
||||
dictionary TokenInfo {
|
||||
// The authentication token that can be passed to $(ref:setModes) calls.
|
||||
DOMString token;
|
||||
|
||||
// The number of seconds until the token expires. The UI should refresh the
|
||||
// token before it expires.
|
||||
long lifetimeSeconds;
|
||||
};
|
||||
|
||||
// TODO(jdufault): Add more quick unlock modes, such as a pattern unlock.
|
||||
enum QuickUnlockMode {
|
||||
PIN
|
||||
};
|
||||
|
||||
// The problems a given PIN might have.
|
||||
enum CredentialProblem {
|
||||
TOO_SHORT,
|
||||
TOO_LONG,
|
||||
TOO_WEAK,
|
||||
CONTAINS_NONDIGIT
|
||||
};
|
||||
|
||||
dictionary CredentialCheck {
|
||||
// The given PINs errors. Users cannot proceed with an error.
|
||||
CredentialProblem[] errors;
|
||||
|
||||
// THe given PINs warnings. Users can, but are not advised to proceed with
|
||||
// a warning.
|
||||
CredentialProblem[] warnings;
|
||||
};
|
||||
|
||||
dictionary CredentialRequirements {
|
||||
// The minimum allowed length for a PIN.
|
||||
long minLength;
|
||||
|
||||
// The maximum allowed length for a PIN. A value of 0 indicates no maximum
|
||||
// length.
|
||||
long maxLength;
|
||||
};
|
||||
|
||||
callback VoidResultCallback = void ();
|
||||
callback BooleanResultCallback = void (boolean value);
|
||||
callback TokenResultCallback = void (TokenInfo result);
|
||||
callback ModesCallback = void (QuickUnlockMode[] modes);
|
||||
callback CredentialCheckCallback = void (CredentialCheck check);
|
||||
callback CredentialRequirementsCallback =
|
||||
void (CredentialRequirements requirements);
|
||||
|
||||
interface Functions {
|
||||
// Returns a token that can be used for future operations and the number
|
||||
// of seconds until the token expires.
|
||||
// |accountPassword|: The account password for the logged in user.
|
||||
static void getAuthToken(
|
||||
DOMString accountPassword,
|
||||
TokenResultCallback onComplete);
|
||||
|
||||
// Sets the lock screen enabled state. NOTE: The lock enabled state is
|
||||
// reflected in the settings.enable_screen_lock pref, which can be read
|
||||
// but not written using the settings_private API (which also provides
|
||||
// policy information). This API must be used to change the pref.
|
||||
// |token|: The token returned by $(ref:getAuthToken).
|
||||
// |enabled|: Whether to enable the lock screen.
|
||||
[platforms=("chromeos")] static void setLockScreenEnabled(
|
||||
DOMString token,
|
||||
boolean enabled,
|
||||
optional VoidResultCallback onComplete);
|
||||
|
||||
// Sets the PIN auto submit enabled state. NOTE: The PIN autosubmit state is
|
||||
// reflected in the pin_unlock_autosubmit_enabled pref, which can be read
|
||||
// but not written using the settings_private API (which also provides
|
||||
// policy information). This API must be used to change the pref.
|
||||
// |token|: The authentication token.
|
||||
// |pin|: The PIN of the logged in user.
|
||||
// |enabled|: Whether to enable PIN auto submit.
|
||||
// |onComplete|: Called with true if the quick unlock state was updated,
|
||||
// false otherwise. The update is treated as a single atomic operation.
|
||||
[platforms=("chromeos")]
|
||||
static void setPinAutosubmitEnabled(
|
||||
DOMString token,
|
||||
DOMString pin,
|
||||
boolean enabled,
|
||||
BooleanResultCallback onComplete);
|
||||
|
||||
// Tests wether it is currently possible to authenticate using PIN.
|
||||
[platforms=("chromeos")] static void canAuthenticatePin(
|
||||
BooleanResultCallback onComplete);
|
||||
|
||||
// Returns the set of quick unlock modes that are available for the user to
|
||||
// use. Some quick unlock modes may be disabled by policy.
|
||||
[platforms=("chromeos")] static void getAvailableModes(
|
||||
ModesCallback onComplete);
|
||||
|
||||
// Returns the quick unlock modes that are currently enabled and usable on
|
||||
// the lock screen.
|
||||
[platforms=("chromeos")]
|
||||
static void getActiveModes(ModesCallback onComplete);
|
||||
|
||||
|
||||
// Checks if the given credential can be used for the given unlock mode.
|
||||
// Enterprise policy can change credential requirements.
|
||||
// |mode|: The quick unlock mode that is used.
|
||||
// |credential|: The given credential.
|
||||
// |onComplete|: Called with a list of warnings and errors the given
|
||||
// |credential| has (or an empty list if there are none).
|
||||
[platforms=("chromeos")] static void checkCredential(
|
||||
QuickUnlockMode mode,
|
||||
DOMString credential,
|
||||
CredentialCheckCallback onComplete);
|
||||
|
||||
// Gets the credential requirements for the given unlock mode.
|
||||
// |mode|: The quick unlock mode that is used.
|
||||
// |onComplete|: Called with the credential requirements of the given
|
||||
// |mode|.
|
||||
[platforms=("chromeos")]
|
||||
static void getCredentialRequirements(
|
||||
QuickUnlockMode mode,
|
||||
CredentialRequirementsCallback onComplete);
|
||||
|
||||
// Update the set of quick unlock modes that are currently active/enabled.
|
||||
// |token|: The token returned by $(ref:getAuthToken).
|
||||
// |modes|: The quick unlock modes that should be active.
|
||||
// |credentials|: The associated credential for each mode. To keep the
|
||||
// credential the same for the associated mode, pass an empty string.
|
||||
// |onComplete|: Called with true if the quick unlock state was updated,
|
||||
// false otherwise. The update is treated as a single atomic operation.
|
||||
[platforms=("chromeos")]
|
||||
static void setModes(
|
||||
DOMString token,
|
||||
QuickUnlockMode[] modes,
|
||||
DOMString[] credentials,
|
||||
VoidResultCallback onComplete);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Called after the active set of quick unlock modes has changed.
|
||||
// |activeModes|: The set of quick unlock modes which are now active.
|
||||
static void onActiveModesChanged(QuickUnlockMode[] activeModes);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,117 @@
|
||||
// Copyright 2023 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.readingList</code> API to read from and modify
|
||||
// the items in the
|
||||
// <a href="https://support.google.com/chrome/answer/7343019">Reading List</a>.
|
||||
namespace readingList{
|
||||
dictionary ReadingListEntry {
|
||||
// The url of the entry.
|
||||
DOMString url;
|
||||
|
||||
// The title of the entry.
|
||||
DOMString title;
|
||||
|
||||
// Will be <code>true</code> if the entry has been read.
|
||||
boolean hasBeenRead;
|
||||
|
||||
// The last time the entry was updated.
|
||||
// This value is in milliseconds since Jan 1, 1970.
|
||||
double lastUpdateTime;
|
||||
|
||||
// The time the entry was created.
|
||||
// Recorded in milliseconds since Jan 1, 1970.
|
||||
double creationTime;
|
||||
};
|
||||
|
||||
dictionary AddEntryOptions {
|
||||
// The url of the entry.
|
||||
DOMString url;
|
||||
|
||||
// The title of the entry.
|
||||
DOMString title;
|
||||
|
||||
// Will be <code>true</code> if the entry has been read.
|
||||
boolean hasBeenRead;
|
||||
};
|
||||
|
||||
dictionary RemoveOptions {
|
||||
// The url to remove.
|
||||
DOMString url;
|
||||
};
|
||||
|
||||
dictionary UpdateEntryOptions {
|
||||
// The url that will be updated.
|
||||
DOMString url;
|
||||
|
||||
// The new title. The existing tile remains if a value isn't provided.
|
||||
DOMString? title;
|
||||
|
||||
// The updated read status. The existing status remains if a value
|
||||
// isn't provided.
|
||||
boolean? hasBeenRead;
|
||||
};
|
||||
|
||||
dictionary QueryInfo {
|
||||
// A url to search for.
|
||||
DOMString? url;
|
||||
|
||||
// A title to search for.
|
||||
DOMString? title;
|
||||
|
||||
// Indicates whether to search for read (<code>true</code>) or unread
|
||||
// (<code>false</code>) items.
|
||||
boolean? hasBeenRead;
|
||||
};
|
||||
|
||||
callback AddEntryCallback = void ();
|
||||
callback RemoveEntryCallback = void();
|
||||
callback UpdateEntryCallback = void();
|
||||
callback QueryCallback = void(ReadingListEntry[] entries);
|
||||
|
||||
interface Functions {
|
||||
// Adds an entry to the reading list if it does not exist.
|
||||
// |entry|: The entry to add to the reading list.
|
||||
// |callback|: Invoked once the entry has been added.
|
||||
static void addEntry(
|
||||
AddEntryOptions entry,
|
||||
optional AddEntryCallback callback);
|
||||
|
||||
// Removes an entry from the reading list if it exists.
|
||||
// |info|: The entry to remove from the reading list.
|
||||
// |callback|: Invoked once the entry has been removed.
|
||||
static void removeEntry(
|
||||
RemoveOptions info,
|
||||
optional RemoveEntryCallback callback);
|
||||
|
||||
// Updates a reading list entry if it exists.
|
||||
// |info|: The entry to update.
|
||||
// |callback|: Invoked once the matched entries have been updated.
|
||||
static void updateEntry(
|
||||
UpdateEntryOptions info,
|
||||
optional UpdateEntryCallback callback);
|
||||
|
||||
// Retrieves all entries that match the <code>QueryInfo</code> properties.
|
||||
// Properties that are not provided will not be matched.
|
||||
// |info|: The properties to search for.
|
||||
// |callback|: Invoked once the entries have been matched.
|
||||
static void query(
|
||||
QueryInfo info,
|
||||
QueryCallback callback);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Triggered when a <code>ReadingListEntry</code> is added to the reading list.
|
||||
// |entry|: The entry that was added.
|
||||
static void onEntryAdded(ReadingListEntry entry);
|
||||
|
||||
// Triggered when a <code>ReadingListEntry</code> is removed from the reading list.
|
||||
// |entry|: The entry that was removed.
|
||||
static void onEntryRemoved(ReadingListEntry entry);
|
||||
|
||||
// Triggered when a <code>ReadingListEntry</code> is updated in the reading list.
|
||||
// |entry|: The entry that was updated.
|
||||
static void onEntryUpdated(ReadingListEntry entry);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright 2015 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// resourcesPrivate.
|
||||
namespace resourcesPrivate {
|
||||
enum Component { identity, pdf };
|
||||
|
||||
callback GetStringsCallback = void (object result);
|
||||
|
||||
interface Functions {
|
||||
// Gets localized strings for a component extension. Includes default WebUI
|
||||
// loadTimeData values for text and language settings (fontsize, fontfamily,
|
||||
// language, textdirection). See
|
||||
// chrome/browser/extensions/api/resources_private/resources_private_api.cc
|
||||
// for instructions on adding a new component to this API.
|
||||
//
|
||||
// |component| : Internal Chrome component to get strings for.
|
||||
// |callback| : Called with a dictionary mapping names to strings.
|
||||
static void getStrings(
|
||||
Component component,
|
||||
GetStringsCallback callback);
|
||||
};
|
||||
};
|
||||
+173
@@ -0,0 +1,173 @@
|
||||
// Copyright 2018 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.safeBrowsingPrivate</code> API to observe events
|
||||
// or retrieve referrer chain.
|
||||
namespace safeBrowsingPrivate {
|
||||
|
||||
enum URLType {
|
||||
// Ends with the final URL of the referrer chain.
|
||||
EVENT_URL,
|
||||
|
||||
// One gesture away from the EVENT_URL, i.e. the user will click on the
|
||||
// LANDING_PAGE, go through zero or more CLIENT_REDIRECTS, then end up
|
||||
// at EVENT_URL.
|
||||
LANDING_PAGE,
|
||||
|
||||
// One gesture away from LANDING_PAGE.
|
||||
LANDING_REFERRER,
|
||||
|
||||
// The navigation is RENDER_INITIATED_WITHOUT_USER_GESTURE.
|
||||
CLIENT_REDIRECT,
|
||||
|
||||
// Doesn't directly lead to the EVENT_URL, but the navigation occurred
|
||||
// recently, so it might be involved in the event.
|
||||
RECENT_NAVIGATION,
|
||||
|
||||
// Triggered by a user gesture and precedes the LANDING_REFERRER.
|
||||
REFERRER
|
||||
};
|
||||
|
||||
enum NavigationInitiation {
|
||||
// Typically from Chrome UI, e.g. bookmarks or omnibox.
|
||||
BROWSER_INITIATED,
|
||||
|
||||
// Renderer initiated navigations involve interactions with the content
|
||||
// area, such as link clicks or JS.
|
||||
RENDERER_INITIATED_WITHOUT_USER_GESTURE,
|
||||
RENDERER_INITIATED_WITH_USER_GESTURE,
|
||||
|
||||
// Navigation is initiated by the browser process and it is believed the
|
||||
// navigation is the result of the user copy and paste the address from the
|
||||
// browser into the address bar.
|
||||
COPY_PASTE_USER_INITIATED,
|
||||
|
||||
// Navigation is initiated by a click on a Push Notification.
|
||||
NOTIFICATION_INITIATED
|
||||
};
|
||||
|
||||
dictionary PolicySpecifiedPasswordReuse {
|
||||
// URL where this reuse happened.
|
||||
DOMString url;
|
||||
|
||||
// The user name of the policy specified password.
|
||||
DOMString userName;
|
||||
|
||||
// If this a phishing url.
|
||||
boolean isPhishingUrl;
|
||||
};
|
||||
|
||||
dictionary DangerousDownloadInfo {
|
||||
// URL of the download.
|
||||
DOMString url;
|
||||
|
||||
// File name and path of the download on user's machine.
|
||||
DOMString fileName;
|
||||
|
||||
// SHA256 digest of this download.
|
||||
DOMString downloadDigestSha256;
|
||||
|
||||
// User name of the profile. Empty string if user name not available.
|
||||
DOMString userName;
|
||||
};
|
||||
|
||||
dictionary InterstitialInfo {
|
||||
// Top level URL that triggers this interstitial.
|
||||
DOMString url;
|
||||
|
||||
// Human-readable string indicate why this interstitial is shown.
|
||||
DOMString reason;
|
||||
|
||||
// Net error code.
|
||||
DOMString? netErrorCode;
|
||||
|
||||
// User name of the profile. Empty string if user name not available.
|
||||
DOMString userName;
|
||||
};
|
||||
|
||||
dictionary ServerRedirect {
|
||||
// Server redirect URL.
|
||||
DOMString? url;
|
||||
};
|
||||
|
||||
// From ReferrerChainEntry in //src/components/safe_browsing/core/common/proto/csd.proto
|
||||
dictionary ReferrerChainEntry {
|
||||
// URL of this entry.
|
||||
DOMString url;
|
||||
|
||||
// Only set if different from |url|.
|
||||
DOMString? mainFrameUrl;
|
||||
|
||||
// Types of URLs, such as event url, landing page, etc.
|
||||
URLType urlType;
|
||||
|
||||
// IP addresses corresponding to this host.
|
||||
DOMString[]? ipAddresses;
|
||||
|
||||
// Referrer URL of this entry.
|
||||
DOMString? referrerUrl;
|
||||
|
||||
// Main frame URL of referrer. Only set if different from |referrer_url|.
|
||||
DOMString? referrerMainFrameUrl;
|
||||
|
||||
// If this URL loads in a different tab/frame from previous one.
|
||||
boolean? isRetargeting;
|
||||
|
||||
double? navigationTimeMs;
|
||||
|
||||
// Set only if server redirects happened in navigation.
|
||||
ServerRedirect[]? serverRedirectChain;
|
||||
|
||||
// How this navigation is initiated.
|
||||
NavigationInitiation? navigationInitiation;
|
||||
|
||||
// Whether this entry may have been launched by an external application.
|
||||
boolean? maybeLaunchedByExternalApp;
|
||||
|
||||
// Whether subframe URLs are removed due to user consent restriction.
|
||||
boolean? isSubframeUrlRemoved;
|
||||
|
||||
// Whether subframe referrer URLs are removed due to user consent
|
||||
// restriction.
|
||||
boolean? isSubframeReferrerUrlRemoved;
|
||||
|
||||
// Whether any of the URLs are removed because the URL matches the
|
||||
// SafeBrowsingAllowlistDomains enterprise policy in Chrome.
|
||||
boolean isUrlRemovedByPolicy;
|
||||
};
|
||||
|
||||
callback GetReferrerChainCallback = void(ReferrerChainEntry[] entries);
|
||||
|
||||
interface Functions {
|
||||
// Gets referrer chain for the specified tab.
|
||||
// |tabId|: Id of the tab from which to retrieve the referrer.
|
||||
// |callback|: Called with the list of referrer chain entries.
|
||||
static void getReferrerChain(
|
||||
long tabId,
|
||||
GetReferrerChainCallback callback);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Fired when Chrome detects a reuse of a policy specified password.
|
||||
//
|
||||
// |reuseDetails|: Details about where the password reuse occurred.
|
||||
static void onPolicySpecifiedPasswordReuseDetected(
|
||||
PolicySpecifiedPasswordReuse reuseDetails);
|
||||
|
||||
// Fired when the user changed their policy specified password.
|
||||
//
|
||||
// |userName|: The user name of the policy specified password.
|
||||
static void onPolicySpecifiedPasswordChanged(DOMString userName);
|
||||
|
||||
// Fired when the user opened a dangerous download.
|
||||
static void onDangerousDownloadOpened(DangerousDownloadInfo dict);
|
||||
|
||||
// Fired when a security interstitial is shown to the user.
|
||||
static void onSecurityInterstitialShown(InterstitialInfo dict);
|
||||
|
||||
// Fired when the user clicked-through a security interstitial.
|
||||
static void onSecurityInterstitialProceeded(InterstitialInfo dict);
|
||||
};
|
||||
|
||||
};
|
||||
@@ -0,0 +1,268 @@
|
||||
// Copyright 2020 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.scripting</code> API to execute script in different
|
||||
// contexts.
|
||||
namespace scripting {
|
||||
callback InjectedFunction = void();
|
||||
|
||||
// The origin for a style change.
|
||||
// See <a href="https://developer.mozilla.org/en-US/docs/Glossary/Style_origin">style origins</a>
|
||||
// for more info.
|
||||
enum StyleOrigin {
|
||||
AUTHOR,
|
||||
USER
|
||||
};
|
||||
|
||||
// The JavaScript world for a script to execute within.
|
||||
enum ExecutionWorld {
|
||||
// Specifies the isolated world, which is the execution environment unique
|
||||
// to this extension.
|
||||
ISOLATED,
|
||||
// Specifies the main world of the DOM, which is the execution environment
|
||||
// shared with the host page's JavaScript.
|
||||
MAIN
|
||||
};
|
||||
|
||||
dictionary InjectionTarget {
|
||||
// The ID of the tab into which to inject.
|
||||
long tabId;
|
||||
|
||||
// The <a href="https://developer.chrome.com/extensions/webNavigation#frame_ids">IDs</a>
|
||||
// of specific frames to inject into.
|
||||
long[]? frameIds;
|
||||
|
||||
// The <a href="https://developer.chrome.com/extensions/webNavigation#document_ids">IDs</a>
|
||||
// of specific documentIds to inject into. This must not be set if
|
||||
// <code>frameIds</code> is set.
|
||||
DOMString[]? documentIds;
|
||||
|
||||
// Whether the script should inject into all frames within the tab. Defaults
|
||||
// to false.
|
||||
// This must not be true if <code>frameIds</code> is specified.
|
||||
boolean? allFrames;
|
||||
};
|
||||
|
||||
dictionary ScriptInjection {
|
||||
// A JavaScript function to inject. This function will be serialized, and
|
||||
// then deserialized for injection. This means that any bound parameters
|
||||
// and execution context will be lost.
|
||||
// Exactly one of <code>files</code> or <code>func</code> must be
|
||||
// specified.
|
||||
[serializableFunction]InjectedFunction? func;
|
||||
|
||||
// The arguments to pass to the provided function. This is only valid if
|
||||
// the <code>func</code> parameter is specified. These arguments must be
|
||||
// JSON-serializable.
|
||||
any[]? args;
|
||||
|
||||
// We used to call the injected function `function`, but this is
|
||||
// incompatible with JavaScript's object declaration shorthand (see
|
||||
// https://crbug.com/1166438). We leave this silently in for backwards
|
||||
// compatibility.
|
||||
// TODO(devlin): Remove this in M95.
|
||||
[nodoc, serializableFunction]InjectedFunction? function;
|
||||
|
||||
// The path of the JS or CSS files to inject, relative to the extension's
|
||||
// root directory.
|
||||
// Exactly one of <code>files</code> or <code>func</code> must be
|
||||
// specified.
|
||||
DOMString[]? files;
|
||||
|
||||
// Details specifying the target into which to inject the script.
|
||||
InjectionTarget target;
|
||||
|
||||
// The JavaScript "world" to run the script in. Defaults to
|
||||
// <code>ISOLATED</code>.
|
||||
ExecutionWorld? world;
|
||||
|
||||
// Whether the injection should be triggered in the target as soon as
|
||||
// possible. Note that this is not a guarantee that injection will occur
|
||||
// prior to page load, as the page may have already loaded by the time the
|
||||
// script reaches the target.
|
||||
boolean? injectImmediately;
|
||||
};
|
||||
|
||||
dictionary CSSInjection {
|
||||
// Details specifying the target into which to insert the CSS.
|
||||
InjectionTarget target;
|
||||
|
||||
// A string containing the CSS to inject.
|
||||
// Exactly one of <code>files</code> and <code>css</code> must be
|
||||
// specified.
|
||||
DOMString? css;
|
||||
|
||||
// The path of the CSS files to inject, relative to the extension's root
|
||||
// directory.
|
||||
// Exactly one of <code>files</code> and <code>css</code> must be
|
||||
// specified.
|
||||
DOMString[]? files;
|
||||
|
||||
// The style origin for the injection. Defaults to <code>'AUTHOR'</code>.
|
||||
StyleOrigin? origin;
|
||||
};
|
||||
|
||||
dictionary InjectionResult {
|
||||
// The result of the script execution.
|
||||
any? result;
|
||||
|
||||
// The frame associated with the injection.
|
||||
long frameId;
|
||||
|
||||
// The document associated with the injection.
|
||||
DOMString documentId;
|
||||
};
|
||||
|
||||
// Describes a content script to be injected into a web page registered
|
||||
// through this API.
|
||||
dictionary RegisteredContentScript {
|
||||
// The id of the content script, specified in the API call. Must not start
|
||||
// with a '_' as it's reserved as a prefix for generated script IDs.
|
||||
DOMString id;
|
||||
// Specifies which pages this content script will be injected into. See
|
||||
// <a href="develop/concepts/match-patterns">Match Patterns</a> for more
|
||||
// details on the syntax of these strings. Must be specified for
|
||||
// $(ref:registerContentScripts).
|
||||
DOMString[]? matches;
|
||||
// Excludes pages that this content script would otherwise be injected into.
|
||||
// See <a href="develop/concepts/match-patterns">Match Patterns</a> for
|
||||
// more details on the syntax of these strings.
|
||||
DOMString[]? excludeMatches;
|
||||
// The list of CSS files to be injected into matching pages. These are
|
||||
// injected in the order they appear in this array, before any DOM is
|
||||
// constructed or displayed for the page.
|
||||
DOMString[]? css;
|
||||
// The list of JavaScript files to be injected into matching pages. These
|
||||
// are injected in the order they appear in this array.
|
||||
DOMString[]? js;
|
||||
// If specified true, it will inject into all frames, even if the frame is
|
||||
// not the top-most frame in the tab. Each frame is checked independently
|
||||
// for URL requirements; it will not inject into child frames if the URL
|
||||
// requirements are not met. Defaults to false, meaning that only the top
|
||||
// frame is matched.
|
||||
boolean? allFrames;
|
||||
// Indicates whether the script can be injected into frames where the URL
|
||||
// contains an unsupported scheme; specifically: about:, data:, blob:, or
|
||||
// filesystem:. In these cases, the URL's origin is checked to determine if
|
||||
// the script should be injected. If the origin is `null` (as is the case
|
||||
// for data: URLs) then the used origin is either the frame that created
|
||||
// the current frame or the frame that initiated the navigation to this
|
||||
// frame. Note that this may not be the parent frame.
|
||||
boolean? matchOriginAsFallback;
|
||||
// Specifies when JavaScript files are injected into the web page. The
|
||||
// preferred and default value is <code>document_idle</code>.
|
||||
extensionTypes.RunAt? runAt;
|
||||
// Specifies if this content script will persist into future sessions. The
|
||||
// default is true.
|
||||
boolean? persistAcrossSessions;
|
||||
// The JavaScript "world" to run the script in. Defaults to
|
||||
// <code>ISOLATED</code>.
|
||||
ExecutionWorld? world;
|
||||
};
|
||||
|
||||
// An object used to filter content scripts for
|
||||
// ${ref:getRegisteredContentScripts}.
|
||||
dictionary ContentScriptFilter {
|
||||
// If specified, $(ref:getRegisteredContentScripts) will only return scripts
|
||||
// with an id specified in this list.
|
||||
DOMString[]? ids;
|
||||
};
|
||||
|
||||
callback ScriptInjectionCallback = void(InjectionResult[] results);
|
||||
|
||||
callback CSSInjectionCallback = void();
|
||||
|
||||
callback RegisterContentScriptsCallback = void();
|
||||
|
||||
callback GetRegisteredContentScriptsCallback = void(
|
||||
RegisteredContentScript[] scripts);
|
||||
|
||||
callback UnregisterContentScriptsCallback = void();
|
||||
|
||||
callback UpdateContentScriptsCallback = void();
|
||||
|
||||
interface Properties {
|
||||
// An object available for content scripts running in isolated worlds to use
|
||||
// and modify as a JS object. One instance exists per frame and is shared
|
||||
// between all content scripts for a given extension. This object is
|
||||
// initialized when the frame is created, before document_start.
|
||||
// TODO(crbug.com/40119604): Enable this once implementation is complete.
|
||||
[nodoc, nocompile] static long globalParams();
|
||||
};
|
||||
|
||||
interface Functions {
|
||||
// Injects a script into a target context. By default, the script will be run
|
||||
// at <code>document_idle</code>, or immediately if the page has already
|
||||
// loaded. If the <code>injectImmediately</code> property is set, the script
|
||||
// will inject without waiting, even if the page has not finished loading. If
|
||||
// the script evaluates to a promise, the browser will wait for the promise to
|
||||
// settle and return the resulting value.
|
||||
// |injection|: The details of the script which to inject.
|
||||
// |callback|: Invoked upon completion of the injection. The resulting
|
||||
// array contains the result of execution for each frame where the
|
||||
// injection succeeded.
|
||||
static void executeScript(
|
||||
ScriptInjection injection,
|
||||
optional ScriptInjectionCallback callback);
|
||||
|
||||
// Inserts a CSS stylesheet into a target context.
|
||||
// If multiple frames are specified, unsuccessful injections are ignored.
|
||||
// |injection|: The details of the styles to insert.
|
||||
// |callback|: Invoked upon completion of the insertion.
|
||||
static void insertCSS(
|
||||
CSSInjection injection,
|
||||
optional CSSInjectionCallback callback);
|
||||
|
||||
// Removes a CSS stylesheet that was previously inserted by this extension
|
||||
// from a target context.
|
||||
// |injection|: The details of the styles to remove. Note that the
|
||||
// <code>css</code>, <code>files</code>, and <code>origin</code> properties
|
||||
// must exactly match the stylesheet inserted through $(ref:insertCSS).
|
||||
// Attempting to remove a non-existent stylesheet is a no-op.
|
||||
// |callback|: A callback to be invoked upon the completion of the removal.
|
||||
static void removeCSS(
|
||||
CSSInjection injection,
|
||||
optional CSSInjectionCallback callback);
|
||||
|
||||
// Registers one or more content scripts for this extension.
|
||||
// |scripts|: Contains a list of scripts to be registered. If there are
|
||||
// errors during script parsing/file validation, or if the IDs specified
|
||||
// already exist, then no scripts are registered.
|
||||
// |callback|: A callback to be invoked once scripts have been fully
|
||||
// registered or if an error has occurred.
|
||||
static void registerContentScripts(
|
||||
RegisteredContentScript[] scripts,
|
||||
optional RegisterContentScriptsCallback callback);
|
||||
|
||||
// Returns all dynamically registered content scripts for this extension
|
||||
// that match the given filter.
|
||||
// |filter|: An object to filter the extension's dynamically registered
|
||||
// scripts.
|
||||
static void getRegisteredContentScripts(
|
||||
optional ContentScriptFilter filter,
|
||||
GetRegisteredContentScriptsCallback callback);
|
||||
|
||||
// Unregisters content scripts for this extension.
|
||||
// |filter|: If specified, only unregisters dynamic content scripts which
|
||||
// match the filter. Otherwise, all of the extension's dynamic content
|
||||
// scripts are unregistered.
|
||||
// |callback|: A callback to be invoked once scripts have been unregistered
|
||||
// or if an error has occurred.
|
||||
static void unregisterContentScripts(
|
||||
optional ContentScriptFilter filter,
|
||||
optional UnregisterContentScriptsCallback callback);
|
||||
|
||||
// Updates one or more content scripts for this extension.
|
||||
// |scripts|: Contains a list of scripts to be updated. A property is only
|
||||
// updated for the existing script if it is specified in this object. If
|
||||
// there are errors during script parsing/file validation, or if the IDs
|
||||
// specified do not correspond to a fully registered script, then no scripts
|
||||
// are updated.
|
||||
// |callback|: A callback to be invoked once scripts have been updated or
|
||||
// if an error has occurred.
|
||||
static void updateContentScripts(
|
||||
RegisteredContentScript[] scripts,
|
||||
optional RegisterContentScriptsCallback callback);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright 2020 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.search</code> API to search via the default provider.
|
||||
namespace search {
|
||||
enum Disposition {
|
||||
// Specifies that the search results display in the calling tab or the tab
|
||||
// from the active browser.
|
||||
CURRENT_TAB,
|
||||
|
||||
// Specifies that the search results display in a new tab.
|
||||
NEW_TAB,
|
||||
|
||||
// Specifies that the search results display in a new window.
|
||||
NEW_WINDOW
|
||||
};
|
||||
|
||||
dictionary QueryInfo {
|
||||
// String to query with the default search provider.
|
||||
DOMString text;
|
||||
|
||||
// Location where search results should be displayed.
|
||||
// <code>CURRENT_TAB</code> is the default.
|
||||
Disposition? disposition;
|
||||
|
||||
// Location where search results should be displayed.
|
||||
// <code>tabId<code> cannot be used with <code>disposition</code>.
|
||||
long? tabId;
|
||||
};
|
||||
|
||||
callback QueryCallback = void();
|
||||
|
||||
interface Functions {
|
||||
// Used to query the default search provider.
|
||||
// In case of an error,
|
||||
// $(ref:runtime.lastError) will be set.
|
||||
static void query(
|
||||
QueryInfo queryInfo,
|
||||
optional QueryCallback callback);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,126 @@
|
||||
// Copyright 2015 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.settingsPrivate</code> API to get or set preferences
|
||||
// from the settings UI. Access is restricted to a set of allowed user facing
|
||||
// preferences.
|
||||
namespace settingsPrivate {
|
||||
enum PrefType { BOOLEAN, NUMBER, STRING, URL, LIST, DICTIONARY };
|
||||
|
||||
enum ControlledBy {
|
||||
DEVICE_POLICY,
|
||||
USER_POLICY,
|
||||
OWNER,
|
||||
PRIMARY_USER,
|
||||
EXTENSION,
|
||||
|
||||
// Preferences are controlled by the parent of the child user.
|
||||
PARENT,
|
||||
|
||||
// Preferences are controlled neither by parent nor the child user.
|
||||
// Preference values are hard-coded values and can not be changed.
|
||||
CHILD_RESTRICTION
|
||||
};
|
||||
|
||||
enum Enforcement {
|
||||
// Value cannot be changed by user.
|
||||
ENFORCED,
|
||||
// Value can be changed, but the administrator recommends a default.
|
||||
RECOMMENDED,
|
||||
// Value is protected by a code that only parents can access. The logic to
|
||||
// require the code is NOT automatically added to a preference using this
|
||||
// enforcement. This is only used to display the correct pref indicator.
|
||||
PARENT_SUPERVISED
|
||||
};
|
||||
|
||||
dictionary PrefObject {
|
||||
// The key for the pref.
|
||||
DOMString key;
|
||||
|
||||
// The type of the pref (e.g., boolean, string, etc.).
|
||||
PrefType type;
|
||||
|
||||
// The current value of the pref.
|
||||
any? value;
|
||||
|
||||
// The policy source of the pref; an undefined value means there is no
|
||||
// policy.
|
||||
ControlledBy? controlledBy;
|
||||
|
||||
// The owner name if controlledBy == OWNER.
|
||||
// The primary user name if controlledBy == PRIMARY_USER.
|
||||
// The extension name if controlledBy == EXTENSION.
|
||||
DOMString? controlledByName;
|
||||
|
||||
// The policy enforcement of the pref; must be specified if controlledBy is
|
||||
// also present.
|
||||
Enforcement? enforcement;
|
||||
|
||||
// The recommended value if enforcement == RECOMMENDED.
|
||||
any? recommendedValue;
|
||||
|
||||
// If enforcement == ENFORCED this optionally specifies preference values
|
||||
// that are still available for selection by the user. If set, must contain
|
||||
// at least 2 distinct values, as must contain |value| and
|
||||
// |recommendedValue| (if present).
|
||||
any[]? userSelectableValues;
|
||||
|
||||
// If true, user control of the preference is disabled for reasons unrelated
|
||||
// to controlledBy (e.g. no signed-in profile is present). A false value is
|
||||
// a no-op.
|
||||
boolean? userControlDisabled;
|
||||
|
||||
// The extension ID if controlledBy == EXTENSION.
|
||||
DOMString? extensionId;
|
||||
|
||||
// Whether the controlling extension can be disabled if controlledBy ==
|
||||
// EXTENSION.
|
||||
boolean? extensionCanBeDisabled;
|
||||
};
|
||||
|
||||
callback OnPrefSetCallback = void (boolean success);
|
||||
callback GetAllPrefsCallback = void (PrefObject[] prefs);
|
||||
callback GetPrefCallback = void (PrefObject pref);
|
||||
callback GetDefaultZoomCallback = void (double zoom);
|
||||
callback SetDefaultZoomCallback = void (boolean success);
|
||||
|
||||
interface Functions {
|
||||
// Sets a pref value.
|
||||
// |name|: The name of the pref.
|
||||
// |value|: The new value of the pref.
|
||||
// |pageId|: An optional user metrics identifier.
|
||||
// |callback|: The callback for whether the pref was set or not.
|
||||
static void setPref(
|
||||
DOMString name,
|
||||
any value,
|
||||
optional DOMString pageId,
|
||||
optional OnPrefSetCallback callback);
|
||||
|
||||
// Gets an array of all the prefs.
|
||||
static void getAllPrefs(GetAllPrefsCallback callback);
|
||||
|
||||
// Gets the value of a specific pref.
|
||||
static void getPref(
|
||||
DOMString name,
|
||||
GetPrefCallback callback);
|
||||
|
||||
// Gets the default page zoom factor. Possible values are currently between
|
||||
// 0.25 and 5. For a full list, see zoom::kPresetBrowserZoomFactors.
|
||||
static void getDefaultZoom(
|
||||
GetDefaultZoomCallback callback);
|
||||
|
||||
// Sets the page zoom factor. Must be less than 0.001 different than a value
|
||||
// in zoom::kPresetBrowserZoomFactors.
|
||||
static void setDefaultZoom(
|
||||
double zoom,
|
||||
optional SetDefaultZoomCallback callback);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Fired when a set of prefs has changed.
|
||||
//
|
||||
// |prefs| The prefs that changed.
|
||||
static void onPrefsChanged(PrefObject[] prefs);
|
||||
};
|
||||
};
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// 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.
|
||||
|
||||
// Used by gnubbyd in ash and lacros. Stores small amounts of data in ash prefs
|
||||
// which is shared by ash and lacros versions of the extension.
|
||||
// TODO(b/231890240): Once Terminal SWA runs in lacros rather than ash, we can
|
||||
// migrate gnubbyd back to using chrome.storage.local and remove this private
|
||||
// API.
|
||||
[platforms=("chromeos", "lacros"),
|
||||
implemented_in="chrome/browser/extensions/api/shared_storage/shared_storage_private_api.h"]
|
||||
namespace sharedStoragePrivate {
|
||||
|
||||
callback GetCallback = void (object items);
|
||||
callback SetCallback = void ();
|
||||
callback RemoveCallback = void ();
|
||||
|
||||
interface Functions {
|
||||
// Gets all items from shared extension local storage.
|
||||
static void get(GetCallback callback);
|
||||
|
||||
// Sets given items into shared extension local storage.
|
||||
static void set(object items, SetCallback callback);
|
||||
|
||||
// Removes item from shared extension local storage.
|
||||
static void remove(
|
||||
DOMString[] keys, RemoveCallback callback);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
// 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.
|
||||
|
||||
// Use the `chrome.sidePanel` API to host content in the browser's side panel
|
||||
// alongside the main content of a webpage.
|
||||
namespace sidePanel {
|
||||
dictionary SidePanel {
|
||||
// Developer specified path for side panel display.
|
||||
DOMString default_path;
|
||||
};
|
||||
|
||||
dictionary ManifestKeys {
|
||||
SidePanel side_panel;
|
||||
};
|
||||
|
||||
// The options used when setting a side panel. Omitted properties are
|
||||
// unchanged.
|
||||
dictionary PanelOptions {
|
||||
// If specified, the side panel options will only apply to the tab with
|
||||
// this id. If omitted, these options set the default behavior (used for any
|
||||
// tab that doesn't have specific settings). Note: if the same path is set
|
||||
// for this tabId and the default tabId, then the panel for this tabId will
|
||||
// be a different instance than the panel for the default tabId.
|
||||
long? tabId;
|
||||
// The path to the side panel HTML file to use. This must be a local
|
||||
// resource within the extension package.
|
||||
DOMString? path;
|
||||
// Whether the side panel should be enabled. This is optional. The default
|
||||
// value is true.
|
||||
boolean? enabled;
|
||||
};
|
||||
|
||||
// A dictionary containing the extension's options for how its side panel
|
||||
// behaves.
|
||||
dictionary PanelBehavior {
|
||||
// Whether clicking the extension's icon will toggle showing the extension's
|
||||
// entry in the side panel. Defaults to false.
|
||||
boolean? openPanelOnActionClick;
|
||||
};
|
||||
|
||||
dictionary GetPanelOptions {
|
||||
// If specified, the side panel options for the given tab will be returned.
|
||||
// Otherwise, returns the default side panel options (used for any tab that
|
||||
// doesn't have specific settings).
|
||||
long? tabId;
|
||||
};
|
||||
|
||||
// Options for opening the side panel.
|
||||
// At least one of `tabId` or `windowId` must be specified.
|
||||
dictionary OpenOptions {
|
||||
// The window in which to open the side panel. This is only applicable if
|
||||
// the extension has a global (non-tab-specific) side panel or
|
||||
// <code>tabId</code> is also specified. This will override any
|
||||
// currently-active global side panel the user has open in the given
|
||||
// window. At least one of this or <code>tabId</code> must be provided.
|
||||
long? windowId;
|
||||
|
||||
// The tab in which to open the side panel. If the corresponding tab has
|
||||
// a tab-specific side panel, the panel will only be open for that tab.
|
||||
// If there is not a tab-specific panel, the global panel will be open in
|
||||
// the specified tab and any other tabs without a currently-open tab-
|
||||
// specific panel. This will override any currently-active side panel
|
||||
// (global or tab-specific) in the corresponding tab. At least one of this
|
||||
// or <code>windowId</code> must be provided.
|
||||
long? tabId;
|
||||
};
|
||||
|
||||
callback VoidCallback = void();
|
||||
callback PanelOptionsCallback = void(PanelOptions options);
|
||||
callback PanelBehaviorCallback = void(PanelBehavior behavior);
|
||||
|
||||
interface Functions {
|
||||
// Configures the side panel.
|
||||
// |options|: The configuration options to apply to the panel.
|
||||
// |callback|: Invoked when the options have been set.
|
||||
static void setOptions(
|
||||
PanelOptions options,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Returns the active panel configuration.
|
||||
// |options|: Specifies the context to return the configuration for.
|
||||
// |callback|: Called with the active panel configuration.
|
||||
static void getOptions(
|
||||
GetPanelOptions options,
|
||||
PanelOptionsCallback callback);
|
||||
|
||||
// Configures the extension's side panel behavior. This is an upsert
|
||||
// operation.
|
||||
// |behavior|: The new behavior to be set.
|
||||
// |callback|: Called when the new behavior has been set.
|
||||
static void setPanelBehavior(
|
||||
PanelBehavior behavior,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Returns the extension's current side panel behavior.
|
||||
// |callback|: Called with the extension's side panel behavior.
|
||||
static void getPanelBehavior(
|
||||
PanelBehaviorCallback callback);
|
||||
|
||||
// Opens the side panel for the extension.
|
||||
// This may only be called in response to a user action.
|
||||
// |options|: Specifies the context in which to open the side panel.
|
||||
// |callback|: Called when the side panel has been opened.
|
||||
static void open(
|
||||
OpenOptions options,
|
||||
VoidCallback callback);
|
||||
};
|
||||
};
|
||||
+268
@@ -0,0 +1,268 @@
|
||||
// Copyright 2023 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use this API to give the browser access to a winscard.h[1] compatible
|
||||
// PC/SC[2] implementation, which will be the backend of the browser's
|
||||
// Web Smart Card API[3].
|
||||
//
|
||||
// [1] https://pcsclite.apdu.fr/api/winscard_8h.html
|
||||
// [2] https://en.wikipedia.org/wiki/PC/SC
|
||||
// [3] https://github.com/WICG/web-smart-card/blob/main/README.md#web-idl
|
||||
//
|
||||
// TODO(crbug.com/40247152): Add API for the remaining SCard* functions.
|
||||
[platforms=("chromeos", "lacros"),
|
||||
implemented_in="chrome/browser/chromeos/extensions/smart_card_provider_private/smart_card_provider_private_api.h"]
|
||||
namespace smartCardProviderPrivate {
|
||||
|
||||
// PC/SC error codes we can expect to hit (thus a non-exhaustive list).
|
||||
// UNKNOWN means an SCARD error code that is not mapped in this enum (and
|
||||
// thus should probably be added here).
|
||||
enum ResultCode {
|
||||
SUCCESS,
|
||||
REMOVED_CARD,
|
||||
RESET_CARD,
|
||||
UNPOWERED_CARD,
|
||||
UNRESPONSIVE_CARD,
|
||||
UNSUPPORTED_CARD,
|
||||
READER_UNAVAILABLE,
|
||||
SHARING_VIOLATION,
|
||||
NOT_TRANSACTED,
|
||||
NO_SMARTCARD,
|
||||
PROTO_MISMATCH,
|
||||
SYSTEM_CANCELLED,
|
||||
NOT_READY,
|
||||
CANCELLED,
|
||||
INSUFFICIENT_BUFFER,
|
||||
INVALID_HANDLE,
|
||||
INVALID_PARAMETER,
|
||||
INVALID_VALUE,
|
||||
NO_MEMORY,
|
||||
TIMEOUT,
|
||||
UNKNOWN_READER,
|
||||
UNSUPPORTED_FEATURE,
|
||||
NO_READERS_AVAILABLE,
|
||||
SERVICE_STOPPED,
|
||||
NO_SERVICE,
|
||||
COMM_ERROR,
|
||||
INTERNAL_ERROR,
|
||||
UNKNOWN_ERROR,
|
||||
SERVER_TOO_BUSY,
|
||||
UNEXPECTED,
|
||||
SHUTDOWN,
|
||||
UNKNOWN
|
||||
};
|
||||
|
||||
// Maps to the SCARD_SHARE_* values defined in the winscard.h API.
|
||||
enum ShareMode {
|
||||
SHARED,
|
||||
EXCLUSIVE,
|
||||
DIRECT
|
||||
};
|
||||
|
||||
// What the reader should do with the card inserted in it.
|
||||
enum Disposition {
|
||||
// SCARD_LEAVE_CARD - Do nothing.
|
||||
LEAVE_CARD,
|
||||
// SCARD_RESET_CARD - Reset the card (warm reset).
|
||||
RESET_CARD,
|
||||
// SCARD_UNPOWER_CARD - Power down the card (cold reset).
|
||||
UNPOWER_CARD,
|
||||
// SCARD_EJECT_CARD - Eject the card.
|
||||
EJECT_CARD
|
||||
};
|
||||
|
||||
enum ConnectionState {
|
||||
// SCARD_ABSENT
|
||||
ABSENT,
|
||||
// SCARD_PRESENT
|
||||
PRESENT,
|
||||
// SCARD_SWALLOWED
|
||||
SWALLOWED,
|
||||
// SCARD_POWERED
|
||||
POWERED,
|
||||
// SCARD_NEGOTIABLE
|
||||
NEGOTIABLE,
|
||||
// SCARD_SPECIFIC
|
||||
SPECIFIC
|
||||
};
|
||||
|
||||
// Maps to the SCARD_STATE_* flags defined in the winscard.h API.
|
||||
dictionary ReaderStateFlags {
|
||||
boolean? unaware;
|
||||
boolean? ignore;
|
||||
boolean? changed;
|
||||
boolean? unknown;
|
||||
boolean? unavailable;
|
||||
boolean? empty;
|
||||
boolean? present;
|
||||
boolean? exclusive;
|
||||
boolean? inuse;
|
||||
boolean? mute;
|
||||
boolean? unpowered;
|
||||
};
|
||||
|
||||
// Maps to the SCARD_PROTOCOL_* flags defined in the winscard.h API.
|
||||
dictionary Protocols {
|
||||
boolean? t0;
|
||||
boolean? t1;
|
||||
boolean? raw;
|
||||
};
|
||||
|
||||
// Maps to the SCARD_PROTOCOL_* values defined in the winscard.h API.
|
||||
enum Protocol {
|
||||
UNDEFINED,
|
||||
T0,
|
||||
T1,
|
||||
RAW
|
||||
};
|
||||
|
||||
dictionary ReaderStateIn {
|
||||
DOMString reader;
|
||||
ReaderStateFlags currentState;
|
||||
// Number of card insertion and removal events that happened in this reader,
|
||||
// as known by the application.
|
||||
long currentCount;
|
||||
};
|
||||
|
||||
dictionary ReaderStateOut {
|
||||
DOMString reader;
|
||||
ReaderStateFlags eventState;
|
||||
// The actual number of card insertion and removal events that happened in
|
||||
// this reader.
|
||||
// Set to zero if not supported.
|
||||
long eventCount;
|
||||
ArrayBuffer atr;
|
||||
};
|
||||
|
||||
dictionary Timeout {
|
||||
// If absent, it means "infinite" or "never timeout"
|
||||
long? milliseconds;
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Browser requested a SCardEstablishContext call.
|
||||
// Extension must report the result to the browser by calling
|
||||
// reportEstablishContextResult.
|
||||
[maxListeners=1] static void onEstablishContextRequested(long requestId);
|
||||
|
||||
// Browser requested a SCardReleaseContext call.
|
||||
// Extension must report the result to the browser by calling
|
||||
// reportReleaseContextResult.
|
||||
[maxListeners=1] static void onReleaseContextRequested(long requestId,
|
||||
long scardContext);
|
||||
|
||||
// Browser requested a SCardListReaders call.
|
||||
// Extension must report the result to the browser by calling
|
||||
// reportListReadersResult.
|
||||
[maxListeners=1] static void onListReadersRequested(long requestId,
|
||||
long scardContext);
|
||||
|
||||
// Browser requested a SCardGetStatusChange call.
|
||||
// Extension must report the result to the browser by calling
|
||||
// reportGetStatusChangeResult.
|
||||
[maxListeners=1] static void onGetStatusChangeRequested(long requestId,
|
||||
long scardContext,
|
||||
Timeout timeout,
|
||||
ReaderStateIn[] readerStates);
|
||||
|
||||
// Browser requested a SCardCancel call.
|
||||
// Extension must report the result to the browser by calling
|
||||
// reportPlainResult.
|
||||
[maxListeners=1] static void onCancelRequested(long requestId,
|
||||
long scardContext);
|
||||
|
||||
// Browser requested a SCardConnect call.
|
||||
// Extension must report the result to the browser by calling
|
||||
// reportConnectResult.
|
||||
[maxListeners=1] static void onConnectRequested(long requestId,
|
||||
long scardContext,
|
||||
DOMString reader,
|
||||
ShareMode shareMode,
|
||||
Protocols preferredProtocols);
|
||||
|
||||
// Browser requested a SCardDisconnect call.
|
||||
// Extension must report the result to the browser by calling
|
||||
// reportPlainResult.
|
||||
[maxListeners=1] static void onDisconnectRequested(long requestId,
|
||||
long scardHandle, Disposition disposition);
|
||||
|
||||
// Browser requested a SCardTransmit call.
|
||||
// Extension must report the result to the browser by calling
|
||||
// reportDataResult.
|
||||
[maxListeners=1] static void onTransmitRequested(long requestId,
|
||||
long scardHandle, Protocol protocol, ArrayBuffer data);
|
||||
|
||||
// Browser requested a SCardControl call.
|
||||
// Extension must report the result to the browser by calling
|
||||
// reportDataResult.
|
||||
[maxListeners=1] static void onControlRequested(long requestId,
|
||||
long scardHandle, long controlCode, ArrayBuffer data);
|
||||
|
||||
// Browser requested a SCardGetAttrib call.
|
||||
// Extension must report the result to the browser by calling
|
||||
// reportDataResult.
|
||||
[maxListeners=1] static void onGetAttribRequested(long requestId,
|
||||
long scardHandle, long attribId);
|
||||
|
||||
// Browser requested a SCardSetAttrib call.
|
||||
// Extension must report the result to the browser by calling
|
||||
// reportPlainResult.
|
||||
[maxListeners=1] static void onSetAttribRequested(long requestId,
|
||||
long scardHandle, long attribId, ArrayBuffer data);
|
||||
|
||||
// Browser requested a SCardStatus call.
|
||||
// Extension must report the result to the browser by calling
|
||||
// reportStatusResult.
|
||||
[maxListeners=1] static void onStatusRequested(long requestId,
|
||||
long scardHandle);
|
||||
|
||||
// Browser requested a SCardBeginTransaction call.
|
||||
// Extension must report the result to the browser by calling
|
||||
// reportPlainResult.
|
||||
[maxListeners=1] static void onBeginTransactionRequested(long requestId,
|
||||
long scardHandle);
|
||||
|
||||
// Browser requested a SCardEndTransaction call.
|
||||
// Extension must report the result to the browser by calling
|
||||
// reportPlainResult.
|
||||
[maxListeners=1] static void onEndTransactionRequested(long requestId,
|
||||
long scardHandle, Disposition disposition);
|
||||
};
|
||||
|
||||
interface Functions {
|
||||
// Reports the result of a SCardEstablishContext call.
|
||||
static void reportEstablishContextResult(long requestId,
|
||||
long scardContext, ResultCode resultCode);
|
||||
|
||||
// Reports the result of a SCardReleaseContext call.
|
||||
static void reportReleaseContextResult(long requestId,
|
||||
ResultCode resultCode);
|
||||
|
||||
// Reports the result of a SCardListReaders call.
|
||||
static void reportListReadersResult(long requestId,
|
||||
DOMString[] readers, ResultCode resultCode);
|
||||
|
||||
// Reports the result of a SCardGetStatusChange call.
|
||||
static void reportGetStatusChangeResult(long requestId,
|
||||
ReaderStateOut[] readerStates, ResultCode resultCode);
|
||||
|
||||
// Reports the result of a call which doesn't send back any other
|
||||
// information.
|
||||
static void reportPlainResult(long requestId,
|
||||
ResultCode resultCode);
|
||||
|
||||
// Reports the result of a SCardConnect call.
|
||||
static void reportConnectResult(long requestId, long scardHandle,
|
||||
Protocol activeProtocol, ResultCode resultCode);
|
||||
|
||||
// Reports the result of a call that sends back data on success.
|
||||
static void reportDataResult(long requestId, ArrayBuffer data,
|
||||
ResultCode resultCode);
|
||||
|
||||
// Reports the result of a SCardStatus call.
|
||||
static void reportStatusResult(long requestId, DOMString readerName,
|
||||
ConnectionState state, Protocol protocol, ArrayBuffer atr,
|
||||
ResultCode resultCode);
|
||||
};
|
||||
};
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
// Copyright 2021 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// The <code>chrome.speechRecognitionPrivate</code> API allows internal
|
||||
// extensions to use either network-based or on-device speech recognition.
|
||||
[platforms=("chromeos"), implemented_in="chrome/browser/ash/extensions/speech/speech_recognition_private_api.h"]
|
||||
|
||||
namespace speechRecognitionPrivate {
|
||||
// Possible types of speech recognition.
|
||||
enum SpeechRecognitionType {
|
||||
onDevice,
|
||||
network
|
||||
};
|
||||
|
||||
// Interface for an onStop event.
|
||||
dictionary SpeechRecognitionStopEvent {
|
||||
// Optional client ID.
|
||||
long? clientId;
|
||||
};
|
||||
|
||||
// Interface for a speech recognition result event.
|
||||
dictionary SpeechRecognitionResultEvent {
|
||||
// Optional client ID.
|
||||
long? clientId;
|
||||
// The recognized phrase or sentence.
|
||||
DOMString transcript;
|
||||
// Whether the result is a final or an interim result.
|
||||
boolean isFinal;
|
||||
};
|
||||
|
||||
// Interface for a speech recognition error event.
|
||||
dictionary SpeechRecognitionErrorEvent {
|
||||
// Optional client ID.
|
||||
long? clientId;
|
||||
// A message describing the error.
|
||||
DOMString message;
|
||||
};
|
||||
|
||||
// Interface for options used when starting speech recognition.
|
||||
dictionary StartOptions {
|
||||
// An optional ID to specify the client.
|
||||
long? clientId;
|
||||
// The locale, in BCP-47 format e.g. "en-US", to use for speech recognition.
|
||||
DOMString? locale;
|
||||
// Whether interim speech results should be returned.
|
||||
boolean? interimResults;
|
||||
};
|
||||
|
||||
// Interface for options used when stopping speech recognition.
|
||||
dictionary StopOptions {
|
||||
// An optional ID to specify the client. This must match the clientId
|
||||
// used when starting speech recognition to work as intended.
|
||||
long? clientId;
|
||||
};
|
||||
|
||||
// Called when speech recognition has begun listening to the user's audio.
|
||||
// The callback's parameter specifies which type of speech recognition
|
||||
// is being used.
|
||||
callback OnStartCallback = void(SpeechRecognitionType type);
|
||||
// Called when speech recognition has stopped listening to the user's audio.
|
||||
callback OnStopCallback = void();
|
||||
|
||||
interface Functions {
|
||||
// Starts listening to audio from the user. The callback is invoked when
|
||||
// speech recognition has started. If speech recognition is already active
|
||||
// when calling start(), the callback is run with an error.
|
||||
static void start(
|
||||
StartOptions options,
|
||||
OnStartCallback callback);
|
||||
|
||||
// Stops listening to audio from the user. The callback is invoked when
|
||||
// speech recognition has stopped. If speech recognition has already stopped
|
||||
// when calling stop(), the callback is run with an error.
|
||||
static void stop(
|
||||
StopOptions options,
|
||||
OnStopCallback callback);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Fired when speech recognition stops.
|
||||
static void onStop(SpeechRecognitionStopEvent event);
|
||||
// Fired when a speech recognition result is returned.
|
||||
static void onResult(SpeechRecognitionResultEvent event);
|
||||
// Fired when a speech recognition error occurs.
|
||||
static void onError(SpeechRecognitionErrorEvent event);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
// Copyright 2012 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Manages an app's system indicator icon, an image displayed in the system's
|
||||
// menubar, system tray, or other visible area provided by the OS.
|
||||
// This is modelled after the other extension action APIs, such as
|
||||
// chrome.browserAction and chrome.pageAction.
|
||||
namespace systemIndicator {
|
||||
dictionary SetIconDetails {
|
||||
any? path;
|
||||
any? imageData;
|
||||
};
|
||||
|
||||
callback DoneCallback = void ();
|
||||
|
||||
interface Functions {
|
||||
// Set the image to be used as an indicator icon, using a set of ImageData
|
||||
// objects. These objects should have multiple resolutions so that an
|
||||
// appropriate size can be selected for the given icon size and DPI scaling
|
||||
// settings. Only square ImageData objects are accepted.
|
||||
static void setIcon(
|
||||
SetIconDetails details,
|
||||
optional DoneCallback callback);
|
||||
|
||||
// Show the icon in the status tray.
|
||||
static void enable();
|
||||
|
||||
// Hide the icon from the status tray.
|
||||
static void disable();
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Fired only when a click on the icon does not result in a menu being
|
||||
// shown.
|
||||
static void onClicked();
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
// 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.
|
||||
|
||||
// Use the <code>chrome.systemLog</code> API to record Chrome system logs from
|
||||
// extensions.
|
||||
[platforms=("chromeos", "lacros"),
|
||||
implemented_in="chrome/browser/chromeos/extensions/system_log/system_log_api.h"]
|
||||
namespace systemLog {
|
||||
callback VoidCallback = void ();
|
||||
|
||||
// Options for $(ref:add).
|
||||
// |message|: A log message to record.
|
||||
dictionary MessageOptions {
|
||||
DOMString message;
|
||||
};
|
||||
|
||||
interface Functions {
|
||||
// Adds a new log record.
|
||||
// |options|: The logging options.
|
||||
// |callback|: A callback to invoke once the log has been added.
|
||||
static void add(
|
||||
MessageOptions options,
|
||||
optional VoidCallback callback);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,130 @@
|
||||
// Copyright 2012 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.tabCapture</code> API to interact with tab media
|
||||
// streams.
|
||||
namespace tabCapture {
|
||||
|
||||
enum TabCaptureState {
|
||||
pending,
|
||||
active,
|
||||
stopped,
|
||||
error
|
||||
};
|
||||
|
||||
dictionary CaptureInfo {
|
||||
// The id of the tab whose status changed.
|
||||
long tabId;
|
||||
|
||||
// The new capture status of the tab.
|
||||
TabCaptureState status;
|
||||
|
||||
// Whether an element in the tab being captured is in fullscreen mode.
|
||||
boolean fullscreen;
|
||||
};
|
||||
|
||||
// MediaTrackConstraints for the media streams that will be passed to WebRTC.
|
||||
// See section on MediaTrackConstraints:
|
||||
// http://dev.w3.org/2011/webrtc/editor/getusermedia.html
|
||||
dictionary MediaStreamConstraint {
|
||||
object mandatory;
|
||||
object? _optional;
|
||||
};
|
||||
|
||||
// Whether we are requesting tab video and/or audio and the
|
||||
// MediaTrackConstraints that should be set for these streams.
|
||||
dictionary CaptureOptions {
|
||||
boolean? audio;
|
||||
boolean? video;
|
||||
MediaStreamConstraint? audioConstraints;
|
||||
MediaStreamConstraint? videoConstraints;
|
||||
[nodoc] DOMString? presentationId;
|
||||
};
|
||||
|
||||
dictionary GetMediaStreamOptions {
|
||||
// Optional tab id of the tab which will later invoke
|
||||
// <code>getUserMedia()</code> to consume the stream. If not specified
|
||||
// then the resulting stream can be used only by the calling extension.
|
||||
// The stream can only be used by frames in the given tab whose security
|
||||
// origin matches the consumber tab's origin. The tab's origin must be a
|
||||
// secure origin, e.g. HTTPS.
|
||||
long? consumerTabId;
|
||||
|
||||
// Optional tab id of the tab which will be captured. If not specified
|
||||
// then the current active tab will be selected. Only tabs for which the
|
||||
// extension has been granted the <code>activeTab</code> permission can be
|
||||
// used as the target tab.
|
||||
long? targetTabId;
|
||||
};
|
||||
|
||||
callback GetTabMediaCallback =
|
||||
void ([instanceOf=LocalMediaStream] object stream);
|
||||
|
||||
callback GetCapturedTabsCallback = void (CaptureInfo[] result);
|
||||
|
||||
// To assemble MediaConstraints with this |streamId|, source type must be
|
||||
// assigned as 'tab'. For example:
|
||||
// <code>
|
||||
// const constraints = {
|
||||
// mandatory: {
|
||||
// chromeMediaSource: 'tab',
|
||||
// chromeMediaSourceId: streamId
|
||||
// }
|
||||
// };
|
||||
// navigator.getUserMedia({audio: constraints, video: constraints},
|
||||
// successCallback, failCallback);
|
||||
// </code>
|
||||
callback GetMediaStreamIdCallback = void (DOMString streamId);
|
||||
|
||||
interface Functions {
|
||||
// Captures the visible area of the currently active tab. Capture can
|
||||
// only be started on the currently active tab after the extension has been
|
||||
// <em>invoked</em>, similar to the way that
|
||||
// <a href="activeTab#invoking-activeTab">activeTab</a> works.
|
||||
// Capture is maintained across page navigations within
|
||||
// the tab, and stops when the tab is closed, or the media stream is closed
|
||||
// by the extension.
|
||||
//
|
||||
// |options| : Configures the returned media stream.
|
||||
// |callback| : Callback with either the tab capture MediaStream or
|
||||
// <code>null</code>. <code>null</code> indicates an error has occurred
|
||||
// and the client may query $(ref:runtime.lastError) to access the error
|
||||
// details.
|
||||
[doesNotSupportPromises="Custom hook sets lastError crbug.com/1504349"]
|
||||
static void capture(CaptureOptions options,
|
||||
GetTabMediaCallback callback);
|
||||
|
||||
// Returns a list of tabs that have requested capture or are being
|
||||
// captured, i.e. status != stopped and status != error.
|
||||
// This allows extensions to inform the user that there is an existing
|
||||
// tab capture that would prevent a new tab capture from succeeding (or
|
||||
// to prevent redundant requests for the same tab).
|
||||
// |callback| : Callback invoked with CaptureInfo[] for captured tabs.
|
||||
static void getCapturedTabs(
|
||||
GetCapturedTabsCallback callback);
|
||||
|
||||
// Creates a stream ID to capture the target tab.
|
||||
// Similar to chrome.tabCapture.capture() method, but returns a media
|
||||
// stream ID, instead of a media stream, to the consumer tab.
|
||||
//
|
||||
// |GetMediaStreamOptions| : Options for the media stream id to retrieve.
|
||||
// |callback| : Callback to invoke with the result. If successful, the
|
||||
// result is an opaque string that can be passed to the
|
||||
// <code>getUserMedia()</code> API to generate a media stream that
|
||||
// corresponds to the target tab. The created <code>streamId</code> can
|
||||
// only be used once and expires after a few seconds if it is not used.
|
||||
static void getMediaStreamId(
|
||||
optional GetMediaStreamOptions options,
|
||||
GetMediaStreamIdCallback callback);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Event fired when the capture status of a tab changes.
|
||||
// This allows extension authors to keep track of the capture status of
|
||||
// tabs to keep UI elements like page actions in sync.
|
||||
// |info| : CaptureInfo with new capture status for the tab.
|
||||
static void onStatusChanged(CaptureInfo info);
|
||||
};
|
||||
|
||||
};
|
||||
@@ -0,0 +1,77 @@
|
||||
// Copyright 2015 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.usersPrivate</code> API to manage users.
|
||||
[platforms=("chromeos"),
|
||||
implemented_in="chrome/browser/ash/extensions/users_private/users_private_api.h"]
|
||||
namespace usersPrivate {
|
||||
|
||||
dictionary User {
|
||||
// Email for the user.
|
||||
DOMString email;
|
||||
|
||||
// Display email for the user.
|
||||
DOMString displayEmail;
|
||||
|
||||
// Display name for the user.
|
||||
DOMString name;
|
||||
|
||||
// Whether this user is the device owner.
|
||||
boolean isOwner;
|
||||
|
||||
// Whether this user is Child.
|
||||
boolean isChild;
|
||||
};
|
||||
|
||||
dictionary LoginStatusDict {
|
||||
// True if a user is logged in (including guest, public session, etc).
|
||||
boolean isLoggedIn;
|
||||
|
||||
// True if the screen is locked.
|
||||
boolean isScreenLocked;
|
||||
};
|
||||
|
||||
callback UsersCallback = void (User[] users);
|
||||
callback UserAddedCallback = void (boolean success);
|
||||
callback UserRemovedCallback = void (boolean success);
|
||||
callback ManagedCallback = void (boolean managed);
|
||||
callback UserCallback = void (User user);
|
||||
callback LoginStatusCallback = void (LoginStatusDict status);
|
||||
callback IsUserInListCallback = void (boolean found);
|
||||
|
||||
interface Functions {
|
||||
// Gets a list of known users.
|
||||
static void getUsers(UsersCallback callback);
|
||||
|
||||
// Checks to see if the user is already present in the user list.
|
||||
static void isUserInList(
|
||||
DOMString email,
|
||||
IsUserInListCallback callback);
|
||||
|
||||
// Adds a new user with the given email to the user list.
|
||||
// The callback is called with true if the user was added succesfully, or
|
||||
// with false if not (e.g. because the user was already present, or the
|
||||
// current user isn't the owner).
|
||||
static void addUser(
|
||||
DOMString email,
|
||||
UserAddedCallback callback);
|
||||
|
||||
// Removes the user with the given email from the user list.
|
||||
// The callback is called with true if the user was removed succesfully, or
|
||||
// with false if not (e.g. because the user was not already present, or
|
||||
// the current user isn't the owner).
|
||||
static void removeUser(
|
||||
DOMString email,
|
||||
UserRemovedCallback callback);
|
||||
|
||||
// Whether the user list is managed by enterprise.
|
||||
static void isUserListManaged(ManagedCallback callback);
|
||||
|
||||
// Returns the current user.
|
||||
static void getCurrentUser(UserCallback callback);
|
||||
|
||||
// Get login status.
|
||||
static void getLoginStatus(LoginStatusCallback callback);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,201 @@
|
||||
// Copyright 2014 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.vpnProvider</code> API to implement a VPN
|
||||
// client.
|
||||
[platforms=("chromeos", "lacros"),
|
||||
implemented_in="chrome/browser/chromeos/extensions/vpn_provider/vpn_provider_api.h"]
|
||||
namespace vpnProvider {
|
||||
// A parameters class for the VPN interface.
|
||||
dictionary Parameters {
|
||||
// IP address for the VPN interface in CIDR notation.
|
||||
// IPv4 is currently the only supported mode.
|
||||
DOMString address;
|
||||
// Broadcast address for the VPN interface. (default: deduced
|
||||
// from IP address and mask)
|
||||
DOMString? broadcastAddress;
|
||||
// MTU setting for the VPN interface. (default: 1500 bytes)
|
||||
DOMString? mtu;
|
||||
// Exclude network traffic to the list of IP blocks in CIDR notation from
|
||||
// the tunnel. This can be used to bypass traffic to and from the VPN
|
||||
// server.
|
||||
// When many rules match a destination, the rule with the longest matching
|
||||
// prefix wins.
|
||||
// Entries that correspond to the same CIDR block are treated as duplicates.
|
||||
// Such duplicates in the collated (exclusionList + inclusionList) list are
|
||||
// eliminated and the exact duplicate entry that will be eliminated is
|
||||
// undefined.
|
||||
DOMString[] exclusionList;
|
||||
// Include network traffic to the list of IP blocks in CIDR notation to the
|
||||
// tunnel. This parameter can be used to set up a split tunnel. By default
|
||||
// no traffic is directed to the tunnel. Adding the entry "0.0.0.0/0" to
|
||||
// this list gets all the user traffic redirected to the tunnel.
|
||||
// When many rules match a destination, the rule with the longest matching
|
||||
// prefix wins.
|
||||
// Entries that correspond to the same CIDR block are treated as duplicates.
|
||||
// Such duplicates in the collated (exclusionList + inclusionList) list are
|
||||
// eliminated and the exact duplicate entry that will be eliminated is
|
||||
// undefined.
|
||||
DOMString[] inclusionList;
|
||||
// A list of search domains. (default: no search domain)
|
||||
DOMString[]? domainSearch;
|
||||
// A list of IPs for the DNS servers.
|
||||
DOMString[] dnsServers;
|
||||
// Whether or not the VPN extension implements auto-reconnection.
|
||||
//
|
||||
// If true, the <code>linkDown</code>, <code>linkUp</code>,
|
||||
// <code>linkChanged</code>, <code>suspend</code>, and <code>resume</code>
|
||||
// platform messages will be used to signal the respective events.
|
||||
// If false, the system will forcibly disconnect the VPN if the network
|
||||
// topology changes, and the user will need to reconnect manually.
|
||||
// (default: false)
|
||||
//
|
||||
// This property is new in Chrome 51; it will generate an exception in
|
||||
// earlier versions. try/catch can be used to conditionally enable the
|
||||
// feature based on browser support.
|
||||
DOMString? reconnect;
|
||||
};
|
||||
|
||||
// The enum is used by the platform to notify the client of the VPN session
|
||||
// status.
|
||||
enum PlatformMessage {
|
||||
// Indicates that the VPN configuration connected.
|
||||
connected,
|
||||
// Indicates that the VPN configuration disconnected.
|
||||
disconnected,
|
||||
// Indicates that an error occurred in VPN connection, for example a timeout. A description
|
||||
// of the error is given as the <a href="#property-onPlatformMessage-error">
|
||||
// error argument to onPlatformMessage</a>.
|
||||
error,
|
||||
// Indicates that the default physical network connection is down.
|
||||
linkDown,
|
||||
// Indicates that the default physical network connection is back up.
|
||||
linkUp,
|
||||
// Indicates that the default physical network connection changed, e.g. wifi->mobile.
|
||||
linkChanged,
|
||||
// Indicates that the OS is preparing to suspend, so the VPN should drop its connection.
|
||||
// The extension is not guaranteed to receive this event prior to
|
||||
// suspending.
|
||||
suspend,
|
||||
// Indicates that the OS has resumed and the user has logged back in, so the VPN should
|
||||
// try to reconnect.
|
||||
resume
|
||||
};
|
||||
|
||||
// The enum is used by the VPN client to inform the platform
|
||||
// of its current state. This helps provide meaningful messages
|
||||
// to the user.
|
||||
enum VpnConnectionState {
|
||||
// Specifies that VPN connection was successful.
|
||||
connected,
|
||||
// Specifies that VPN connection has failed.
|
||||
failure
|
||||
};
|
||||
|
||||
// The enum is used by the platform to indicate the event that triggered
|
||||
// <code>onUIEvent</code>.
|
||||
enum UIEvent {
|
||||
// Requests that the VPN client show the add configuration dialog box to
|
||||
// the user.
|
||||
showAddDialog,
|
||||
// Requests that the VPN client show the configuration settings dialog box
|
||||
// to the user.
|
||||
showConfigureDialog
|
||||
};
|
||||
|
||||
// The callback is used by <code>setParameters, sendPacket</code>
|
||||
// to signal completion. The callback is called with
|
||||
// <code>chrome.runtime.lastError</code> set to error code if
|
||||
// there is an error.
|
||||
[inline_doc] callback CallCompleteCallback = void ();
|
||||
|
||||
// The callback is used by <code>createConfig</code> to signal completion.
|
||||
// The callback is called with <code>chrome.runtime.lastError</code> set to
|
||||
// an error code if there is an error.
|
||||
// |id|: A unique ID for the created configuration, or <code>undefined</code>
|
||||
// on failure.
|
||||
[inline_doc] callback CreateConfigCompleteCallback = void (DOMString id);
|
||||
|
||||
interface Functions {
|
||||
// Creates a new VPN configuration that persists across multiple login
|
||||
// sessions of the user.
|
||||
// |name|: The name of the VPN configuration.
|
||||
// |callback|: Called when the configuration is created or if there is an
|
||||
// error.
|
||||
static void createConfig(
|
||||
DOMString name,
|
||||
CreateConfigCompleteCallback callback);
|
||||
|
||||
// Destroys a VPN configuration created by the extension.
|
||||
// |id|: ID of the VPN configuration to destroy.
|
||||
// |callback|: Called when the configuration is destroyed or if there is an
|
||||
// error.
|
||||
static void destroyConfig(
|
||||
DOMString id,
|
||||
optional CallCompleteCallback callback);
|
||||
|
||||
// Sets the parameters for the VPN session. This should be called
|
||||
// immediately after <code>"connected"</code> is received from the platform.
|
||||
// This will succeed only when the VPN session is owned by the extension.
|
||||
// |parameters|: The parameters for the VPN session.
|
||||
// |callback|: Called when the parameters are set or if there is an error.
|
||||
static void setParameters(
|
||||
Parameters parameters,
|
||||
CallCompleteCallback callback);
|
||||
|
||||
// Sends an IP packet through the tunnel created for the VPN session.
|
||||
// This will succeed only when the VPN session is owned by the extension.
|
||||
// |data|: The IP packet to be sent to the platform.
|
||||
// |callback|: Called when the packet is sent or if there is an error.
|
||||
static void sendPacket(
|
||||
ArrayBuffer data,
|
||||
optional CallCompleteCallback callback);
|
||||
|
||||
// Notifies the VPN session state to the platform.
|
||||
// This will succeed only when the VPN session is owned by the extension.
|
||||
// |state|: The VPN session state of the VPN client.
|
||||
// |callback|: Called when the notification is complete or if there is an
|
||||
// error.
|
||||
static void notifyConnectionStateChanged(
|
||||
VpnConnectionState state,
|
||||
optional CallCompleteCallback callback);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Triggered when a message is received from the platform for a
|
||||
// VPN configuration owned by the extension.
|
||||
// |id|: ID of the configuration the message is intended for.
|
||||
// |message|: The message received from the platform. Note that new
|
||||
// message types may be added in future Chrome versions to support new
|
||||
// features.
|
||||
// |error|: Error message when there is an error.
|
||||
static void onPlatformMessage(DOMString id,
|
||||
PlatformMessage message,
|
||||
DOMString error);
|
||||
|
||||
// Triggered when an IP packet is received via the tunnel for the VPN
|
||||
// session owned by the extension.
|
||||
// |data|: The IP packet received from the platform.
|
||||
static void onPacketReceived(ArrayBuffer data);
|
||||
|
||||
// Triggered when a configuration created by the extension is removed by the
|
||||
// platform.
|
||||
// |id|: ID of the removed configuration.
|
||||
static void onConfigRemoved(DOMString id);
|
||||
|
||||
// Triggered when a configuration is created by the platform for the
|
||||
// extension.
|
||||
// |id|: ID of the configuration created.
|
||||
// |name|: Name of the configuration created.
|
||||
// |data|: Configuration data provided by the administrator.
|
||||
static void onConfigCreated(DOMString id, DOMString name, object data);
|
||||
|
||||
// Triggered when there is a UI event for the extension. UI events are
|
||||
// signals from the platform that indicate to the app that a UI dialog
|
||||
// needs to be shown to the user.
|
||||
// |event|: The UI event that is triggered.
|
||||
// |id|: ID of the configuration for which the UI event was triggered.
|
||||
static void onUIEvent(UIEvent event, optional DOMString id);
|
||||
};
|
||||
};
|
||||
+196
@@ -0,0 +1,196 @@
|
||||
// Copyright 2021 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// The <code>chrome.webAuthenticationProxy</code> API lets remote desktop
|
||||
// software running on a remote host intercept Web Authentication API
|
||||
// (WebAuthn) requests in order to handle them on a local client.
|
||||
namespace webAuthenticationProxy {
|
||||
// An object representing a
|
||||
// <code>PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()</code>
|
||||
// call.
|
||||
dictionary IsUvpaaRequest {
|
||||
// An opaque identifier for the request.
|
||||
long requestId;
|
||||
};
|
||||
|
||||
// An object representing a WebAuthn
|
||||
// <code>navigator.credentials.create()</code> call.
|
||||
dictionary CreateRequest {
|
||||
// An opaque identifier for the request.
|
||||
long requestId;
|
||||
|
||||
// The <code>PublicKeyCredentialCreationOptions</code> passed to
|
||||
// <code>navigator.credentials.create()</code>, serialized as a JSON
|
||||
// string. The serialization format is compatible with <a
|
||||
// href="https://w3c.github.io/webauthn/#sctn-parseCreationOptionsFromJSON">
|
||||
// <code>PublicKeyCredential.parseCreationOptionsFromJSON()</code></a>.
|
||||
DOMString requestDetailsJson;
|
||||
};
|
||||
|
||||
// An object representing a WebAuthn <code>navigator.credentials.get()</code>
|
||||
// call.
|
||||
dictionary GetRequest {
|
||||
// An opaque identifier for the request.
|
||||
long requestId;
|
||||
|
||||
// The <code>PublicKeyCredentialRequestOptions</code> passed to
|
||||
// <code>navigator.credentials.get()</code>, serialized as a JSON string.
|
||||
// The serialization format is compatible with <a
|
||||
// href="https://w3c.github.io/webauthn/#sctn-parseRequestOptionsFromJSON">
|
||||
// <code>PublicKeyCredential.parseRequestOptionsFromJSON()</code></a>.
|
||||
DOMString requestDetailsJson;
|
||||
};
|
||||
|
||||
// This interface defines Events that fire when any website makes a WebAuthn
|
||||
// request. Regular processing of WebAuthn requests in the local Chrome
|
||||
// instance is disabled when these events are subscribed to.
|
||||
interface Events {
|
||||
// A native application associated with this extension can cause this
|
||||
// event to be fired by writing to a file with a name equal to the
|
||||
// extension's ID in a directory named
|
||||
// <code>WebAuthenticationProxyRemoteSessionStateChange</code> inside the
|
||||
// <a
|
||||
// href="https://chromium.googlesource.com/chromium/src/+/main/docs/user_data_dir.md#default-location">default
|
||||
// user data directory</a>
|
||||
//
|
||||
// The contents of the file should be empty. I.e., it is not necessary to
|
||||
// change the contents of the file in order to trigger this event.
|
||||
//
|
||||
// The native host application may use this event mechanism to signal a
|
||||
// possible remote session state change (i.e. from detached to attached, or
|
||||
// vice versa) while the extension service worker is possibly suspended. In
|
||||
// the handler for this event, the extension can call the
|
||||
// <code>attach()</code> or <code>detach()</code> API methods accordingly.
|
||||
//
|
||||
// The event listener must be registered synchronously at load time.
|
||||
static void onRemoteSessionStateChange();
|
||||
|
||||
// Fires when a WebAuthn <code>navigator.credentials.create()</code> call
|
||||
// occurs. The extension must supply a response by calling
|
||||
// <code>completeCreateRequest()</code> with the <code>requestId</code> from
|
||||
// <code>requestInfo</code>.
|
||||
static void onCreateRequest(CreateRequest requestInfo);
|
||||
|
||||
// Fires when a WebAuthn navigator.credentials.get() call occurs. The
|
||||
// extension must supply a response by calling
|
||||
// <code>completeGetRequest()</code> with the <code>requestId</code> from
|
||||
// <code>requestInfo</code>
|
||||
static void onGetRequest(GetRequest requestInfo);
|
||||
|
||||
// Fires when a
|
||||
// <code>PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()</code>
|
||||
// call occurs. The extension must supply a response by calling
|
||||
// <code>completeIsUvpaaRequest()</code> with the <code>requestId</code>
|
||||
// from <code>requestInfo</code>
|
||||
static void onIsUvpaaRequest(IsUvpaaRequest requestInfo);
|
||||
|
||||
// Fires when a <code>onCreateRequest</code> or <code>onGetRequest</code>
|
||||
// event is canceled (because the WebAuthn request was aborted by the
|
||||
// caller, or because it timed out). When receiving this event, the
|
||||
// extension should cancel processing of the corresponding request on the
|
||||
// client side. Extensions cannot complete a request once it has been
|
||||
// canceled.
|
||||
static void onRequestCanceled(long requestId);
|
||||
};
|
||||
|
||||
callback ErrorCallback = void(optional DOMString error);
|
||||
callback VoidCallback = void();
|
||||
|
||||
dictionary DOMExceptionDetails {
|
||||
DOMString name;
|
||||
DOMString message;
|
||||
};
|
||||
|
||||
dictionary CreateResponseDetails {
|
||||
// The <code>requestId</code> of the <code>CreateRequest</code>.
|
||||
long requestId;
|
||||
|
||||
// The <code>DOMException</code> yielded by the remote request, if any.
|
||||
DOMExceptionDetails? error;
|
||||
|
||||
// The <code>PublicKeyCredential</code>, yielded by the remote request, if
|
||||
// any, serialized as a JSON string by calling
|
||||
// href="https://w3c.github.io/webauthn/#dom-publickeycredential-tojson">
|
||||
// <code>PublicKeyCredential.toJSON()</code></a>.
|
||||
DOMString? responseJson;
|
||||
};
|
||||
|
||||
dictionary GetResponseDetails {
|
||||
// The <code>requestId</code> of the <code>CreateRequest</code>.
|
||||
long requestId;
|
||||
|
||||
// The <code>DOMException</code> yielded by the remote request, if any.
|
||||
DOMExceptionDetails? error;
|
||||
|
||||
// The <code>PublicKeyCredential</code>, yielded by the remote request, if
|
||||
// any, serialized as a JSON string by calling
|
||||
// href="https://w3c.github.io/webauthn/#dom-publickeycredential-tojson">
|
||||
// <code>PublicKeyCredential.toJSON()</code></a>.
|
||||
DOMString? responseJson;
|
||||
};
|
||||
|
||||
dictionary IsUvpaaResponseDetails {
|
||||
long requestId;
|
||||
boolean isUvpaa;
|
||||
};
|
||||
|
||||
interface Functions {
|
||||
// Reports the result of a <code>navigator.credentials.create()</code>
|
||||
// call. The extension must call this for every
|
||||
// <code>onCreateRequest</code> event it has received, unless the request
|
||||
// was canceled (in which case, an <code>onRequestCanceled</code> event is
|
||||
// fired).
|
||||
static void completeCreateRequest(
|
||||
CreateResponseDetails details,
|
||||
VoidCallback callback);
|
||||
|
||||
// Reports the result of a <code>navigator.credentials.get()</code> call.
|
||||
// The extension must call this for every <code>onGetRequest</code> event
|
||||
// it has received, unless the request was canceled (in which case, an
|
||||
// <code>onRequestCanceled</code> event is fired).
|
||||
static void completeGetRequest(
|
||||
GetResponseDetails details,
|
||||
VoidCallback callback);
|
||||
|
||||
// Reports the result of a
|
||||
// <code>PublicKeyCredential.isUserVerifyingPlatformAuthenticator()</code>
|
||||
// call. The extension must call this for every
|
||||
// <code>onIsUvpaaRequest</code> event it has received.
|
||||
static void completeIsUvpaaRequest(
|
||||
IsUvpaaResponseDetails details,
|
||||
VoidCallback callback);
|
||||
|
||||
// Makes this extension the active Web Authentication API request proxy.
|
||||
//
|
||||
// Remote desktop extensions typically call this method after detecting
|
||||
// attachment of a remote session to this host. Once this method returns
|
||||
// without error, regular processing of WebAuthn requests is suspended, and
|
||||
// events from this extension API are raised.
|
||||
//
|
||||
// This method fails with an error if a different extension is already
|
||||
// attached.
|
||||
//
|
||||
// The attached extension must call <code>detach()</code> once the remote
|
||||
// desktop session has ended in order to resume regular WebAuthn request
|
||||
// processing. Extensions automatically become detached if they are
|
||||
// unloaded.
|
||||
//
|
||||
// Refer to the <code>onRemoteSessionStateChange</code> event for signaling
|
||||
// a change of remote session attachment from a native application to to
|
||||
// the (possibly suspended) extension.
|
||||
static void attach(ErrorCallback callback);
|
||||
|
||||
// Removes this extension from being the active Web Authentication API
|
||||
// request proxy.
|
||||
//
|
||||
// This method is typically called when the extension detects that a remote
|
||||
// desktop session was terminated. Once this method returns, the extension
|
||||
// ceases to be the active Web Authentication API request proxy.
|
||||
//
|
||||
// Refer to the <code>onRemoteSessionStateChange</code> event for signaling
|
||||
// a change of remote session attachment from a native application to to
|
||||
// the (possibly suspended) extension.
|
||||
static void detach(ErrorCallback callback);
|
||||
};
|
||||
};
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
// Copyright 2013 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// The <code>chrome.webrtcAudioPrivate</code> API allows enumeration
|
||||
// of audio output (sink) devices.
|
||||
//
|
||||
// Note that device IDs as used in this API are opaque (i.e. they are
|
||||
// not the hardware identifier of the device) and while they are
|
||||
// unique and persistent across sessions, they are valid only to the
|
||||
// extension calling this API (i.e. they cannot be shared between
|
||||
// extensions).
|
||||
//
|
||||
// See http://goo.gl/8rOmgk for further documentation of this API.
|
||||
|
||||
namespace webrtcAudioPrivate {
|
||||
|
||||
dictionary SinkInfo {
|
||||
// The opaque identifier of the audio sink device, which is unique
|
||||
// and static for the extension calling the API but invalid for
|
||||
// others.
|
||||
DOMString sinkId;
|
||||
// The user-friendly name (e.g. "Bose Amplifier").
|
||||
DOMString sinkLabel;
|
||||
// Current sample rate of the device, in Hz. Useful e.g. to know
|
||||
// if the remote side should be asked to send a lower sampling
|
||||
// rate.
|
||||
long sampleRate;
|
||||
// True if the device is ready to play out audio. E.g. if it is a
|
||||
// device that takes an audio jack, whether a jack is plugged in.
|
||||
//
|
||||
// TODO(joi): Do unplugged devices even get included in enumeration?
|
||||
boolean isReady;
|
||||
// True if this device is the default audio sink device on the
|
||||
// machine.
|
||||
boolean isDefault;
|
||||
};
|
||||
|
||||
callback GetSinksCallback = void(SinkInfo[] sinkInfo);
|
||||
callback SinkIdCallback = void(DOMString sinkId);
|
||||
|
||||
interface Functions {
|
||||
// Retrieves a list of available audio sink devices.
|
||||
static void getSinks(GetSinksCallback callback);
|
||||
|
||||
// Given a security origin and an input device ID valid for that
|
||||
// security origin, retrieve an audio sink ID valid for the
|
||||
// extension, or the empty string if there is no associated audio
|
||||
// sink.
|
||||
//
|
||||
// The associated sink ID can be used as a sink ID for
|
||||
// setActiveSink. It is valid irrespective of which process you are
|
||||
// setting the active sink for.
|
||||
static void getAssociatedSink(
|
||||
DOMString securityOrigin,
|
||||
DOMString sourceIdInOrigin,
|
||||
SinkIdCallback callback);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Fired when audio sink devices are added or removed.
|
||||
static void onSinksChanged();
|
||||
};
|
||||
};
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// Copyright 2015 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.webrtcDesktopCapturePrivate</code> API to capture
|
||||
// desktop media requested from a WebView.
|
||||
namespace webrtcDesktopCapturePrivate {
|
||||
dictionary RequestInfo {
|
||||
// The guest process id for the requester.
|
||||
long guestProcessId;
|
||||
|
||||
// The webview render frame id for the requester.
|
||||
long guestRenderFrameId;
|
||||
};
|
||||
|
||||
enum DesktopCaptureSourceType {
|
||||
screen,
|
||||
window,
|
||||
tab
|
||||
};
|
||||
|
||||
callback chooseDesktopMediaCallback = void (DOMString streamId);
|
||||
|
||||
interface Functions {
|
||||
// Shows desktop media picker UI with the specified set of sources.
|
||||
[doesNotSupportPromises="Synchronous return and callback crbug.com/1143032"]
|
||||
static long chooseDesktopMedia(DesktopCaptureSourceType[] sources,
|
||||
RequestInfo request,
|
||||
chooseDesktopMediaCallback callback);
|
||||
|
||||
// Hides desktop media picker dialog shown by chooseDesktopMedia().
|
||||
static void cancelChooseDesktopMedia(long desktopMediaRequestId);
|
||||
};
|
||||
};
|
||||
+186
@@ -0,0 +1,186 @@
|
||||
// Copyright 2013 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.webrtcLoggingPrivate</code> API to control diagnostic
|
||||
// WebRTC logging.
|
||||
namespace webrtcLoggingPrivate {
|
||||
dictionary MetaDataEntry {
|
||||
// The meta data entry key.
|
||||
DOMString key;
|
||||
|
||||
// The meta data entry value.
|
||||
DOMString value;
|
||||
};
|
||||
|
||||
dictionary UploadResult {
|
||||
// The report ID for the uploaded log. Will be empty if not successful.
|
||||
DOMString reportId;
|
||||
};
|
||||
|
||||
dictionary RequestInfo {
|
||||
// The tab identifier from the chrome.tabs API, if the request is from a
|
||||
// tab.
|
||||
long? tabId;
|
||||
|
||||
// The guest process id for the requester, if the request is from a
|
||||
// webview.
|
||||
long? guestProcessId;
|
||||
|
||||
// Use the render process of the webview in the current page. This allows an
|
||||
// app to make a request for a webview it contains. If there are more or
|
||||
// less than 1 webview, this will fail with a runtime error.
|
||||
boolean? targetWebview;
|
||||
};
|
||||
|
||||
// This contains information about the result of audio debug recordings.
|
||||
dictionary RecordingInfo {
|
||||
// Absolute path prefix for the files with the audio debug recordings.
|
||||
DOMString prefixPath;
|
||||
|
||||
// Indicates if recording was stopped (either by a timed callback after the
|
||||
// time limit has elapsed, or by a manual call).
|
||||
boolean didStop;
|
||||
|
||||
// Indicates if recording was stopped manually through a
|
||||
// stopAudioDebugRecordings() call.
|
||||
boolean didManualStop;
|
||||
};
|
||||
|
||||
dictionary StartEventLoggingResult {
|
||||
// The log ID. Non-empty if and only if StartEventLogging() was successful.
|
||||
DOMString logId;
|
||||
};
|
||||
|
||||
callback GenericDoneCallback = void ();
|
||||
callback RecordingDoneCallback = void (RecordingInfo info);
|
||||
callback UploadDoneCallback = void (UploadResult result);
|
||||
callback GetLogsDirectoryCallback = void ([instanceOf = DirectoryEntry] object entry);
|
||||
callback StartEventLoggingCallback = void (StartEventLoggingResult result);
|
||||
|
||||
interface Functions {
|
||||
// For all functions, |request| determines which render process to apply
|
||||
// the operation on. |request| identifies the requesting process.
|
||||
// |securityOrigin| is the security origin for the tab identified by |tabId|
|
||||
// and is used for verifying that the tab is the correct one and has not
|
||||
// been navigated away from.
|
||||
|
||||
// Sets additional custom meta data that will be uploaded along with the
|
||||
// log. |metaData| is a dictionary of the metadata (key, value).
|
||||
static void setMetaData(RequestInfo request,
|
||||
DOMString securityOrigin,
|
||||
MetaDataEntry[] metaData,
|
||||
GenericDoneCallback callback);
|
||||
|
||||
// Starts logging. If logging has already been started for this render
|
||||
// process, the call will be ignored. |appSessionId| is the unique session
|
||||
// ID which will be added to the log.
|
||||
static void start(RequestInfo request,
|
||||
DOMString securityOrigin,
|
||||
GenericDoneCallback callback);
|
||||
|
||||
// Sets whether the log should be uploaded automatically for the case when
|
||||
// the render process goes away (tab is closed or crashes) and stop has not
|
||||
// been called before that. If |shouldUpload| is true it will be uploaded,
|
||||
// otherwise it will be discarded. The default setting is to discard it.
|
||||
static void setUploadOnRenderClose(RequestInfo request,
|
||||
DOMString securityOrigin,
|
||||
boolean shouldUpload);
|
||||
|
||||
// Stops logging. After stop has finished, either upload() or discard()
|
||||
// should be called, otherwise the log will be kept in memory until the
|
||||
// render process is closed or logging restarted.
|
||||
static void stop(RequestInfo request,
|
||||
DOMString securityOrigin,
|
||||
GenericDoneCallback callback);
|
||||
|
||||
// Stores the current log without uploading. The log may stay around for
|
||||
// as much as 5 days. The application has the option of supplying an id
|
||||
// for uniquely identifying the log for later upload via a call to
|
||||
// uploadStored().
|
||||
static void store(RequestInfo request,
|
||||
DOMString securityOrigin,
|
||||
DOMString logId,
|
||||
GenericDoneCallback callback);
|
||||
|
||||
// Uploads a previously kept log that was stored via a call to store().
|
||||
// The caller needs to know the logId as was originally provided in the
|
||||
// call to store().
|
||||
static void uploadStored(RequestInfo request,
|
||||
DOMString securityOrigin,
|
||||
DOMString logId,
|
||||
UploadDoneCallback callback);
|
||||
|
||||
// Uploads the log and the RTP dumps, if they exist. Logging and RTP dumping
|
||||
// must be stopped before this function is called.
|
||||
static void upload(RequestInfo request,
|
||||
DOMString securityOrigin,
|
||||
UploadDoneCallback callback);
|
||||
|
||||
// Discards the log. Logging must be stopped before this function is called.
|
||||
static void discard(RequestInfo request,
|
||||
DOMString securityOrigin,
|
||||
GenericDoneCallback callback);
|
||||
|
||||
// Starts RTP dumping. If it has already been started for this render
|
||||
// process, the call will be ignored.
|
||||
static void startRtpDump(RequestInfo request,
|
||||
DOMString securityOrigin,
|
||||
boolean incoming,
|
||||
boolean outgoing,
|
||||
GenericDoneCallback callback);
|
||||
|
||||
// Stops RTP dumping. After stop has finished, the dumps will be
|
||||
// uploaded with the log if upload is called. Otherwise, the dumps will be
|
||||
// discarded.
|
||||
static void stopRtpDump(RequestInfo request,
|
||||
DOMString securityOrigin,
|
||||
boolean incoming,
|
||||
boolean outgoing,
|
||||
GenericDoneCallback callback);
|
||||
|
||||
// Starts audio debug recordings.
|
||||
// |seconds| indicates how many seconds of audio to record. |callback|
|
||||
// is invoked once recording stops.
|
||||
// If |seconds| is zero, recording will continue until
|
||||
// stopAudioDebugRecordings() is explicitly called. In this case,
|
||||
// |callback| is invoked once recording starts and will report
|
||||
// that recording has not stopped.
|
||||
// If |seconds| is negative, startAudioDebugRecordings() fails.
|
||||
static void startAudioDebugRecordings(RequestInfo request,
|
||||
DOMString securityOrigin,
|
||||
long seconds,
|
||||
RecordingDoneCallback callback);
|
||||
|
||||
// Stops audio debug recordings. |callback| is invoked once recording
|
||||
// stops. If there is no recording in progress, stopAudioDebugRecordings()
|
||||
// fails.
|
||||
static void stopAudioDebugRecordings(RequestInfo request,
|
||||
DOMString securityOrigin,
|
||||
RecordingDoneCallback callback);
|
||||
|
||||
// Start remote-bound event logging for a specific peer connection,
|
||||
// indicated by its session description's ID.
|
||||
// If successful, the callback will carry the ID of the log.
|
||||
// * |webAppId| must be a number between 1 and 99 (inclusive), which will be
|
||||
// incorporated into the uploaded log, so as to help distinugish logs
|
||||
// captured by different web-apps.
|
||||
// * |outputPeriodMs| refers to the time between emissions of logs.
|
||||
// Only non-negative values are allowed. If set to zero, logs will be
|
||||
// produced as soon as an event occurs. If positive, events will be
|
||||
// batched together and emitted approximately every |outputPeriodMs| ms.
|
||||
static void startEventLogging(RequestInfo request,
|
||||
DOMString securityOrigin,
|
||||
DOMString sessionId,
|
||||
long maxLogSizeBytes,
|
||||
long outputPeriodMs,
|
||||
long webAppId,
|
||||
StartEventLoggingCallback callback);
|
||||
|
||||
// Returns the directory entry for the "WebRTC Logs" directory. If the
|
||||
// directory doesn't exist yet, this will create it. If the directory
|
||||
// cannot be created, this call will fail with a runtime error.
|
||||
[doesNotSupportPromises="Custom hook sets lastError crbug.com/1504349"]
|
||||
static void getLogsDirectory(GetLogsDirectoryCallback callback);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,145 @@
|
||||
// Copyright 2021 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Private API for trusted extensions/apps to do desk related operations.
|
||||
[platforms=("chromeos","lacros"),
|
||||
implemented_in="chrome/browser/chromeos/extensions/wm/wm_desks_private_api.h"]
|
||||
namespace wmDesksPrivate {
|
||||
enum SavedDeskType {
|
||||
// Desk saved for regular desk template.
|
||||
kTemplate,
|
||||
|
||||
// Desk saved for Save & Recall.
|
||||
kSaveAndRecall,
|
||||
|
||||
// Unknown desk type.
|
||||
kUnknown
|
||||
};
|
||||
|
||||
dictionary RemoveDeskOptions {
|
||||
// Define whether close all windows on the desk and combine them to the
|
||||
// active desk to the left.
|
||||
boolean combineDesks;
|
||||
|
||||
// Define whether removed desk is retrievable.
|
||||
boolean? allowUndo;
|
||||
};
|
||||
|
||||
dictionary Desk {
|
||||
// Unique ID for a desk.
|
||||
DOMString deskUuid;
|
||||
|
||||
// User readable name of the desk.
|
||||
DOMString deskName;
|
||||
};
|
||||
|
||||
dictionary SavedDesk {
|
||||
// Unique ID for a saved desk.
|
||||
DOMString savedDeskUuid;
|
||||
|
||||
// User readable name of the saved desk.
|
||||
DOMString savedDeskName;
|
||||
|
||||
// Saved desk type.
|
||||
SavedDeskType savedDeskType;
|
||||
};
|
||||
|
||||
// Launch desk options
|
||||
dictionary LaunchOptions {
|
||||
// User readable name of the desk.
|
||||
DOMString? deskName;
|
||||
};
|
||||
|
||||
// Window properties
|
||||
dictionary WindowProperties {
|
||||
// If window show up on all desks.
|
||||
boolean allDesks;
|
||||
};
|
||||
|
||||
callback DeskIdCallback = void (DOMString deskId);
|
||||
callback VoidCallback = void ();
|
||||
callback GetDeskTemplateJsonCallback = void (DOMString templateJson);
|
||||
callback GetAllDesksCallback = void (Desk[] desks);
|
||||
callback GetSavedDesksCallback = void (SavedDesk[] saveDesks);
|
||||
callback SaveActiveDeskCallback = void (SavedDesk desk);
|
||||
callback GetDeskByIDCallback = void (Desk desk);
|
||||
|
||||
interface Functions {
|
||||
// Returns all available previously-saved desks.
|
||||
static void getSavedDesks(
|
||||
GetSavedDesksCallback callback);
|
||||
|
||||
// Launches a desk, if `templateUuid` is present in the options, launches a
|
||||
// desk template, otherwise launches an empty desk. If `deskName` is present
|
||||
// in the options, using provided name as desk name, otherwise launches with
|
||||
// auto generated name.
|
||||
static void launchDesk(
|
||||
LaunchOptions launchOptions,
|
||||
DeskIdCallback callback);
|
||||
|
||||
// Gets the template associated with the templateUuid and returns its JSON
|
||||
// representation. Returns an error if either the template could not be
|
||||
// found or the user profile is not valid.
|
||||
static void getDeskTemplateJson(
|
||||
DOMString templateUuid,
|
||||
GetDeskTemplateJsonCallback callback);
|
||||
|
||||
// Removes a desk as specified in `deskId`. If `combineDesks` of
|
||||
// `RemoveDeskOptions` is present or set to true, remove the desk and
|
||||
// combine windows to the active desk to the left. If `allowUndo` is
|
||||
// present or set to true, prompt the user with a notification allowing for
|
||||
// the desk to be retrieved. Otherwise close all windows on the desk.
|
||||
static void removeDesk(
|
||||
DOMString deskId,
|
||||
optional RemoveDeskOptions removeDeskOptions,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Returns all available desks.
|
||||
static void getAllDesks(GetAllDesksCallback callback);
|
||||
|
||||
// Sets the window properties for window identified by the `windowId`.
|
||||
static void setWindowProperties(
|
||||
long windowId,
|
||||
WindowProperties windowProperties,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Saves the current active desk to the library and remove it from the desk
|
||||
// bar.
|
||||
static void saveActiveDesk(
|
||||
SaveActiveDeskCallback callback);
|
||||
|
||||
// Deletes the saved desk from the library.
|
||||
static void deleteSavedDesk(
|
||||
DOMString savedDeskUuid,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Launches a saved desk from the library back to active desk.
|
||||
static void recallSavedDesk(
|
||||
DOMString savedDeskUuid,
|
||||
DeskIdCallback callback);
|
||||
|
||||
// Retrieves the UUID of the current active desk.
|
||||
static void getActiveDesk(DeskIdCallback callback);
|
||||
|
||||
// Switches to the target desk.
|
||||
static void switchDesk(
|
||||
DOMString deskUuid, VoidCallback callback);
|
||||
|
||||
// Retrieves desk by the desk UUID.
|
||||
static void getDeskByID(
|
||||
DOMString deskUuid, GetDeskByIDCallback callback);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Fires when new desks is added.
|
||||
static void OnDeskAdded(DOMString deskId, boolean fromUndo);
|
||||
|
||||
// Fires when desk removal is finalized.
|
||||
static void OnDeskRemoved(DOMString deskId);
|
||||
|
||||
// Fires when desk activation changed.
|
||||
static void OnDeskSwitched(DOMString activated, DOMString deactivated);
|
||||
};
|
||||
|
||||
};
|
||||
+1881
File diff suppressed because it is too large
Load Diff
+11146
File diff suppressed because it is too large
Load Diff
+791
@@ -0,0 +1,791 @@
|
||||
// Copyright 2013 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "content/child/runtime_features.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/base_switches.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/feature_list.h"
|
||||
#include "base/memory/raw_ref.h"
|
||||
#include "base/metrics/field_trial.h"
|
||||
#include "base/metrics/field_trial_params.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "build/build_config.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
#include "cc/base/features.h"
|
||||
#include "components/attribution_reporting/features.h"
|
||||
#include "content/common/content_navigation_policy.h"
|
||||
#include "content/common/content_switches_internal.h"
|
||||
#include "content/common/features.h"
|
||||
#include "content/public/common/content_features.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "device/base/features.h"
|
||||
#include "device/fido/features.h"
|
||||
#include "device/gamepad/public/cpp/gamepad_features.h"
|
||||
#include "device/vr/buildflags/buildflags.h"
|
||||
#include "gpu/config/gpu_finch_features.h"
|
||||
#include "gpu/config/gpu_switches.h"
|
||||
#include "media/base/media_switches.h"
|
||||
#include "services/device/public/cpp/device_features.h"
|
||||
#include "services/network/public/cpp/features.h"
|
||||
#include "services/webnn/public/mojom/features.mojom-features.h"
|
||||
#include "third_party/blink/public/common/buildflags.h"
|
||||
#include "third_party/blink/public/common/features.h"
|
||||
#include "third_party/blink/public/common/features_generated.h"
|
||||
#include "third_party/blink/public/common/loader/referrer_utils.h"
|
||||
#include "third_party/blink/public/common/switches.h"
|
||||
#include "third_party/blink/public/platform/web_runtime_features.h"
|
||||
#include "ui/accessibility/accessibility_features.h"
|
||||
#include "ui/base/ui_base_features.h"
|
||||
#include "ui/events/blink/blink_features.h"
|
||||
#include "ui/gfx/switches.h"
|
||||
#include "ui/gl/gl_switches.h"
|
||||
#include "ui/native_theme/native_theme_features.h"
|
||||
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
#include "base/android/build_info.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_VR)
|
||||
#include "device/vr/public/cpp/features.h"
|
||||
#endif
|
||||
|
||||
using blink::WebRuntimeFeatures;
|
||||
|
||||
namespace {
|
||||
|
||||
// Sets blink runtime features for specific platforms.
|
||||
// This should be a last resort vs runtime_enabled_features.json5.
|
||||
void SetRuntimeFeatureDefaultsForPlatform(
|
||||
const base::CommandLine& command_line) {
|
||||
// Please consider setting up feature defaults for different platforms
|
||||
// in runtime_enabled_features.json5 instead of here
|
||||
// TODO(rodneyding): Move the more common cases here
|
||||
// to baseFeature/switch functions below and move more complex
|
||||
// ones to special case functions.
|
||||
#if defined(USE_AURA)
|
||||
WebRuntimeFeatures::EnableCompositedSelectionUpdate(true);
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_CHROMEOS_LACROS)
|
||||
const bool enable_canvas_2d_image_chromium =
|
||||
command_line.HasSwitch(
|
||||
blink::switches::kEnableGpuMemoryBufferCompositorResources) &&
|
||||
!command_line.HasSwitch(switches::kDisable2dCanvasImageChromium) &&
|
||||
!command_line.HasSwitch(switches::kDisableGpu) &&
|
||||
base::FeatureList::IsEnabled(features::kCanvas2DImageChromium);
|
||||
#else
|
||||
constexpr bool enable_canvas_2d_image_chromium = false;
|
||||
#endif
|
||||
WebRuntimeFeatures::EnableCanvas2dImageChromium(
|
||||
enable_canvas_2d_image_chromium);
|
||||
|
||||
#if BUILDFLAG(IS_APPLE)
|
||||
const bool enable_web_gl_image_chromium =
|
||||
command_line.HasSwitch(
|
||||
blink::switches::kEnableGpuMemoryBufferCompositorResources) &&
|
||||
!command_line.HasSwitch(switches::kDisableWebGLImageChromium) &&
|
||||
!command_line.HasSwitch(switches::kDisableGpu);
|
||||
#else
|
||||
const bool enable_web_gl_image_chromium =
|
||||
command_line.HasSwitch(switches::kEnableWebGLImageChromium);
|
||||
#endif
|
||||
WebRuntimeFeatures::EnableWebGLImageChromium(enable_web_gl_image_chromium);
|
||||
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
if (command_line.HasSwitch(switches::kDisableMediaSessionAPI)) {
|
||||
WebRuntimeFeatures::EnableMediaSession(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
if (base::android::BuildInfo::GetInstance()->sdk_int() >=
|
||||
base::android::SDK_VERSION_P) {
|
||||
// Display Cutout is limited to Android P+.
|
||||
WebRuntimeFeatures::EnableDisplayCutoutAPI(true);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
WebRuntimeFeatures::EnableMediaControlsExpandGesture(
|
||||
base::FeatureList::IsEnabled(media::kMediaControlsExpandGesture));
|
||||
#endif
|
||||
}
|
||||
|
||||
enum RuntimeFeatureEnableOptions {
|
||||
// - If the base::Feature default is overridden by field trial or command
|
||||
// line, set Blink feature to the state of the base::Feature;
|
||||
// - Otherwise if the base::Feature is enabled, enable the Blink feature.
|
||||
// - Otherwise no change.
|
||||
kDefault,
|
||||
// Enables the Blink feature when the base::Feature is overridden by field
|
||||
// trial or command line. Otherwise no change. Its difference from kDefault is
|
||||
// that the Blink feature isn't affected by the default state of the
|
||||
// base::Feature. This is useful for Blink origin trial features especially
|
||||
// those implemented in both Chromium and Blink. As origin trial only controls
|
||||
// the Blink features, for now we require the base::Feature to be enabled by
|
||||
// default, but we don't want the default enabled status affect the Blink
|
||||
// feature. See also https://crbug.com/1048656#c10.
|
||||
// This can also be used for features that are enabled by default in Chromium
|
||||
// but not in Blink on all platforms and we want to use the Blink status.
|
||||
// However, we would prefer consistent Chromium and Blink status to this.
|
||||
kSetOnlyIfOverridden,
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
// Helper class that describes the desired actions for the runtime feature
|
||||
// depending on a check for chromium base::Feature.
|
||||
struct RuntimeFeatureToChromiumFeatureMap {
|
||||
// This can be either an enabler function defined in web_runtime_features.cc
|
||||
// or the string name of the feature in runtime_enabled_features.json5.
|
||||
T feature_enabler;
|
||||
// The chromium base::Feature to check.
|
||||
const raw_ref<const base::Feature> chromium_feature;
|
||||
const RuntimeFeatureEnableOptions option = kDefault;
|
||||
};
|
||||
|
||||
template <typename Enabler>
|
||||
void SetRuntimeFeatureFromChromiumFeature(const base::Feature& chromium_feature,
|
||||
RuntimeFeatureEnableOptions option,
|
||||
const Enabler& enabler) {
|
||||
using FeatureList = base::FeatureList;
|
||||
const bool feature_enabled = FeatureList::IsEnabled(chromium_feature);
|
||||
const bool is_overridden =
|
||||
FeatureList::GetStateIfOverridden(chromium_feature).has_value();
|
||||
switch (option) {
|
||||
case kSetOnlyIfOverridden:
|
||||
if (is_overridden) {
|
||||
enabler(feature_enabled);
|
||||
}
|
||||
break;
|
||||
case kDefault:
|
||||
if (feature_enabled || is_overridden) {
|
||||
enabler(feature_enabled);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
NOTREACHED_IN_MIGRATION();
|
||||
}
|
||||
}
|
||||
|
||||
// Sets blink runtime features that are either directly
|
||||
// controlled by Chromium base::Feature or are overridden
|
||||
// by base::Feature states.
|
||||
void SetRuntimeFeaturesFromChromiumFeatures() {
|
||||
using wf = WebRuntimeFeatures;
|
||||
// To add a runtime feature control, add a new
|
||||
// RuntimeFeatureToChromiumFeatureMap entry here if there is a custom
|
||||
// enabler function defined. Otherwise add the entry with string name
|
||||
// in the next list.
|
||||
const RuntimeFeatureToChromiumFeatureMap<void (*)(bool)>
|
||||
blinkFeatureToBaseFeatureMapping[] = {
|
||||
{wf::EnableAccessibilityAriaVirtualContent,
|
||||
raw_ref(features::kEnableAccessibilityAriaVirtualContent)},
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
{wf::EnableAccessibilityPageZoom,
|
||||
raw_ref(features::kAccessibilityPageZoom)},
|
||||
#endif
|
||||
{wf::EnableAccessibilityUseAXPositionForDocumentMarkers,
|
||||
raw_ref(features::kUseAXPositionForDocumentMarkers)},
|
||||
{wf::EnableAOMAriaRelationshipProperties,
|
||||
raw_ref(features::kEnableAriaElementReflection)},
|
||||
{wf::EnableBackgroundFetch, raw_ref(features::kBackgroundFetch)},
|
||||
{wf::EnableBoundaryEventDispatchTracksNodeRemoval,
|
||||
raw_ref(blink::features::kBoundaryEventDispatchTracksNodeRemoval)},
|
||||
{wf::EnableBrowserVerifiedUserActivationKeyboard,
|
||||
raw_ref(features::kBrowserVerifiedUserActivationKeyboard)},
|
||||
{wf::EnableBrowserVerifiedUserActivationMouse,
|
||||
raw_ref(features::kBrowserVerifiedUserActivationMouse)},
|
||||
{wf::EnableCompositeBGColorAnimation,
|
||||
raw_ref(features::kCompositeBGColorAnimation)},
|
||||
{wf::EnableCooperativeScheduling,
|
||||
raw_ref(features::kCooperativeScheduling)},
|
||||
{wf::EnableDigitalGoods, raw_ref(features::kDigitalGoodsApi),
|
||||
kSetOnlyIfOverridden},
|
||||
{wf::EnableDocumentPolicyNegotiation,
|
||||
raw_ref(features::kDocumentPolicyNegotiation)},
|
||||
{wf::EnableEyeDropperAPI, raw_ref(features::kEyeDropper),
|
||||
kSetOnlyIfOverridden},
|
||||
{wf::EnableFedCm, raw_ref(features::kFedCm), kSetOnlyIfOverridden},
|
||||
{wf::EnableFedCmButtonMode, raw_ref(features::kFedCmButtonMode),
|
||||
kSetOnlyIfOverridden},
|
||||
{wf::EnableFedCmAuthz, raw_ref(features::kFedCmAuthz), kDefault},
|
||||
{wf::EnableFedCmIdPRegistration,
|
||||
raw_ref(features::kFedCmIdPRegistration), kDefault},
|
||||
{wf::EnableFedCmIdpSigninStatus,
|
||||
raw_ref(features::kFedCmIdpSigninStatusEnabled),
|
||||
kSetOnlyIfOverridden},
|
||||
{wf::EnableGamepadMultitouch,
|
||||
raw_ref(features::kEnableGamepadMultitouch)},
|
||||
{wf::EnableSharedStorageAPI,
|
||||
raw_ref(features::kPrivacySandboxAdsAPIsOverride),
|
||||
kSetOnlyIfOverridden},
|
||||
{wf::EnableSharedStorageAPI,
|
||||
raw_ref(features::kPrivacySandboxAdsAPIsM1Override)},
|
||||
{wf::EnableSharedStorageAPIM118,
|
||||
raw_ref(blink::features::kSharedStorageAPIM118), kDefault},
|
||||
{wf::EnableSharedStorageAPIM125,
|
||||
raw_ref(blink::features::kSharedStorageAPIM125), kDefault},
|
||||
{wf::EnableFedCmMultipleIdentityProviders,
|
||||
raw_ref(features::kFedCmMultipleIdentityProviders),
|
||||
kSetOnlyIfOverridden},
|
||||
{wf::EnableFedCmSelectiveDisclosure,
|
||||
raw_ref(features::kFedCmSelectiveDisclosure), kDefault},
|
||||
{wf::EnableFencedFrames,
|
||||
raw_ref(features::kPrivacySandboxAdsAPIsOverride),
|
||||
kSetOnlyIfOverridden},
|
||||
{wf::EnableFencedFrames,
|
||||
raw_ref(features::kPrivacySandboxAdsAPIsM1Override)},
|
||||
{wf::EnableForcedColors, raw_ref(features::kForcedColors)},
|
||||
{wf::EnableFractionalScrollOffsets,
|
||||
raw_ref(features::kFractionalScrollOffsets)},
|
||||
{wf::EnableSensorExtraClasses,
|
||||
raw_ref(features::kGenericSensorExtraClasses)},
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
{wf::EnableGetDisplayMedia,
|
||||
raw_ref(features::kUserMediaScreenCapturing)},
|
||||
#endif
|
||||
{wf::EnableInstalledApp, raw_ref(features::kInstalledApp)},
|
||||
{wf::EnableLazyInitializeMediaControls,
|
||||
raw_ref(features::kLazyInitializeMediaControls)},
|
||||
#if BUILDFLAG(IS_CHROMEOS)
|
||||
{wf::EnableLockedMode, raw_ref(blink::features::kLockedMode)},
|
||||
#endif
|
||||
{wf::EnableMediaCastOverlayButton,
|
||||
raw_ref(media::kMediaCastOverlayButton)},
|
||||
{wf::EnableMediaEngagementBypassAutoplayPolicies,
|
||||
raw_ref(media::kMediaEngagementBypassAutoplayPolicies)},
|
||||
{wf::EnableNotificationContentImage,
|
||||
raw_ref(features::kNotificationContentImage), kSetOnlyIfOverridden},
|
||||
{wf::EnablePaymentApp, raw_ref(features::kServiceWorkerPaymentApps)},
|
||||
{wf::EnablePaymentRequest, raw_ref(features::kWebPayments)},
|
||||
{wf::EnablePercentBasedScrolling,
|
||||
raw_ref(features::kWindowsScrollingPersonality)},
|
||||
{wf::EnablePeriodicBackgroundSync,
|
||||
raw_ref(features::kPeriodicBackgroundSync)},
|
||||
{wf::EnablePushMessagingSubscriptionChange,
|
||||
raw_ref(features::kPushSubscriptionChangeEvent)},
|
||||
{wf::EnableRestrictGamepadAccess,
|
||||
raw_ref(features::kRestrictGamepadAccess)},
|
||||
{wf::EnableSecurePaymentConfirmation,
|
||||
raw_ref(features::kSecurePaymentConfirmation)},
|
||||
{wf::EnableSecurePaymentConfirmationDebug,
|
||||
raw_ref(features::kSecurePaymentConfirmationDebug)},
|
||||
{wf::EnableSendBeaconThrowForBlobWithNonSimpleType,
|
||||
raw_ref(features::kSendBeaconThrowForBlobWithNonSimpleType)},
|
||||
{wf::EnableSharedArrayBuffer, raw_ref(features::kSharedArrayBuffer)},
|
||||
{wf::EnableSharedArrayBufferOnDesktop,
|
||||
raw_ref(features::kSharedArrayBufferOnDesktop)},
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
{wf::EnableSmartZoom, raw_ref(features::kSmartZoom)},
|
||||
#endif
|
||||
{wf::EnableTouchDragAndContextMenu,
|
||||
raw_ref(features::kTouchDragAndContextMenu)},
|
||||
{wf::EnableUserActivationSameOriginVisibility,
|
||||
raw_ref(features::kUserActivationSameOriginVisibility)},
|
||||
{wf::EnableWebBluetooth, raw_ref(features::kWebBluetooth),
|
||||
kSetOnlyIfOverridden},
|
||||
{wf::EnableWebBluetoothGetDevices,
|
||||
raw_ref(features::kWebBluetoothNewPermissionsBackend),
|
||||
kSetOnlyIfOverridden},
|
||||
{wf::EnableWebBluetoothWatchAdvertisements,
|
||||
raw_ref(features::kWebBluetoothNewPermissionsBackend),
|
||||
kSetOnlyIfOverridden},
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
{wf::EnableWebNFC, raw_ref(features::kWebNfc), kSetOnlyIfOverridden},
|
||||
#endif
|
||||
{wf::EnableWebIdentityDigitalCredentials,
|
||||
raw_ref(features::kWebIdentityDigitalCredentials),
|
||||
kSetOnlyIfOverridden},
|
||||
{wf::EnableWebOTP, raw_ref(features::kWebOTP), kSetOnlyIfOverridden},
|
||||
{wf::EnableWebOTPAssertionFeaturePolicy,
|
||||
raw_ref(features::kWebOTPAssertionFeaturePolicy),
|
||||
kSetOnlyIfOverridden},
|
||||
{wf::EnableWebUSB, raw_ref(features::kWebUsb)},
|
||||
{wf::EnableWebXR, raw_ref(features::kWebXr)},
|
||||
#if BUILDFLAG(ENABLE_VR)
|
||||
{wf::EnableWebXRFrontFacing,
|
||||
raw_ref(device::features::kWebXrIncubations)},
|
||||
{wf::EnableWebXRFrameRate,
|
||||
raw_ref(device::features::kWebXrIncubations)},
|
||||
{wf::EnableWebXRHandInput,
|
||||
raw_ref(device::features::kWebXrHandInput)},
|
||||
{wf::EnableWebXRImageTracking,
|
||||
raw_ref(device::features::kWebXrIncubations)},
|
||||
{wf::EnableWebXRLayers, raw_ref(device::features::kWebXrLayers)},
|
||||
{wf::EnableWebXRPlaneDetection,
|
||||
raw_ref(device::features::kWebXrIncubations)},
|
||||
{wf::EnableWebXRPoseMotionData,
|
||||
raw_ref(device::features::kWebXrIncubations)},
|
||||
{wf::EnableWebXRSpecParity,
|
||||
raw_ref(device::features::kWebXrIncubations)},
|
||||
#endif
|
||||
{wf::EnableRemoveMobileViewportDoubleTap,
|
||||
raw_ref(features::kRemoveMobileViewportDoubleTap)},
|
||||
{wf::EnableServiceWorkerStaticRouter,
|
||||
raw_ref(features::kServiceWorkerStaticRouter)},
|
||||
{wf::EnablePermissions, raw_ref(features::kWebPermissionsApi),
|
||||
kSetOnlyIfOverridden},
|
||||
};
|
||||
for (const auto& mapping : blinkFeatureToBaseFeatureMapping) {
|
||||
SetRuntimeFeatureFromChromiumFeature(
|
||||
*mapping.chromium_feature, mapping.option, mapping.feature_enabler);
|
||||
}
|
||||
|
||||
// TODO(crbug.com/40571563): Cleanup the inconsistency between custom WRF
|
||||
// enabler function and using feature string name with
|
||||
// EnableFeatureFromString.
|
||||
const RuntimeFeatureToChromiumFeatureMap<const char*>
|
||||
runtimeFeatureNameToChromiumFeatureMapping[] = {
|
||||
{"AllowContentInitiatedDataUrlNavigations",
|
||||
raw_ref(features::kAllowContentInitiatedDataUrlNavigations)},
|
||||
{"AllowURNsInIframes", raw_ref(blink::features::kAllowURNsInIframes)},
|
||||
{"AllowURNsInIframes",
|
||||
raw_ref(features::kPrivacySandboxAdsAPIsOverride),
|
||||
kSetOnlyIfOverridden},
|
||||
{"AllowURNsInIframes",
|
||||
raw_ref(features::kPrivacySandboxAdsAPIsM1Override)},
|
||||
{"AttributionReporting",
|
||||
raw_ref(features::kPrivacySandboxAdsAPIsOverride),
|
||||
kSetOnlyIfOverridden},
|
||||
{"AttributionReporting",
|
||||
raw_ref(features::kPrivacySandboxAdsAPIsM1Override)},
|
||||
{"AttributionReportingCrossAppWeb",
|
||||
raw_ref(features::kPrivacySandboxAdsAPIsOverride),
|
||||
kSetOnlyIfOverridden},
|
||||
{"AndroidDownloadableFontsMatching",
|
||||
raw_ref(features::kAndroidDownloadableFontsMatching)},
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
{"CCTNewRFMPushBehavior",
|
||||
raw_ref(blink::features::kCCTNewRFMPushBehavior)},
|
||||
#endif
|
||||
{"CompressionDictionaryTransport",
|
||||
raw_ref(network::features::kCompressionDictionaryTransport)},
|
||||
{"CompressionDictionaryTransportBackend",
|
||||
raw_ref(network::features::kCompressionDictionaryTransportBackend)},
|
||||
{"CookieDeprecationFacilitatedTesting",
|
||||
raw_ref(features::kCookieDeprecationFacilitatedTesting)},
|
||||
{"Database", raw_ref(blink::features::kWebSQLAccess),
|
||||
kSetOnlyIfOverridden},
|
||||
{"DocumentPolicyIncludeJSCallStacksInCrashReports",
|
||||
raw_ref(blink::features::
|
||||
kDocumentPolicyIncludeJSCallStacksInCrashReports),
|
||||
kSetOnlyIfOverridden},
|
||||
{"FencedFramesLocalUnpartitionedDataAccess",
|
||||
raw_ref(blink::features::kFencedFramesLocalUnpartitionedDataAccess)},
|
||||
{"Fledge", raw_ref(blink::features::kFledge)},
|
||||
{"Fledge", raw_ref(features::kPrivacySandboxAdsAPIsOverride),
|
||||
kSetOnlyIfOverridden},
|
||||
{"Fledge", raw_ref(features::kPrivacySandboxAdsAPIsM1Override),
|
||||
kSetOnlyIfOverridden},
|
||||
{"FontationsFontBackend",
|
||||
raw_ref(blink::features::kFontationsFontBackend)},
|
||||
{"FontSrcLocalMatching", raw_ref(features::kFontSrcLocalMatching)},
|
||||
{"LegacyWindowsDWriteFontFallback",
|
||||
raw_ref(features::kLegacyWindowsDWriteFontFallback)},
|
||||
{"MachineLearningNeuralNetwork",
|
||||
raw_ref(webnn::mojom::features::kWebMachineLearningNeuralNetwork)},
|
||||
{"OriginIsolationHeader", raw_ref(features::kOriginIsolationHeader)},
|
||||
{"ReduceAcceptLanguage",
|
||||
raw_ref(network::features::kReduceAcceptLanguage)},
|
||||
{"SerialPortConnected", raw_ref(features::kSerialPortConnected)},
|
||||
{"TopicsAPI", raw_ref(features::kPrivacySandboxAdsAPIsOverride),
|
||||
kSetOnlyIfOverridden},
|
||||
{"TopicsAPI", raw_ref(features::kPrivacySandboxAdsAPIsM1Override)},
|
||||
{"TopicsDocumentAPI",
|
||||
raw_ref(features::kPrivacySandboxAdsAPIsOverride),
|
||||
kSetOnlyIfOverridden},
|
||||
{"TopicsDocumentAPI",
|
||||
raw_ref(features::kPrivacySandboxAdsAPIsM1Override)},
|
||||
{"TouchTextEditingRedesign",
|
||||
raw_ref(features::kTouchTextEditingRedesign)},
|
||||
{"TrustedTypesFromLiteral",
|
||||
raw_ref(features::kTrustedTypesFromLiteral)},
|
||||
{"WebSerialBluetooth",
|
||||
raw_ref(features::kEnableBluetoothSerialPortProfileInSerialApi)},
|
||||
{"MediaStreamTrackTransfer",
|
||||
raw_ref(features::kMediaStreamTrackTransfer)},
|
||||
{"PrivateNetworkAccessPermissionPrompt",
|
||||
raw_ref(network::features::kPrivateNetworkAccessPermissionPrompt),
|
||||
kSetOnlyIfOverridden}};
|
||||
for (const auto& mapping : runtimeFeatureNameToChromiumFeatureMapping) {
|
||||
SetRuntimeFeatureFromChromiumFeature(
|
||||
*mapping.chromium_feature, mapping.option, [&mapping](bool enabled) {
|
||||
wf::EnableFeatureFromString(mapping.feature_enabler, enabled);
|
||||
});
|
||||
}
|
||||
|
||||
WebRuntimeFeatures::UpdateStatusFromBaseFeatures();
|
||||
}
|
||||
|
||||
// Helper class that describes the desired enable/disable action
|
||||
// for a runtime feature when a command line switch exists.
|
||||
struct SwitchToFeatureMap {
|
||||
// The enabler function defined in web_runtime_features.cc.
|
||||
void (*feature_enabler)(bool);
|
||||
// The switch to check for on command line.
|
||||
const char* switch_name;
|
||||
// This is the desired state for the runtime feature if the
|
||||
// switch exists on command line.
|
||||
bool target_enabled_state;
|
||||
};
|
||||
|
||||
// Sets blink runtime features controlled by command line switches.
|
||||
void SetRuntimeFeaturesFromCommandLine(const base::CommandLine& command_line) {
|
||||
// To add a new switch-controlled runtime feature, add a new
|
||||
// SwitchToFeatureMap entry to the initializer list below.
|
||||
// Note: command line switches are now discouraged, please consider
|
||||
// using base::Feature instead.
|
||||
// https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/configuration.md#switches
|
||||
using wrf = WebRuntimeFeatures;
|
||||
const SwitchToFeatureMap switchToFeatureMapping[] = {
|
||||
// Stable Features
|
||||
{wrf::EnablePresentation, switches::kDisablePresentationAPI, false},
|
||||
{wrf::EnableRemotePlayback, switches::kDisableRemotePlaybackAPI, false},
|
||||
{wrf::EnableTimerThrottlingForBackgroundTabs,
|
||||
switches::kDisableBackgroundTimerThrottling, false},
|
||||
// End of Stable Features
|
||||
{wrf::EnableAutomationControlled, switches::kEnableAutomation, true},
|
||||
{wrf::EnableAutomationControlled, switches::kHeadless, true},
|
||||
{wrf::EnableAutomationControlled, switches::kRemoteDebuggingPipe, true},
|
||||
{wrf::EnableDatabase, switches::kDisableDatabases, false},
|
||||
{wrf::EnableFileSystem, switches::kDisableFileSystem, false},
|
||||
{wrf::EnableNetInfoDownlinkMax,
|
||||
switches::kEnableNetworkInformationDownlinkMax, true},
|
||||
{wrf::EnableNotifications, switches::kDisableNotifications, false},
|
||||
{wrf::EnablePreciseMemoryInfo, switches::kEnablePreciseMemoryInfo, true},
|
||||
// Chrome's Push Messaging implementation relies on Web Notifications.
|
||||
{wrf::EnablePushMessaging, switches::kDisableNotifications, false},
|
||||
{wrf::EnableScriptedSpeechRecognition, switches::kDisableSpeechAPI,
|
||||
false},
|
||||
{wrf::EnableScriptedSpeechSynthesis, switches::kDisableSpeechAPI, false},
|
||||
{wrf::EnableScriptedSpeechSynthesis, switches::kDisableSpeechSynthesisAPI,
|
||||
false},
|
||||
{wrf::EnableSharedWorker, switches::kDisableSharedWorkers, false},
|
||||
{wrf::EnableMutationEvents, blink::switches::kMutationEventsEnabled,
|
||||
true},
|
||||
{wrf::EnableKeyboardFocusableScrollers,
|
||||
blink::switches::kKeyboardFocusableScrollersEnabled, true},
|
||||
{wrf::EnableKeyboardFocusableScrollers,
|
||||
blink::switches::kKeyboardFocusableScrollersOptOut, false},
|
||||
{wrf::EnableStandardizedBrowserZoom,
|
||||
blink::switches::kDisableStandardizedBrowserZoom, false},
|
||||
{wrf::EnableCSSCustomStateDeprecatedSyntax,
|
||||
blink::switches::kCSSCustomStateDeprecatedSyntaxEnabled, true},
|
||||
{wrf::EnableTextFragmentIdentifiers,
|
||||
switches::kDisableScrollToTextFragment, false},
|
||||
{wrf::EnableWebAuthenticationRemoteDesktopSupport,
|
||||
switches::kWebAuthRemoteDesktopSupport, true},
|
||||
{wrf::EnableWebGLDeveloperExtensions,
|
||||
switches::kEnableWebGLDeveloperExtensions, true},
|
||||
{wrf::EnableWebGLDraftExtensions, switches::kEnableWebGLDraftExtensions,
|
||||
true},
|
||||
{wrf::EnableWebGPUDeveloperFeatures,
|
||||
switches::kEnableWebGPUDeveloperFeatures, true},
|
||||
{wrf::EnableWebGPUExperimentalFeatures, switches::kEnableUnsafeWebGPU,
|
||||
true},
|
||||
};
|
||||
|
||||
for (const auto& mapping : switchToFeatureMapping) {
|
||||
if (command_line.HasSwitch(mapping.switch_name)) {
|
||||
mapping.feature_enabler(mapping.target_enabled_state);
|
||||
}
|
||||
}
|
||||
|
||||
// Set EnableAutomationControlled if the caller passes
|
||||
// --remote-debugging-port=0 on the command line. This means
|
||||
// the caller has requested an ephemeral port which is how ChromeDriver
|
||||
// launches the browser by default.
|
||||
// If the caller provides a specific port number, this is
|
||||
// more likely for attaching a debugger, so we should leave
|
||||
// EnableAutomationControlled unset to ensure the browser behaves as it does
|
||||
// when not under automation control.
|
||||
if (command_line.HasSwitch(switches::kRemoteDebuggingPort)) {
|
||||
std::string port_str =
|
||||
command_line.GetSwitchValueASCII(::switches::kRemoteDebuggingPort);
|
||||
int port;
|
||||
if (base::StringToInt(port_str, &port) && port == 0) {
|
||||
WebRuntimeFeatures::EnableAutomationControlled(true);
|
||||
}
|
||||
}
|
||||
|
||||
// Enable or disable BeforeunloadEventCancelByPreventDefault for Enterprise
|
||||
// Policy. This overrides any existing settings via base::Feature.
|
||||
if (command_line.HasSwitch(
|
||||
blink::switches::kBeforeunloadEventCancelByPreventDefaultPolicy)) {
|
||||
const std::string value = command_line.GetSwitchValueASCII(
|
||||
blink::switches::kBeforeunloadEventCancelByPreventDefaultPolicy);
|
||||
if (value ==
|
||||
blink::switches::
|
||||
kBeforeunloadEventCancelByPreventDefaultPolicy_ForceEnable) {
|
||||
WebRuntimeFeatures::EnableBeforeunloadEventCancelByPreventDefault(true);
|
||||
}
|
||||
if (value ==
|
||||
blink::switches::
|
||||
kBeforeunloadEventCancelByPreventDefaultPolicy_ForceDisable) {
|
||||
WebRuntimeFeatures::EnableBeforeunloadEventCancelByPreventDefault(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sets blink runtime features that depend on a combination
|
||||
// of args rather than a single check of base::Feature or switch.
|
||||
// This can be a combination of both or custom checking logic
|
||||
// not covered by other functions. In short, this should be used
|
||||
// as a last resort.
|
||||
void SetCustomizedRuntimeFeaturesFromCombinedArgs(
|
||||
const base::CommandLine& command_line) {
|
||||
// CAUTION: Only add custom enabling logic here if it cannot
|
||||
// be covered by the other functions.
|
||||
|
||||
// These checks are custom wrappers around base::FeatureList::IsEnabled
|
||||
// They're moved here to distinguish them from actual base checks
|
||||
WebRuntimeFeatures::EnableOverlayScrollbars(ui::IsOverlayScrollbarEnabled());
|
||||
WebRuntimeFeatures::EnableFluentScrollbars(ui::IsFluentScrollbarEnabled());
|
||||
WebRuntimeFeatures::EnableFluentOverlayScrollbars(
|
||||
ui::IsFluentOverlayScrollbarEnabled());
|
||||
|
||||
// TODO(rodneyding): This is a rare case for a stable feature
|
||||
// Need to investigate more to determine whether to refactor it.
|
||||
if (command_line.HasSwitch(switches::kDisableV8IdleTasks)) {
|
||||
WebRuntimeFeatures::EnableV8IdleTasks(false);
|
||||
} else {
|
||||
WebRuntimeFeatures::EnableV8IdleTasks(true);
|
||||
}
|
||||
|
||||
WebRuntimeFeatures::EnableBackForwardCache(
|
||||
content::IsBackForwardCacheEnabled());
|
||||
|
||||
if (base::FeatureList::IsEnabled(network::features::kPrivateStateTokens)) {
|
||||
WebRuntimeFeatures::EnablePrivateStateTokens(true);
|
||||
WebRuntimeFeatures::EnablePrivateStateTokensAlwaysAllowIssuance(true);
|
||||
} else if (base::FeatureList::IsEnabled(network::features::kFledgePst)) {
|
||||
// See https://bit.ly/configuring-trust-tokens.
|
||||
using network::features::TrustTokenOriginTrialSpec;
|
||||
switch (
|
||||
network::features::kTrustTokenOperationsRequiringOriginTrial.Get()) {
|
||||
case TrustTokenOriginTrialSpec::kOriginTrialNotRequired:
|
||||
// Setting PrivateStateTokens=true enables the Trust Tokens interface;
|
||||
// PrivateStateTokensAlwaysAllowIssuance disables a runtime check
|
||||
// during issuance that the origin trial is active (see
|
||||
// blink/.../trust_token_issuance_authorization.h).
|
||||
WebRuntimeFeatures::EnablePrivateStateTokens(true);
|
||||
WebRuntimeFeatures::EnablePrivateStateTokensAlwaysAllowIssuance(true);
|
||||
break;
|
||||
case TrustTokenOriginTrialSpec::kAllOperationsRequireOriginTrial:
|
||||
// The origin trial itself will be responsible for enabling the
|
||||
// PrivateStateTokens RuntimeEnabledFeature.
|
||||
WebRuntimeFeatures::EnablePrivateStateTokens(false);
|
||||
WebRuntimeFeatures::EnablePrivateStateTokensAlwaysAllowIssuance(false);
|
||||
break;
|
||||
case TrustTokenOriginTrialSpec::kOnlyIssuanceRequiresOriginTrial:
|
||||
// At issuance, a runtime check will be responsible for checking that
|
||||
// the origin trial is present.
|
||||
WebRuntimeFeatures::EnablePrivateStateTokens(true);
|
||||
WebRuntimeFeatures::EnablePrivateStateTokensAlwaysAllowIssuance(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Ensures that the various ways of enabling/disabling features do not produce
|
||||
// an invalid configuration.
|
||||
void ResolveInvalidConfigurations() {
|
||||
// Fenced frames cannot be enabled without the support of the
|
||||
// browser process.
|
||||
if ((base::FeatureList::IsEnabled(features::kPrivacySandboxAdsAPIsOverride) ||
|
||||
base::FeatureList::IsEnabled(
|
||||
features::kPrivacySandboxAdsAPIsM1Override)) &&
|
||||
!base::FeatureList::IsEnabled(blink::features::kFencedFrames)) {
|
||||
LOG_IF(WARNING, WebRuntimeFeatures::IsFencedFramesEnabled())
|
||||
<< "Fenced frames cannot be enabled in this configuration. Use --"
|
||||
<< switches::kEnableFeatures << "="
|
||||
<< blink::features::kFencedFrames.name << " instead.";
|
||||
WebRuntimeFeatures::EnableFencedFrames(false);
|
||||
}
|
||||
|
||||
if (!base::FeatureList::IsEnabled(blink::features::kFencedFrames) &&
|
||||
base::FeatureList::IsEnabled(
|
||||
blink::features::kFencedFramesLocalUnpartitionedDataAccess)) {
|
||||
LOG_IF(
|
||||
WARNING,
|
||||
WebRuntimeFeatures::IsFencedFramesLocalUnpartitionedDataAccessEnabled())
|
||||
<< "Fenced frames must be enabled in order to enable local "
|
||||
"unpartitioned "
|
||||
<< "data access. Use --" << switches::kEnableFeatures << "="
|
||||
<< blink::features::kFencedFrames.name << " in addition.";
|
||||
WebRuntimeFeatures::EnableFeatureFromString(
|
||||
"FencedFramesLocalUnpartitionedDataAccess", false);
|
||||
}
|
||||
|
||||
// Topics API cannot be enabled without the support of the browser process.
|
||||
// The Document API should be additionally gated by the
|
||||
// `kBrowsingTopicsDocumentAPI` feature.
|
||||
if (!base::FeatureList::IsEnabled(blink::features::kBrowsingTopics)) {
|
||||
LOG_IF(WARNING, WebRuntimeFeatures::IsTopicsAPIEnabled())
|
||||
<< "Topics cannot be enabled in this configuration. Use --"
|
||||
<< switches::kEnableFeatures << "="
|
||||
<< blink::features::kBrowsingTopics.name << " in addition.";
|
||||
WebRuntimeFeatures::EnableTopicsAPI(false);
|
||||
WebRuntimeFeatures::EnableTopicsDocumentAPI(false);
|
||||
} else {
|
||||
if (!base::FeatureList::IsEnabled(
|
||||
blink::features::kBrowsingTopicsDocumentAPI)) {
|
||||
LOG_IF(WARNING, WebRuntimeFeatures::IsTopicsDocumentAPIEnabled())
|
||||
<< "Topics Document API cannot be enabled in this configuration. Use "
|
||||
"--"
|
||||
<< switches::kEnableFeatures << "="
|
||||
<< blink::features::kBrowsingTopicsDocumentAPI.name
|
||||
<< " in addition.";
|
||||
WebRuntimeFeatures::EnableTopicsDocumentAPI(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (!base::FeatureList::IsEnabled(blink::features::kSharedStorageAPI)) {
|
||||
LOG_IF(WARNING, WebRuntimeFeatures::IsSharedStorageAPIEnabled())
|
||||
<< "SharedStorage cannot be enabled in this "
|
||||
"configuration. Use --"
|
||||
<< switches::kEnableFeatures << "="
|
||||
<< blink::features::kSharedStorageAPI.name << " in addition.";
|
||||
WebRuntimeFeatures::EnableSharedStorageAPI(false);
|
||||
}
|
||||
|
||||
if (!base::FeatureList::IsEnabled(blink::features::kSharedStorageAPIM118) ||
|
||||
!base::FeatureList::IsEnabled(blink::features::kSharedStorageAPI)) {
|
||||
LOG_IF(WARNING, WebRuntimeFeatures::IsSharedStorageAPIM118Enabled())
|
||||
<< "SharedStorage for M118+ cannot be enabled in this "
|
||||
"configuration. Use --"
|
||||
<< switches::kEnableFeatures << "="
|
||||
<< blink::features::kSharedStorageAPI.name << ","
|
||||
<< blink::features::kSharedStorageAPIM118.name << " in addition.";
|
||||
WebRuntimeFeatures::EnableSharedStorageAPIM118(false);
|
||||
}
|
||||
|
||||
if (!base::FeatureList::IsEnabled(blink::features::kSharedStorageAPIM125) ||
|
||||
!base::FeatureList::IsEnabled(blink::features::kSharedStorageAPI)) {
|
||||
LOG_IF(WARNING, WebRuntimeFeatures::IsSharedStorageAPIM125Enabled())
|
||||
<< "SharedStorage for M125+ cannot be enabled in this "
|
||||
"configuration. Use --"
|
||||
<< switches::kEnableFeatures << "="
|
||||
<< blink::features::kSharedStorageAPI.name << ","
|
||||
<< blink::features::kSharedStorageAPIM125.name << " in addition.";
|
||||
WebRuntimeFeatures::EnableSharedStorageAPIM125(false);
|
||||
}
|
||||
|
||||
if (!base::FeatureList::IsEnabled(
|
||||
attribution_reporting::features::kConversionMeasurement)) {
|
||||
LOG_IF(WARNING, WebRuntimeFeatures::IsAttributionReportingEnabled())
|
||||
<< "AttributionReporting cannot be enabled in this "
|
||||
"configuration. Use --"
|
||||
<< switches::kEnableFeatures << "="
|
||||
<< attribution_reporting::features::kConversionMeasurement.name
|
||||
<< " in addition.";
|
||||
WebRuntimeFeatures::EnableAttributionReporting(false);
|
||||
}
|
||||
|
||||
if (!base::FeatureList::IsEnabled(
|
||||
attribution_reporting::features::kConversionMeasurement) ||
|
||||
!base::FeatureList::IsEnabled(
|
||||
network::features::kAttributionReportingCrossAppWeb)) {
|
||||
LOG_IF(WARNING,
|
||||
WebRuntimeFeatures::IsAttributionReportingCrossAppWebEnabled())
|
||||
<< "AttributionReportingCrossAppWeb cannot be enabled in this "
|
||||
"configuration. Use --"
|
||||
<< switches::kEnableFeatures << "="
|
||||
<< attribution_reporting::features::kConversionMeasurement.name << ","
|
||||
<< network::features::kAttributionReportingCrossAppWeb.name
|
||||
<< " in addition.";
|
||||
WebRuntimeFeatures::EnableAttributionReportingCrossAppWeb(false);
|
||||
}
|
||||
|
||||
if (!base::FeatureList::IsEnabled(blink::features::kInterestGroupStorage)) {
|
||||
LOG_IF(WARNING, WebRuntimeFeatures::IsAdInterestGroupAPIEnabled())
|
||||
<< "AdInterestGroupAPI cannot be enabled in this "
|
||||
"configuration. Use --"
|
||||
<< switches::kEnableFeatures << "="
|
||||
<< blink::features::kInterestGroupStorage.name << " in addition.";
|
||||
WebRuntimeFeatures::EnableAdInterestGroupAPI(false);
|
||||
WebRuntimeFeatures::EnableFledge(false);
|
||||
}
|
||||
|
||||
if (base::FeatureList::IsEnabled(
|
||||
features::kCookieDeprecationFacilitatedTesting)) {
|
||||
WebRuntimeFeatures::EnableFledgeMultiBid(false);
|
||||
WebRuntimeFeatures::EnableFledgeRealTimeReporting(false);
|
||||
|
||||
if (!base::FeatureList::IsEnabled(
|
||||
blink::features::
|
||||
kAlwaysAllowFledgeDeprecatedRenderURLReplacements)) {
|
||||
WebRuntimeFeatures::EnableFledgeDeprecatedRenderURLReplacements(false);
|
||||
}
|
||||
}
|
||||
|
||||
// PermissionElement cannot be enabled without the support of the
|
||||
// browser process.
|
||||
if (!base::FeatureList::IsEnabled(blink::features::kPermissionElement)) {
|
||||
LOG_IF(WARNING, WebRuntimeFeatures::IsPermissionElementEnabled())
|
||||
<< "PermissionElement cannot be enabled in this configuration. Use --"
|
||||
<< switches::kEnableFeatures << "="
|
||||
<< blink::features::kPermissionElement.name << " instead.";
|
||||
WebRuntimeFeatures::EnablePermissionElement(false);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace content {
|
||||
|
||||
void SetRuntimeFeaturesDefaultsAndUpdateFromArgs(
|
||||
const base::CommandLine& command_line) {
|
||||
// Sets experimental features.
|
||||
bool enable_experimental_web_platform_features =
|
||||
command_line.HasSwitch(switches::kEnableExperimentalWebPlatformFeatures);
|
||||
bool enable_blink_test_features =
|
||||
command_line.HasSwitch(switches::kEnableBlinkTestFeatures);
|
||||
|
||||
if (enable_blink_test_features) {
|
||||
enable_experimental_web_platform_features = true;
|
||||
WebRuntimeFeatures::EnableTestOnlyFeatures(true);
|
||||
}
|
||||
|
||||
if (enable_experimental_web_platform_features) {
|
||||
WebRuntimeFeatures::EnableExperimentalFeatures(true);
|
||||
}
|
||||
|
||||
SetRuntimeFeatureDefaultsForPlatform(command_line);
|
||||
|
||||
// Sets origin trial features.
|
||||
if (command_line.HasSwitch(
|
||||
switches::kDisableOriginTrialControlledBlinkFeatures)) {
|
||||
WebRuntimeFeatures::EnableOriginTrialControlledFeatures(false);
|
||||
}
|
||||
|
||||
// TODO(rodneyding): add doc explaining ways to add new runtime features
|
||||
// controls in the following functions.
|
||||
|
||||
SetRuntimeFeaturesFromChromiumFeatures();
|
||||
|
||||
SetRuntimeFeaturesFromCommandLine(command_line);
|
||||
|
||||
SetCustomizedRuntimeFeaturesFromCombinedArgs(command_line);
|
||||
|
||||
// Enable explicitly enabled features, and then disable explicitly disabled
|
||||
// ones.
|
||||
for (const std::string& feature :
|
||||
FeaturesFromSwitch(command_line, switches::kEnableBlinkFeatures)) {
|
||||
WebRuntimeFeatures::EnableFeatureFromString(feature, true);
|
||||
}
|
||||
for (const std::string& feature :
|
||||
FeaturesFromSwitch(command_line, switches::kDisableBlinkFeatures)) {
|
||||
WebRuntimeFeatures::EnableFeatureFromString(feature, false);
|
||||
}
|
||||
|
||||
ResolveInvalidConfigurations();
|
||||
}
|
||||
|
||||
} // namespace content
|
||||
File diff suppressed because it is too large
Load Diff
+104
@@ -0,0 +1,104 @@
|
||||
// Copyright 2012 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.alarms</code> API to schedule code to run
|
||||
// periodically or at a specified time in the future.
|
||||
namespace alarms {
|
||||
dictionary Alarm {
|
||||
// Name of this alarm.
|
||||
DOMString name;
|
||||
|
||||
// Time at which this alarm was scheduled to fire, in milliseconds past the
|
||||
// epoch (e.g. <code>Date.now() + n</code>). For performance reasons, the
|
||||
// alarm may have been delayed an arbitrary amount beyond this.
|
||||
double scheduledTime;
|
||||
|
||||
// If not null, the alarm is a repeating alarm and will fire again in
|
||||
// <var>periodInMinutes</var> minutes.
|
||||
double? periodInMinutes;
|
||||
};
|
||||
|
||||
// TODO(mpcomplete): rename to CreateInfo when http://crbug.com/123073 is
|
||||
// fixed.
|
||||
dictionary AlarmCreateInfo {
|
||||
// Time at which the alarm should fire, in milliseconds past the epoch
|
||||
// (e.g. <code>Date.now() + n</code>).
|
||||
double? when;
|
||||
|
||||
// Length of time in minutes after which the <code>onAlarm</code> event
|
||||
// should fire.
|
||||
//
|
||||
// <!-- TODO: need minimum=0 -->
|
||||
double? delayInMinutes;
|
||||
|
||||
// If set, the onAlarm event should fire every <var>periodInMinutes</var>
|
||||
// minutes after the initial event specified by <var>when</var> or
|
||||
// <var>delayInMinutes</var>. If not set, the alarm will only fire once.
|
||||
//
|
||||
// <!-- TODO: need minimum=0 -->
|
||||
double? periodInMinutes;
|
||||
};
|
||||
|
||||
callback VoidCallback = void ();
|
||||
callback AlarmCallback = void (optional Alarm alarm);
|
||||
callback AlarmListCallback = void (Alarm[] alarms);
|
||||
callback ClearCallback = void (boolean wasCleared);
|
||||
|
||||
interface Functions {
|
||||
// Creates an alarm. Near the time(s) specified by <var>alarmInfo</var>,
|
||||
// the <code>onAlarm</code> event is fired. If there is another alarm with
|
||||
// the same name (or no name if none is specified), it will be cancelled and
|
||||
// replaced by this alarm.
|
||||
//
|
||||
// In order to reduce the load on the user's machine, Chrome limits alarms
|
||||
// to at most once every 30 seconds but may delay them an arbitrary amount
|
||||
// more. That is, setting <code>delayInMinutes</code> or
|
||||
// <code>periodInMinutes</code> to less than <code>0.5</code> will not be
|
||||
// honored and will cause a warning. <code>when</code> can be set to less
|
||||
// than 30 seconds after "now" without warning but won't actually cause the
|
||||
// alarm to fire for at least 30 seconds.
|
||||
//
|
||||
// To help you debug your app or extension, when you've loaded it unpacked,
|
||||
// there's no limit to how often the alarm can fire.
|
||||
//
|
||||
// |name|: Optional name to identify this alarm. Defaults to the empty
|
||||
// string.
|
||||
// |alarmInfo|: Describes when the alarm should fire. The initial time must
|
||||
// be specified by either <var>when</var> or <var>delayInMinutes</var> (but
|
||||
// not both). If <var>periodInMinutes</var> is set, the alarm will repeat
|
||||
// every <var>periodInMinutes</var> minutes after the initial event. If
|
||||
// neither <var>when</var> or <var>delayInMinutes</var> is set for a
|
||||
// repeating alarm, <var>periodInMinutes</var> is used as the default for
|
||||
// <var>delayInMinutes</var>.
|
||||
// |callback|: Invoked when the alarm has been created.
|
||||
static void create(
|
||||
optional DOMString name,
|
||||
AlarmCreateInfo alarmInfo,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Retrieves details about the specified alarm.
|
||||
// |name|: The name of the alarm to get. Defaults to the empty string.
|
||||
static void get(
|
||||
optional DOMString name,
|
||||
AlarmCallback callback);
|
||||
|
||||
// Gets an array of all the alarms.
|
||||
static void getAll(AlarmListCallback callback);
|
||||
|
||||
// Clears the alarm with the given name.
|
||||
// |name|: The name of the alarm to clear. Defaults to the empty string.
|
||||
static void clear(
|
||||
optional DOMString name,
|
||||
optional ClearCallback callback);
|
||||
|
||||
// Clears all alarms.
|
||||
static void clearAll(optional ClearCallback callback);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Fired when an alarm has elapsed. Useful for event pages.
|
||||
// |alarm|: The alarm that has elapsed.
|
||||
static void onAlarm(Alarm alarm);
|
||||
};
|
||||
};
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
// Copyright 2012 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// This is used by the app window API internally to pass through messages to
|
||||
// the shell window.
|
||||
namespace app.currentWindowInternal {
|
||||
|
||||
// Null or undefined indicates that a value should not change.
|
||||
dictionary Bounds {
|
||||
long? left;
|
||||
long? top;
|
||||
long? width;
|
||||
long? height;
|
||||
};
|
||||
|
||||
// Null or undefined indicates that a value should not change. A value of 0
|
||||
// will clear the constraints.
|
||||
dictionary SizeConstraints {
|
||||
long? minWidth;
|
||||
long? minHeight;
|
||||
long? maxWidth;
|
||||
long? maxHeight;
|
||||
};
|
||||
|
||||
dictionary RegionRect {
|
||||
long left;
|
||||
long top;
|
||||
long width;
|
||||
long height;
|
||||
};
|
||||
|
||||
dictionary Region {
|
||||
RegionRect[]? rects;
|
||||
};
|
||||
|
||||
interface Functions {
|
||||
static void focus();
|
||||
static void fullscreen();
|
||||
static void minimize();
|
||||
static void maximize();
|
||||
static void restore();
|
||||
static void drawAttention();
|
||||
static void clearAttention();
|
||||
static void show(optional boolean focused);
|
||||
static void hide();
|
||||
static void setBounds(DOMString boundsType, Bounds bounds);
|
||||
static void setSizeConstraints(DOMString boundsType,
|
||||
SizeConstraints constraints);
|
||||
static void setIcon(DOMString icon_url);
|
||||
static void setShape(Region region);
|
||||
static void setAlwaysOnTop(boolean always_on_top);
|
||||
static void setVisibleOnAllWorkspaces(boolean always_visible);
|
||||
static void setActivateOnPointer(boolean activate_on_pointer);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
static void onClosed();
|
||||
static void onBoundsChanged();
|
||||
static void onFullscreened();
|
||||
static void onMinimized();
|
||||
static void onMaximized();
|
||||
static void onRestored();
|
||||
static void onAlphaEnabledChanged();
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,165 @@
|
||||
// Copyright 2014 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.app.runtime</code> API to manage the app lifecycle.
|
||||
// The app runtime manages app installation, controls the event page, and can
|
||||
// shut down the app at anytime.
|
||||
namespace app.runtime {
|
||||
|
||||
[inline_doc] dictionary LaunchItem {
|
||||
// Entry for the item.
|
||||
[instanceOf=Entry] object entry;
|
||||
|
||||
// The MIME type of the file.
|
||||
DOMString? type;
|
||||
};
|
||||
|
||||
// Enumeration of app launch sources.
|
||||
// This should be kept in sync with AppLaunchSource in
|
||||
// components/services/app_service/public/mojom/types.mojom, and
|
||||
// GetLaunchSourceEnum() in
|
||||
// extensions/browser/api/app_runtime/app_runtime_api.cc.
|
||||
// Note the enumeration is used in UMA histogram so entries
|
||||
// should not be re-ordered or removed.
|
||||
enum LaunchSource {
|
||||
untracked,
|
||||
app_launcher,
|
||||
new_tab_page,
|
||||
reload,
|
||||
restart,
|
||||
load_and_launch,
|
||||
command_line,
|
||||
file_handler,
|
||||
url_handler,
|
||||
system_tray,
|
||||
about_page,
|
||||
keyboard,
|
||||
extensions_page,
|
||||
management_api,
|
||||
ephemeral_app,
|
||||
background,
|
||||
kiosk,
|
||||
chrome_internal,
|
||||
test,
|
||||
installed_notification,
|
||||
context_menu,
|
||||
arc,
|
||||
intent_url,
|
||||
app_home_page,
|
||||
focus_mode,
|
||||
sparky
|
||||
};
|
||||
|
||||
// An app can be launched with a specific action in mind, for example, to
|
||||
// create a new note. The type of action the app was launched
|
||||
// with is available inside of the |actionData| field from the LaunchData
|
||||
// instance.
|
||||
enum ActionType {
|
||||
// The user wants to quickly take a new note.
|
||||
new_note
|
||||
};
|
||||
|
||||
// Optional data that includes action-specific launch information.
|
||||
dictionary ActionData {
|
||||
ActionType actionType;
|
||||
|
||||
// <p>Whether the action was requested on Chrome OS lock screen.</p>
|
||||
// <p>
|
||||
// Launch events with this valued set to <code>true</code> are fired
|
||||
// in lock screen context, where apps have reduced access to extension
|
||||
// APIs, but are able to create windows on lock screen.
|
||||
// </p>
|
||||
// <p>
|
||||
// Note that this value will be set to <code>true</code> only if the app
|
||||
// is set as the lock screen enabled action handler by the user.
|
||||
// </p>
|
||||
[nodoc] boolean? isLockScreenAction;
|
||||
|
||||
// Currently, used only with lock screen actions. If set, indicates whether
|
||||
// the app should attempt to restore state from when the action was last
|
||||
// handled.
|
||||
[nodoc] boolean? restoreLastActionState;
|
||||
};
|
||||
|
||||
// Optional data for the launch. Either <code>items</code>, or
|
||||
// the pair (<code>url, referrerUrl</code>) can be present for any given
|
||||
// launch.
|
||||
[inline_doc] dictionary LaunchData {
|
||||
// The ID of the file or URL handler that the app is being invoked with.
|
||||
// Handler IDs are the top-level keys in the <code>file_handlers</code>
|
||||
// and/or <code>url_handlers</code> dictionaries in the manifest.
|
||||
DOMString? id;
|
||||
|
||||
// The file entries for the <code>onLaunched</code> event triggered by a
|
||||
// matching file handler in the <code>file_handlers</code> manifest key.
|
||||
LaunchItem[]? items;
|
||||
|
||||
// The URL for the <code>onLaunched</code> event triggered by a matching
|
||||
// URL handler in the <code>url_handlers</code> manifest key.
|
||||
DOMString? url;
|
||||
|
||||
// The referrer URL for the <code>onLaunched</code> event triggered by a
|
||||
// matching URL handler in the <code>url_handlers</code> manifest key.
|
||||
DOMString? referrerUrl;
|
||||
|
||||
// Whether the app is launched in a Chrome OS Demo Mode session. Used for
|
||||
// default-installed Demo Mode Chrome apps.
|
||||
[nodoc] boolean? isDemoSession;
|
||||
|
||||
// Whether the app is being launched in a <a
|
||||
// href="https://support.google.com/chromebook/answer/3134673">Chrome OS
|
||||
// kiosk session</a>.
|
||||
boolean? isKioskSession;
|
||||
|
||||
// Whether the app is being launched in a <a
|
||||
// href="https://support.google.com/chrome/a/answer/3017014">Chrome OS
|
||||
// public session</a>.
|
||||
boolean? isPublicSession;
|
||||
|
||||
// Where the app is launched from.
|
||||
LaunchSource? source;
|
||||
|
||||
// Contains data that specifies the <code>ActionType</code> this app was
|
||||
// launched with. This is null if the app was not launched with a specific
|
||||
// action intent.
|
||||
ActionData? actionData;
|
||||
};
|
||||
|
||||
// This object specifies details and operations to perform on the embedding
|
||||
// request. The app to be embedded can make a decision on whether or not to
|
||||
// allow the embedding and what to embed based on the embedder making the
|
||||
// request.
|
||||
dictionary EmbedRequest {
|
||||
DOMString embedderId;
|
||||
|
||||
// Optional developer specified data that the app to be embedded can use
|
||||
// when making an embedding decision.
|
||||
any? data;
|
||||
|
||||
// Allows <code>embedderId</code> to embed this app in an <appview>
|
||||
// element. The <code>url</code> specifies the content to embed.
|
||||
[nocompile] static void allow(DOMString url);
|
||||
|
||||
// Prevents <code> embedderId</code> from embedding this app in an
|
||||
// <appview> element.
|
||||
[nocompile] static void deny();
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Fired when an embedding app requests to embed this app. This event is
|
||||
// only available on dev channel with the flag --enable-app-view.
|
||||
static void onEmbedRequested(EmbedRequest request);
|
||||
|
||||
// Fired when an app is launched from the launcher.
|
||||
static void onLaunched(optional LaunchData launchData);
|
||||
|
||||
// Fired at Chrome startup to apps that were running when Chrome last shut
|
||||
// down, or when apps have been requested to restart from their previous
|
||||
// state for other reasons (e.g. when the user revokes access to an app's
|
||||
// retained files the runtime will restart the app). In these situations if
|
||||
// apps do not have an <code>onRestarted</code> handler they will be sent
|
||||
// an <code>onLaunched </code> event instead.
|
||||
static void onRestarted();
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,502 @@
|
||||
// Copyright 2012 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.app.window</code> API to create windows. Windows
|
||||
// have an optional frame with title bar and size controls. They are not
|
||||
// associated with any Chrome browser windows. See the <a
|
||||
// href="https://github.com/GoogleChrome/chrome-app-samples/tree/master/samples/window-state">
|
||||
// Window State Sample</a> for a demonstration of these options.
|
||||
namespace app.window {
|
||||
|
||||
// Previously named Bounds.
|
||||
dictionary ContentBounds {
|
||||
long? left;
|
||||
long? top;
|
||||
long? width;
|
||||
long? height;
|
||||
};
|
||||
|
||||
dictionary BoundsSpecification {
|
||||
// The X coordinate of the content or window.
|
||||
long? left;
|
||||
|
||||
// The Y coordinate of the content or window.
|
||||
long? top;
|
||||
|
||||
// The width of the content or window.
|
||||
long? width;
|
||||
|
||||
// The height of the content or window.
|
||||
long? height;
|
||||
|
||||
// The minimum width of the content or window.
|
||||
long? minWidth;
|
||||
|
||||
// The minimum height of the content or window.
|
||||
long? minHeight;
|
||||
|
||||
// The maximum width of the content or window.
|
||||
long? maxWidth;
|
||||
|
||||
// The maximum height of the content or window.
|
||||
long? maxHeight;
|
||||
};
|
||||
|
||||
dictionary Bounds {
|
||||
// This property can be used to read or write the current X coordinate of
|
||||
// the content or window.
|
||||
long left;
|
||||
|
||||
// This property can be used to read or write the current Y coordinate of
|
||||
// the content or window.
|
||||
long top;
|
||||
|
||||
// This property can be used to read or write the current width of the
|
||||
// content or window.
|
||||
long width;
|
||||
|
||||
// This property can be used to read or write the current height of the
|
||||
// content or window.
|
||||
long height;
|
||||
|
||||
// This property can be used to read or write the current minimum width of
|
||||
// the content or window. A value of <code>null</code> indicates
|
||||
// 'unspecified'.
|
||||
long? minWidth;
|
||||
|
||||
// This property can be used to read or write the current minimum height of
|
||||
// the content or window. A value of <code>null</code> indicates
|
||||
// 'unspecified'.
|
||||
long? minHeight;
|
||||
|
||||
// This property can be used to read or write the current maximum width of
|
||||
// the content or window. A value of <code>null</code> indicates
|
||||
// 'unspecified'.
|
||||
long? maxWidth;
|
||||
|
||||
// This property can be used to read or write the current maximum height of
|
||||
// the content or window. A value of <code>null</code> indicates
|
||||
// 'unspecified'.
|
||||
long? maxHeight;
|
||||
|
||||
// Set the left and top position of the content or window.
|
||||
static void setPosition(long left, long top);
|
||||
|
||||
// Set the width and height of the content or window.
|
||||
static void setSize(long width, long height);
|
||||
|
||||
// Set the minimum size constraints of the content or window. The minimum
|
||||
// width or height can be set to <code>null</code> to remove the constraint.
|
||||
// A value of <code>undefined</code> will leave a constraint unchanged.
|
||||
static void setMinimumSize(long minWidth, long minHeight);
|
||||
|
||||
// Set the maximum size constraints of the content or window. The maximum
|
||||
// width or height can be set to <code>null</code> to remove the constraint.
|
||||
// A value of <code>undefined</code> will leave a constraint unchanged.
|
||||
static void setMaximumSize(long maxWidth, long maxHeight);
|
||||
};
|
||||
|
||||
dictionary FrameOptions {
|
||||
// Frame type: <code>none</code> or <code>chrome</code> (defaults to
|
||||
// <code>chrome</code>).
|
||||
//
|
||||
// For <code>none</code>, the <code>-webkit-app-region</code> CSS property
|
||||
// can be used to apply draggability to the app's window.
|
||||
//
|
||||
// <code>-webkit-app-region: drag</code> can be used to mark regions
|
||||
// draggable. <code>no-drag</code> can be used to disable this style on
|
||||
// nested elements.
|
||||
DOMString? type;
|
||||
// Allows the frame color to be set. Frame coloring is only available if the
|
||||
// frame type is <code>chrome</code>.
|
||||
//
|
||||
// Frame coloring is new in Chrome 36.
|
||||
DOMString? color;
|
||||
// Allows the frame color of the window when active to be set. Frame
|
||||
// coloring is only available if the frame type is <code>chrome</code>.
|
||||
//
|
||||
// Frame coloring is only available if the frame type is
|
||||
// <code>chrome</code>.
|
||||
//
|
||||
// Frame coloring is new in Chrome 36.
|
||||
DOMString? activeColor;
|
||||
// Allows the frame color of the window when inactive to be set differently
|
||||
// to the active color. Frame
|
||||
// coloring is only available if the frame type is <code>chrome</code>.
|
||||
//
|
||||
// <code>inactiveColor</code> must be used in conjunction with <code>
|
||||
// color</code>.
|
||||
//
|
||||
// Frame coloring is new in Chrome 36.
|
||||
DOMString? inactiveColor;
|
||||
};
|
||||
|
||||
// State of a window: normal, fullscreen, maximized, minimized.
|
||||
enum State { normal, fullscreen, maximized, minimized };
|
||||
|
||||
// Specifies the type of window to create.
|
||||
enum WindowType {
|
||||
// Default window type.
|
||||
shell,
|
||||
// OS managed window (Deprecated).
|
||||
panel
|
||||
};
|
||||
|
||||
[noinline_doc] dictionary CreateWindowOptions {
|
||||
// Id to identify the window. This will be used to remember the size
|
||||
// and position of the window and restore that geometry when a window
|
||||
// with the same id is later opened.
|
||||
// If a window with a given id is created while another window with the same
|
||||
// id already exists, the currently opened window will be focused instead of
|
||||
// creating a new window.
|
||||
DOMString? id;
|
||||
|
||||
// Used to specify the initial position, initial size and constraints of the
|
||||
// window's content (excluding window decorations).
|
||||
// If an <code>id</code> is also specified and a window with a matching
|
||||
// <code>id</code> has been shown before, the remembered bounds will be used
|
||||
// instead.
|
||||
//
|
||||
// Note that the padding between the inner and outer bounds is determined by
|
||||
// the OS. Therefore setting the same bounds property for both the
|
||||
// <code>innerBounds</code> and <code>outerBounds</code> will result in an
|
||||
// error.
|
||||
//
|
||||
// This property is new in Chrome 36.
|
||||
BoundsSpecification? innerBounds;
|
||||
|
||||
// Used to specify the initial position, initial size and constraints of the
|
||||
// window (including window decorations such as the title bar and frame).
|
||||
// If an <code>id</code> is also specified and a window with a matching
|
||||
// <code>id</code> has been shown before, the remembered bounds will be used
|
||||
// instead.
|
||||
//
|
||||
// Note that the padding between the inner and outer bounds is determined by
|
||||
// the OS. Therefore setting the same bounds property for both the
|
||||
// <code>innerBounds</code> and <code>outerBounds</code> will result in an
|
||||
// error.
|
||||
//
|
||||
// This property is new in Chrome 36.
|
||||
BoundsSpecification? outerBounds;
|
||||
|
||||
// Default width of the window.
|
||||
[nodoc, deprecated="Use $(ref:BoundsSpecification)."] long? defaultWidth;
|
||||
|
||||
// Default height of the window.
|
||||
[nodoc, deprecated="Use $(ref:BoundsSpecification)."] long? defaultHeight;
|
||||
|
||||
// Default X coordinate of the window.
|
||||
[nodoc, deprecated="Use $(ref:BoundsSpecification)."] long? defaultLeft;
|
||||
|
||||
// Default Y coordinate of the window.
|
||||
[nodoc, deprecated="Use $(ref:BoundsSpecification)."] long? defaultTop;
|
||||
|
||||
// Width of the window.
|
||||
[nodoc, deprecated="Use $(ref:BoundsSpecification)."] long? width;
|
||||
|
||||
// Height of the window.
|
||||
[nodoc, deprecated="Use $(ref:BoundsSpecification)."] long? height;
|
||||
|
||||
// X coordinate of the window.
|
||||
[nodoc, deprecated="Use $(ref:BoundsSpecification)."] long? left;
|
||||
|
||||
// Y coordinate of the window.
|
||||
[nodoc, deprecated="Use $(ref:BoundsSpecification)."] long? top;
|
||||
|
||||
// Minimum width of the window.
|
||||
[deprecated="Use innerBounds or outerBounds."] long? minWidth;
|
||||
|
||||
// Minimum height of the window.
|
||||
[deprecated="Use innerBounds or outerBounds."] long? minHeight;
|
||||
|
||||
// Maximum width of the window.
|
||||
[deprecated="Use innerBounds or outerBounds."] long? maxWidth;
|
||||
|
||||
// Maximum height of the window.
|
||||
[deprecated="Use innerBounds or outerBounds."] long? maxHeight;
|
||||
|
||||
// Type of window to create.
|
||||
[deprecated="All app windows use the 'shell' window type"] WindowType? type;
|
||||
|
||||
// Creates a special ime window. This window is not focusable and can be
|
||||
// stacked above virtual keyboard window. This is restriced to component ime
|
||||
// extensions.
|
||||
// Requires the <code>app.window.ime</code> API permission.
|
||||
[nodoc] boolean? ime;
|
||||
|
||||
// If true, the window will have its own shelf icon. Otherwise the window
|
||||
// will be grouped in the shelf with other windows that are associated with
|
||||
// the app. Defaults to false. If showInShelf is set to true you need to
|
||||
// specify an id for the window.
|
||||
boolean? showInShelf;
|
||||
|
||||
// URL of the window icon. A window can have its own icon when showInShelf
|
||||
// is set to true. The URL should be a global or an extension local URL.
|
||||
DOMString? icon;
|
||||
|
||||
// Frame type: <code>none</code> or <code>chrome</code> (defaults to
|
||||
// <code>chrome</code>). For <code>none</code>, the
|
||||
// <code>-webkit-app-region</code> CSS property can be used to apply
|
||||
// draggability to the app's window. <code>-webkit-app-region: drag</code>
|
||||
// can be used to mark regions draggable. <code>no-drag</code> can be used
|
||||
// to disable this style on nested elements.
|
||||
//
|
||||
// Use of <code>FrameOptions</code> is new in M36.
|
||||
(DOMString or FrameOptions)? frame;
|
||||
|
||||
// Size and position of the content in the window (excluding the titlebar).
|
||||
// If an id is also specified and a window with a matching id has been shown
|
||||
// before, the remembered bounds of the window will be used instead.
|
||||
[deprecated="Use innerBounds or outerBounds."] ContentBounds? bounds;
|
||||
|
||||
// Enable window background transparency.
|
||||
// Only supported in ash. Requires the <code>app.window.alpha</code> API
|
||||
// permission.
|
||||
[nodoc] boolean? alphaEnabled;
|
||||
|
||||
// The initial state of the window, allowing it to be created already
|
||||
// fullscreen, maximized, or minimized. Defaults to 'normal'.
|
||||
State? state;
|
||||
|
||||
// If true, the window will be created in a hidden state. Call show() on
|
||||
// the window to show it once it has been created. Defaults to false.
|
||||
boolean? hidden;
|
||||
|
||||
// If true, the window will be resizable by the user. Defaults to true.
|
||||
boolean? resizable;
|
||||
|
||||
// By default if you specify an id for the window, the window will only be
|
||||
// created if another window with the same id doesn't already exist. If a
|
||||
// window with the same id already exists that window is activated instead.
|
||||
// If you do want to create multiple windows with the same id, you can
|
||||
// set this property to false.
|
||||
[deprecated="Multiple windows with the same id is no longer supported."] boolean? singleton;
|
||||
|
||||
// If true, the window will stay above most other windows. If there are
|
||||
// multiple windows of this kind, the currently focused window will be in
|
||||
// the foreground. Requires the <code>alwaysOnTopWindows</code>
|
||||
// permission. Defaults to false.
|
||||
//
|
||||
// Call <code>setAlwaysOnTop()</code> on the window to change this property
|
||||
// after creation.
|
||||
boolean? alwaysOnTop;
|
||||
|
||||
// If true, the window will be focused when created. Defaults to true.
|
||||
boolean? focused;
|
||||
|
||||
// If true, and supported by the platform, the window will be visible on all
|
||||
// workspaces.
|
||||
boolean? visibleOnAllWorkspaces;
|
||||
|
||||
// <p>If set, the action that is intended to be handled by the window on
|
||||
// lockscreen. This has to be set to create an app window visible on the
|
||||
// lock screen. The app window should be created only in response to an
|
||||
// app launch request for handling an action from the lock screen. App
|
||||
// window creation will fail if the app was not launched to handle the
|
||||
// action.
|
||||
// </p>
|
||||
// <p>This is <b>Chrome OS only</b>.</p>
|
||||
[nodoc] app.runtime.ActionType? lockScreenAction;
|
||||
};
|
||||
|
||||
// Called in the creating window (parent) before the load event is called in
|
||||
// the created window (child). The parent can set fields or functions on the
|
||||
// child usable from onload. E.g. background.js:
|
||||
//
|
||||
// <code>function(createdWindow) { createdWindow.contentWindow.foo =
|
||||
// function () { }; };</code>
|
||||
//
|
||||
// window.js:
|
||||
//
|
||||
// <code>window.onload = function () { foo(); }</code>
|
||||
callback CreateWindowCallback =
|
||||
void ([instanceOf=AppWindow] object createdWindow);
|
||||
|
||||
[noinline_doc] dictionary AppWindow {
|
||||
// Focus the window.
|
||||
static void focus();
|
||||
|
||||
// Fullscreens the window.
|
||||
//
|
||||
// The user will be able to restore the window by pressing ESC. An
|
||||
// application can prevent the fullscreen state to be left when ESC is
|
||||
// pressed by requesting the <code>app.window.fullscreen.overrideEsc</code>
|
||||
// permission and canceling the event by calling .preventDefault(), in the
|
||||
// keydown and keyup handlers, like this:
|
||||
//
|
||||
// <code>window.onkeydown = window.onkeyup = function(e) { if (e.keyCode ==
|
||||
// 27 /* ESC */) { e.preventDefault(); } };</code>
|
||||
//
|
||||
// Note <code>window.fullscreen()</code> will cause the entire window to
|
||||
// become fullscreen and does not require a user gesture. The HTML5
|
||||
// fullscreen API can also be used to enter fullscreen mode (see
|
||||
// <a href="http://developer.chrome.com/apps/api_other.html">Web APIs</a>
|
||||
// for more details).
|
||||
static void fullscreen();
|
||||
|
||||
// Is the window fullscreen? This will be true if the window has been
|
||||
// created fullscreen or was made fullscreen via the
|
||||
// <code>AppWindow</code> or HTML5 fullscreen APIs.
|
||||
static boolean isFullscreen();
|
||||
|
||||
// Minimize the window.
|
||||
static void minimize();
|
||||
|
||||
// Is the window minimized?
|
||||
static boolean isMinimized();
|
||||
|
||||
// Maximize the window.
|
||||
static void maximize();
|
||||
|
||||
// Is the window maximized?
|
||||
static boolean isMaximized();
|
||||
|
||||
// Restore the window, exiting a maximized, minimized, or fullscreen state.
|
||||
static void restore();
|
||||
|
||||
// Move the window to the position (|left|, |top|).
|
||||
[deprecated="Use outerBounds."] static void moveTo(long left, long top);
|
||||
|
||||
// Resize the window to |width|x|height| pixels in size.
|
||||
[deprecated="Use outerBounds."] static void resizeTo(long width, long height);
|
||||
|
||||
// Draw attention to the window.
|
||||
static void drawAttention();
|
||||
|
||||
// Clear attention to the window.
|
||||
static void clearAttention();
|
||||
|
||||
// Close the window.
|
||||
static void close();
|
||||
|
||||
// Show the window. Does nothing if the window is already visible.
|
||||
// Focus the window if |focused| is set to true or omitted.
|
||||
static void show(optional boolean focused);
|
||||
|
||||
// Hide the window. Does nothing if the window is already hidden.
|
||||
static void hide();
|
||||
|
||||
// Get the window's inner bounds as a $(ref:ContentBounds) object.
|
||||
[nocompile, deprecated="Use innerBounds or outerBounds."] static ContentBounds getBounds();
|
||||
|
||||
// Set the window's inner bounds.
|
||||
[nocompile, deprecated="Use innerBounds or outerBounds."] static void setBounds(ContentBounds bounds);
|
||||
|
||||
// Set the app icon for the window (experimental).
|
||||
// Currently this is only being implemented on Ash.
|
||||
// TODO(stevenjb): Investigate implementing this on Windows and OSX.
|
||||
[nodoc] static void setIcon(DOMString iconUrl);
|
||||
|
||||
// Is the window always on top?
|
||||
static boolean isAlwaysOnTop();
|
||||
|
||||
// Accessors for testing.
|
||||
[nodoc] boolean hasFrameColor;
|
||||
[nodoc] long activeFrameColor;
|
||||
[nodoc] long inactiveFrameColor;
|
||||
|
||||
// Set whether the window should stay above most other windows. Requires the
|
||||
// <code>alwaysOnTopWindows</code> permission.
|
||||
static void setAlwaysOnTop(boolean alwaysOnTop);
|
||||
|
||||
// Can the window use alpha transparency?
|
||||
// TODO(jackhou): Document this properly before going to stable.
|
||||
[nodoc] static boolean alphaEnabled();
|
||||
|
||||
// Set whether the window is visible on all workspaces. (Only for platforms
|
||||
// that support this).
|
||||
static void setVisibleOnAllWorkspaces(boolean alwaysVisible);
|
||||
|
||||
// The JavaScript 'window' object for the created child.
|
||||
[instanceOf=Window] object contentWindow;
|
||||
|
||||
// The id the window was created with.
|
||||
DOMString id;
|
||||
|
||||
// The position, size and constraints of the window's content, which does
|
||||
// not include window decorations.
|
||||
// This property is new in Chrome 36.
|
||||
Bounds innerBounds;
|
||||
|
||||
// The position, size and constraints of the window, which includes window
|
||||
// decorations, such as the title bar and frame.
|
||||
// This property is new in Chrome 36.
|
||||
Bounds outerBounds;
|
||||
};
|
||||
|
||||
interface Functions {
|
||||
// The size and position of a window can be specified in a number of
|
||||
// different ways. The most simple option is not specifying anything at
|
||||
// all, in which case a default size and platform dependent position will
|
||||
// be used.
|
||||
//
|
||||
// To set the position, size and constraints of the window, use the
|
||||
// <code>innerBounds</code> or <code>outerBounds</code> properties. Inner
|
||||
// bounds do not include window decorations. Outer bounds include the
|
||||
// window's title bar and frame. Note that the padding between the inner and
|
||||
// outer bounds is determined by the OS. Therefore setting the same property
|
||||
// for both inner and outer bounds is considered an error (for example,
|
||||
// setting both <code>innerBounds.left</code> and
|
||||
// <code>outerBounds.left</code>).
|
||||
//
|
||||
// To automatically remember the positions of windows you can give them ids.
|
||||
// If a window has an id, This id is used to remember the size and position
|
||||
// of the window whenever it is moved or resized. This size and position is
|
||||
// then used instead of the specified bounds on subsequent opening of a
|
||||
// window with the same id. If you need to open a window with an id at a
|
||||
// location other than the remembered default, you can create it hidden,
|
||||
// move it to the desired location, then show it.
|
||||
static void create(
|
||||
DOMString url,
|
||||
optional CreateWindowOptions options,
|
||||
optional CreateWindowCallback callback);
|
||||
|
||||
// Returns an $(ref:AppWindow) object for the
|
||||
// current script context (ie JavaScript 'window' object). This can also be
|
||||
// called on a handle to a script context for another page, for example:
|
||||
// otherWindow.chrome.app.window.current().
|
||||
[nocompile] static AppWindow current();
|
||||
[nocompile, nodoc] static void initializeAppWindow(object state);
|
||||
|
||||
// Gets an array of all currently created app windows. This method is new in
|
||||
// Chrome 33.
|
||||
[nocompile] static AppWindow[] getAll();
|
||||
|
||||
// Gets an $(ref:AppWindow) with the given id. If no window with the given id
|
||||
// exists null is returned. This method is new in Chrome 33.
|
||||
[nocompile] static AppWindow get(DOMString id);
|
||||
|
||||
// Whether the current platform supports windows being visible on all
|
||||
// workspaces.
|
||||
[nocompile] static boolean canSetVisibleOnAllWorkspaces();
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Fired when the window is resized.
|
||||
[nocompile] static void onBoundsChanged();
|
||||
|
||||
// Fired when the window is closed. Note, this should be listened to from
|
||||
// a window other than the window being closed, for example from the
|
||||
// background page. This is because the window being closed will be in the
|
||||
// process of being torn down when the event is fired, which means not all
|
||||
// APIs in the window's script context will be functional.
|
||||
[nocompile] static void onClosed();
|
||||
|
||||
// Fired when the window is fullscreened (either via the
|
||||
// <code>AppWindow</code> or HTML5 APIs).
|
||||
[nocompile] static void onFullscreened();
|
||||
|
||||
// Fired when the window is maximized.
|
||||
[nocompile] static void onMaximized();
|
||||
|
||||
// Fired when the window is minimized.
|
||||
[nocompile] static void onMinimized();
|
||||
|
||||
// Fired when the window is restored from being minimized or maximized.
|
||||
[nocompile] static void onRestored();
|
||||
|
||||
// Fired when the window's ability to use alpha transparency changes.
|
||||
[nocompile, nodoc] static void onAlphaEnabledChanged();
|
||||
};
|
||||
};
|
||||
+167
@@ -0,0 +1,167 @@
|
||||
// Copyright 2013 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// The <code>chrome.audio</code> API is provided to allow users to
|
||||
// get information about and control the audio devices attached to the
|
||||
// system.
|
||||
// This API is currently only available in kiosk mode for ChromeOS.
|
||||
namespace audio {
|
||||
|
||||
// Type of stream an audio device provides.
|
||||
enum StreamType {
|
||||
INPUT,
|
||||
OUTPUT
|
||||
};
|
||||
|
||||
// Available audio device types.
|
||||
enum DeviceType {
|
||||
HEADPHONE,
|
||||
MIC,
|
||||
USB,
|
||||
BLUETOOTH,
|
||||
HDMI,
|
||||
INTERNAL_SPEAKER,
|
||||
INTERNAL_MIC,
|
||||
FRONT_MIC,
|
||||
REAR_MIC,
|
||||
KEYBOARD_MIC,
|
||||
HOTWORD,
|
||||
LINEOUT,
|
||||
POST_MIX_LOOPBACK,
|
||||
POST_DSP_LOOPBACK,
|
||||
ALSA_LOOPBACK,
|
||||
OTHER
|
||||
};
|
||||
|
||||
dictionary AudioDeviceInfo {
|
||||
// The unique identifier of the audio device.
|
||||
DOMString id;
|
||||
// Stream type associated with this device.
|
||||
StreamType streamType;
|
||||
// Type of the device.
|
||||
DeviceType deviceType;
|
||||
// The user-friendly name (e.g. "USB Microphone").
|
||||
DOMString displayName;
|
||||
// Device name.
|
||||
DOMString deviceName;
|
||||
// True if this is the current active device.
|
||||
boolean isActive;
|
||||
// The sound level of the device, volume for output, gain for input.
|
||||
long level;
|
||||
// The stable/persisted device id string when available.
|
||||
DOMString? stableDeviceId;
|
||||
};
|
||||
|
||||
dictionary DeviceFilter {
|
||||
// If set, only audio devices whose stream type is included in this list
|
||||
// will satisfy the filter.
|
||||
StreamType[]? streamTypes;
|
||||
|
||||
// If set, only audio devices whose active state matches this value will
|
||||
// satisfy the filter.
|
||||
boolean? isActive;
|
||||
};
|
||||
|
||||
dictionary DeviceProperties {
|
||||
// <p>
|
||||
// The audio device's desired sound level. Defaults to the device's
|
||||
// current sound level.
|
||||
// </p>
|
||||
// <p>If used with audio input device, represents audio device gain.</p>
|
||||
// <p>If used with audio output device, represents audio device volume.</p>
|
||||
long? level;
|
||||
};
|
||||
|
||||
dictionary DeviceIdLists {
|
||||
// <p>List of input devices specified by their ID.</p>
|
||||
// <p>To indicate input devices should be unaffected, leave this property
|
||||
// unset.</p>
|
||||
DOMString[]? input;
|
||||
|
||||
// <p>List of output devices specified by their ID.</p>
|
||||
// <p>To indicate output devices should be unaffected, leave this property
|
||||
// unset.</p>
|
||||
DOMString[]? output;
|
||||
};
|
||||
|
||||
dictionary MuteChangedEvent {
|
||||
// The type of the stream for which the mute value changed. The updated mute
|
||||
// value applies to all devices with this stream type.
|
||||
StreamType streamType;
|
||||
|
||||
// Whether or not the stream is now muted.
|
||||
boolean isMuted;
|
||||
};
|
||||
|
||||
dictionary LevelChangedEvent {
|
||||
// ID of device whose sound level has changed.
|
||||
DOMString deviceId;
|
||||
|
||||
// The device's new sound level.
|
||||
long level;
|
||||
};
|
||||
|
||||
callback GetDevicesCallback = void(AudioDeviceInfo[] devices);
|
||||
callback GetMuteCallback = void(boolean value);
|
||||
callback EmptyCallback = void();
|
||||
|
||||
interface Functions {
|
||||
// Gets a list of audio devices filtered based on |filter|.
|
||||
// |filter|: Device properties by which to filter the list of returned
|
||||
// audio devices. If the filter is not set or set to <code>{}</code>,
|
||||
// returned device list will contain all available audio devices.
|
||||
// |callback|: Reports the requested list of audio devices.
|
||||
static void getDevices(
|
||||
optional DeviceFilter filter,
|
||||
GetDevicesCallback callback);
|
||||
|
||||
// Sets lists of active input and/or output devices.
|
||||
// |ids|: <p>Specifies IDs of devices that should be active. If either the
|
||||
// input or output list is not set, devices in that category are
|
||||
// unaffected.
|
||||
// </p>
|
||||
// <p>It is an error to pass in a non-existent device ID.</p>
|
||||
static void setActiveDevices(
|
||||
DeviceIdLists ids,
|
||||
EmptyCallback callback);
|
||||
|
||||
// Sets the properties for the input or output device.
|
||||
static void setProperties(
|
||||
DOMString id,
|
||||
DeviceProperties properties,
|
||||
EmptyCallback callback);
|
||||
|
||||
// Gets the system-wide mute state for the specified stream type.
|
||||
// |streamType|: Stream type for which mute state should be fetched.
|
||||
// |callback|: Callback reporting whether mute is set or not for specified
|
||||
// stream type.
|
||||
static void getMute(
|
||||
StreamType streamType,
|
||||
GetMuteCallback callback);
|
||||
|
||||
// Sets mute state for a stream type. The mute state will apply to all audio
|
||||
// devices with the specified audio stream type.
|
||||
// |streamType|: Stream type for which mute state should be set.
|
||||
// |isMuted|: New mute value.
|
||||
static void setMute(
|
||||
StreamType streamType,
|
||||
boolean isMuted,
|
||||
optional EmptyCallback callback);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Fired when sound level changes for an active audio device.
|
||||
static void onLevelChanged(LevelChangedEvent event);
|
||||
|
||||
// Fired when the mute state of the audio input or output changes.
|
||||
// Note that mute state is system-wide and the new value applies to every
|
||||
// audio device with specified stream type.
|
||||
static void onMuteChanged(MuteChangedEvent event);
|
||||
|
||||
// Fired when audio devices change, either new devices being added, or
|
||||
// existing devices being removed.
|
||||
// |devices|: List of all present audio devices after the change.
|
||||
static void onDeviceListChanged(AudioDeviceInfo[] devices);
|
||||
};
|
||||
};
|
||||
+1577
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,167 @@
|
||||
// Copyright 2014 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// This is the implementation layer of the chrome.automation API, and is
|
||||
// essentially a translation of the internal accessibility tree update system
|
||||
// into an extension API.
|
||||
namespace automationInternal {
|
||||
// Data for an accessibility event and/or an atomic change to an accessibility
|
||||
// tree. See ui/accessibility/ax_tree_update.h for an extended explanation of
|
||||
// the tree update format.
|
||||
[nocompile] dictionary AXEventParams {
|
||||
// The tree id of the web contents that this update is for.
|
||||
DOMString treeID;
|
||||
|
||||
// ID of the node that the event applies to.
|
||||
long targetID;
|
||||
|
||||
// The type of event that this update represents.
|
||||
DOMString eventType;
|
||||
|
||||
// The source of this event.
|
||||
DOMString eventFrom;
|
||||
|
||||
// The mouse coordinates when this event fired.
|
||||
double mouseX;
|
||||
double mouseY;
|
||||
|
||||
|
||||
// ID of an action request resulting in this event.
|
||||
long actionRequestID;
|
||||
};
|
||||
|
||||
dictionary AXTextLocationParams {
|
||||
DOMString treeID;
|
||||
long nodeID;
|
||||
boolean result;
|
||||
long left;
|
||||
long top;
|
||||
long width;
|
||||
long height;
|
||||
long requestID;
|
||||
};
|
||||
|
||||
// Arguments required for all actions supplied to performAction.
|
||||
dictionary PerformActionRequiredParams {
|
||||
DOMString treeID;
|
||||
long automationNodeID;
|
||||
|
||||
// This can be either automation::ActionType or
|
||||
// automation_internal::ActionTypePrivate.
|
||||
DOMString actionType;
|
||||
|
||||
long? requestID;
|
||||
};
|
||||
|
||||
// Arguments for the customAction action. Those args are passed to
|
||||
// performAction as opt_args.
|
||||
dictionary PerformCustomActionParams {
|
||||
long customActionID;
|
||||
};
|
||||
|
||||
// Arguments for the setSelection action supplied to performAction.
|
||||
dictionary SetSelectionParams {
|
||||
// Reuses ActionRequiredParams automationNodeID to mean anchor node id,
|
||||
// and treeID to apply to both anchor and focus node ids.
|
||||
long focusNodeID;
|
||||
long anchorOffset;
|
||||
long focusOffset;
|
||||
};
|
||||
|
||||
// Arguments for the replaceSelectedText action supplied to performAction.
|
||||
dictionary ReplaceSelectedTextParams {
|
||||
DOMString value;
|
||||
};
|
||||
|
||||
// Arguments for the setValue action supplied to performAction.
|
||||
dictionary SetValueParams {
|
||||
DOMString value;
|
||||
};
|
||||
|
||||
|
||||
// Arguments for the scrollToPoint action supplied to performAction.
|
||||
dictionary ScrollToPointParams {
|
||||
long x;
|
||||
long y;
|
||||
};
|
||||
|
||||
// Arguments for the scrollToPositionAtRowColumn action supplied to performAction.
|
||||
dictionary ScrollToPositionAtRowColumnParams {
|
||||
long row;
|
||||
long column;
|
||||
};
|
||||
|
||||
// Arguments for the SetScrollOffset action supplied to performAction.
|
||||
dictionary SetScrollOffsetParams {
|
||||
long x;
|
||||
long y;
|
||||
};
|
||||
|
||||
// Arguments for the getImageData action.
|
||||
dictionary GetImageDataParams {
|
||||
long maxWidth;
|
||||
long maxHeight;
|
||||
};
|
||||
|
||||
// Arguments for the hitTest action.
|
||||
dictionary HitTestParams {
|
||||
long x;
|
||||
long y;
|
||||
DOMString eventToFire;
|
||||
};
|
||||
|
||||
// Arguments for getTextLocation action.
|
||||
dictionary GetTextLocationDataParams {
|
||||
long startIndex;
|
||||
long endIndex;
|
||||
};
|
||||
|
||||
// Callback called when enableDesktop() returns. Returns the accessibility
|
||||
// tree id of the desktop tree.
|
||||
callback EnableDesktopCallback = void(DOMString tree_id);
|
||||
|
||||
// Callback called when disableDesktop() returns. It is safe to clear
|
||||
// accessibility api state at that point.
|
||||
callback DisableDesktopCallback = void();
|
||||
|
||||
interface Functions {
|
||||
// Enable automation of the tree with the given id.
|
||||
static void enableTree(DOMString tree_id);
|
||||
|
||||
// Enables desktop automation.
|
||||
static void enableDesktop(
|
||||
EnableDesktopCallback callback);
|
||||
|
||||
// Disables desktop automation.
|
||||
static void disableDesktop(DisableDesktopCallback callback);
|
||||
|
||||
// Performs an action on an automation node.
|
||||
static void performAction(PerformActionRequiredParams args,
|
||||
object opt_args);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Fired when an accessibility event occurs
|
||||
static void onAccessibilityEvent(AXEventParams update);
|
||||
|
||||
static void onAccessibilityTreeDestroyed(DOMString treeID);
|
||||
|
||||
static void onGetTextLocationResult(AXTextLocationParams params);
|
||||
|
||||
static void onTreeChange(long observerID,
|
||||
DOMString treeID,
|
||||
long nodeID,
|
||||
DOMString changeType);
|
||||
|
||||
static void onChildTreeID(DOMString treeID);
|
||||
|
||||
static void onNodesRemoved(DOMString treeID, long[] nodeIDs);
|
||||
|
||||
static void onAccessibilityTreeSerializationError(DOMString treeID);
|
||||
|
||||
static void onActionResult(DOMString treeID, long requestID, boolean result);
|
||||
|
||||
static void onAllAutomationEventListenersRemoved();
|
||||
};
|
||||
};
|
||||
+187
@@ -0,0 +1,187 @@
|
||||
// Copyright 2012 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.bluetooth</code> API to connect to a Bluetooth
|
||||
// device. All functions report failures via chrome.runtime.lastError.
|
||||
namespace bluetooth {
|
||||
// Allocation authorities for Vendor IDs.
|
||||
enum VendorIdSource {bluetooth, usb};
|
||||
|
||||
// Common device types recognized by Chrome.
|
||||
enum DeviceType {computer, phone, modem, audio, carAudio, video, peripheral,
|
||||
joystick, gamepad, keyboard, mouse, tablet,
|
||||
keyboardMouseCombo};
|
||||
|
||||
// Types for filtering bluetooth devices.
|
||||
enum FilterType {all, known};
|
||||
|
||||
// Transport type of the bluetooth device.
|
||||
enum Transport {invalid, classic, le, dual};
|
||||
|
||||
// Information about the state of the Bluetooth adapter.
|
||||
dictionary AdapterState {
|
||||
// The address of the adapter, in the format 'XX:XX:XX:XX:XX:XX'.
|
||||
DOMString address;
|
||||
|
||||
// The human-readable name of the adapter.
|
||||
DOMString name;
|
||||
|
||||
// Indicates whether or not the adapter has power.
|
||||
boolean powered;
|
||||
|
||||
// Indicates whether or not the adapter is available (i.e. enabled).
|
||||
boolean available;
|
||||
|
||||
// Indicates whether or not the adapter is currently discovering.
|
||||
boolean discovering;
|
||||
};
|
||||
|
||||
// Callback from the <code>getAdapterState</code> method.
|
||||
// |adapterInfo| : Object containing the adapter information.
|
||||
callback AdapterStateCallback = void(AdapterState adapterInfo);
|
||||
|
||||
// Information about the state of a known Bluetooth device. Note: this
|
||||
// dictionary is also used in bluetooth_private.idl
|
||||
dictionary Device {
|
||||
// The address of the device, in the format 'XX:XX:XX:XX:XX:XX'.
|
||||
DOMString address;
|
||||
|
||||
// The human-readable name of the device.
|
||||
DOMString? name;
|
||||
|
||||
// The class of the device, a bit-field defined by
|
||||
// http://www.bluetooth.org/en-us/specification/assigned-numbers/baseband.
|
||||
long? deviceClass;
|
||||
|
||||
// The Device ID record of the device, where available.
|
||||
VendorIdSource? vendorIdSource;
|
||||
long? vendorId;
|
||||
long? productId;
|
||||
long? deviceId;
|
||||
|
||||
// The type of the device, if recognized by Chrome. This is obtained from
|
||||
// the |deviceClass| field and only represents a small fraction of the
|
||||
// possible device types. When in doubt you should use the |deviceClass|
|
||||
// field directly.
|
||||
DeviceType? type;
|
||||
|
||||
// Indicates whether or not the device is paired with the system.
|
||||
boolean? paired;
|
||||
|
||||
// Indicates whether the device is currently connected to the system.
|
||||
boolean? connected;
|
||||
|
||||
// Indicates whether the device is currently connecting to the system.
|
||||
boolean? connecting;
|
||||
|
||||
// Indicates whether the device is connectable.
|
||||
boolean? connectable;
|
||||
|
||||
// UUIDs of protocols, profiles and services advertised by the device.
|
||||
// For classic Bluetooth devices, this list is obtained from EIR data and
|
||||
// SDP tables. For Low Energy devices, this list is obtained from AD and
|
||||
// GATT primary services. For dual mode devices this may be obtained from
|
||||
// both.
|
||||
DOMString[]? uuids;
|
||||
|
||||
// The received signal strength, in dBm. This field is avaliable and valid
|
||||
// only during discovery. Outside of discovery it's value is not specified.
|
||||
long? inquiryRssi;
|
||||
|
||||
// The transmitted power level. This field is avaliable only for LE devices
|
||||
// that include this field in AD. It is avaliable and valid only during
|
||||
// discovery.
|
||||
long? inquiryTxPower;
|
||||
|
||||
// The transport type of the bluetooth device.
|
||||
Transport? transport;
|
||||
|
||||
// The remaining battery of the device.
|
||||
long? batteryPercentage;
|
||||
};
|
||||
|
||||
dictionary BluetoothFilter {
|
||||
// Type of filter to apply to the device list. Default is all.
|
||||
FilterType? filterType;
|
||||
|
||||
// Maximum number of bluetooth devices to return. Default is 0 (no limit)
|
||||
// if unspecified.
|
||||
long? limit;
|
||||
};
|
||||
|
||||
// Callback from the <code>getDevice</code> method.
|
||||
// |deviceInfo| : Object containing the device information.
|
||||
callback GetDeviceCallback = void(Device deviceInfo);
|
||||
|
||||
// Callback from the <code>getDevices</code> method.
|
||||
// |deviceInfos| : Array of object containing device information.
|
||||
callback GetDevicesCallback = void(Device[] deviceInfos);
|
||||
|
||||
// Callback from the <code>startDiscovery</code> method.
|
||||
callback StartDiscoveryCallback = void();
|
||||
|
||||
// Callback from the <code>stopDiscovery</code> method.
|
||||
callback StopDiscoveryCallback = void();
|
||||
|
||||
// These functions all report failures via chrome.runtime.lastError.
|
||||
interface Functions {
|
||||
// Get information about the Bluetooth adapter.
|
||||
// |callback| : Called with an AdapterState object describing the adapter
|
||||
// state.
|
||||
static void getAdapterState(
|
||||
AdapterStateCallback callback);
|
||||
|
||||
// Get information about a Bluetooth device known to the system.
|
||||
// |deviceAddress| : Address of device to get.
|
||||
// |callback| : Called with the Device object describing the device.
|
||||
static void getDevice(
|
||||
DOMString deviceAddress,
|
||||
GetDeviceCallback callback);
|
||||
|
||||
// Get a list of Bluetooth devices known to the system, including paired
|
||||
// and recently discovered devices.
|
||||
// |filter|: Some criteria to filter the list of returned bluetooth devices.
|
||||
// If the filter is not set or set to <code>{}</code>, returned device list
|
||||
// will contain all bluetooth devices. Right now this is only supported in
|
||||
// ChromeOS, for other platforms, a full list is returned.
|
||||
// |callback| : Called when the search is completed.
|
||||
static void getDevices(
|
||||
optional BluetoothFilter filter,
|
||||
GetDevicesCallback callback);
|
||||
|
||||
// Start discovery. Newly discovered devices will be returned via the
|
||||
// onDeviceAdded event. Previously discovered devices already known to
|
||||
// the adapter must be obtained using getDevices and will only be updated
|
||||
// using the |onDeviceChanged| event if information about them changes.
|
||||
//
|
||||
// Discovery will fail to start if this application has already called
|
||||
// startDiscovery. Discovery can be resource intensive: stopDiscovery
|
||||
// should be called as soon as possible.
|
||||
// |callback| : Called to indicate success or failure.
|
||||
static void startDiscovery(
|
||||
optional StartDiscoveryCallback callback);
|
||||
|
||||
// Stop discovery.
|
||||
// |callback| : Called to indicate success or failure.
|
||||
static void stopDiscovery(
|
||||
optional StopDiscoveryCallback callback);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Fired when the state of the Bluetooth adapter changes.
|
||||
// |state| : The new state of the adapter.
|
||||
static void onAdapterStateChanged(AdapterState state);
|
||||
|
||||
// Fired when information about a new Bluetooth device is available.
|
||||
static void onDeviceAdded(Device device);
|
||||
|
||||
// Fired when information about a known Bluetooth device has changed.
|
||||
static void onDeviceChanged(Device device);
|
||||
|
||||
// Fired when a Bluetooth device that was previously discovered has been
|
||||
// out of range for long enough to be considered unavailable again, and
|
||||
// when a paired device is removed.
|
||||
static void onDeviceRemoved(Device device);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,603 @@
|
||||
// Copyright 2014 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// The <code>chrome.bluetoothLowEnergy</code> API is used to communicate with
|
||||
// Bluetooth Smart (Low Energy) devices using the
|
||||
// <a href="https://developer.bluetooth.org/TechnologyOverview/Pages/GATT.aspx">
|
||||
// Generic Attribute Profile (GATT)</a>.
|
||||
namespace bluetoothLowEnergy {
|
||||
// Values representing the possible properties of a characteristic.
|
||||
// Characteristic permissions are inferred from these properties.
|
||||
// Please see the Bluetooth 4.x spec to see the meaning of each individual
|
||||
// property.
|
||||
enum CharacteristicProperty {
|
||||
broadcast, read, writeWithoutResponse, write, notify, indicate,
|
||||
authenticatedSignedWrites, extendedProperties, reliableWrite,
|
||||
writableAuxiliaries, encryptRead, encryptWrite, encryptAuthenticatedRead,
|
||||
encryptAuthenticatedWrite
|
||||
};
|
||||
|
||||
// Values representing possible permissions for a descriptor.
|
||||
// Please see the Bluetooth 4.x spec to see the meaning of each individual
|
||||
// permission.
|
||||
enum DescriptorPermission {
|
||||
read, write, encryptedRead, encryptedWrite, encryptedAuthenticatedRead,
|
||||
encryptedAuthenticatedWrite
|
||||
};
|
||||
|
||||
// Type of advertisement. If 'broadcast' is chosen, the sent advertisement
|
||||
// type will be ADV_NONCONN_IND and the device will broadcast with a random
|
||||
// MAC Address. If set to 'peripheral', the advertisement type will be
|
||||
// ADV_IND or ADV_SCAN_IND and the device will broadcast with real Bluetooth
|
||||
// Adapter's MAC Address.
|
||||
enum AdvertisementType {broadcast, peripheral};
|
||||
|
||||
// Represents a bluetooth central device that is connected to the local GATT
|
||||
// server.
|
||||
dictionary Device {
|
||||
// The address of the device, in the format 'XX:XX:XX:XX:XX:XX'.
|
||||
DOMString address;
|
||||
|
||||
// The human-readable name of the device.
|
||||
DOMString? name;
|
||||
|
||||
// The class of the device, a bit-field defined by
|
||||
// http://www.bluetooth.org/en-us/specification/assigned-numbers/baseband.
|
||||
long? deviceClass;
|
||||
};
|
||||
|
||||
// Represents a peripheral's Bluetooth GATT Service, a collection of
|
||||
// characteristics and relationships to other services that encapsulate
|
||||
// the behavior of part of a device.
|
||||
dictionary Service {
|
||||
// The UUID of the service, e.g. 0000180d-0000-1000-8000-00805f9b34fb.
|
||||
DOMString uuid;
|
||||
|
||||
// Indicates whether the type of this service is primary or secondary.
|
||||
boolean isPrimary;
|
||||
|
||||
// Returns the identifier assigned to this service. Use the instance ID to
|
||||
// distinguish between services from a peripheral with the same UUID and
|
||||
// to make function calls that take in a service identifier. Present, if
|
||||
// this instance represents a remote service.
|
||||
DOMString? instanceId;
|
||||
|
||||
// The device address of the remote peripheral that the GATT service belongs
|
||||
// to. Present, if this instance represents a remote service.
|
||||
DOMString? deviceAddress;
|
||||
};
|
||||
|
||||
// Represents a GATT characteristic, which is a basic data element that
|
||||
// provides further information about a peripheral's service.
|
||||
dictionary Characteristic {
|
||||
// The UUID of the characteristic, e.g.
|
||||
// 00002a37-0000-1000-8000-00805f9b34fb.
|
||||
DOMString uuid;
|
||||
|
||||
// The GATT service this characteristic belongs to.
|
||||
Service? service;
|
||||
|
||||
// The properties of this characteristic.
|
||||
CharacteristicProperty[] properties;
|
||||
|
||||
// Returns the identifier assigned to this characteristic. Use the instance
|
||||
// ID to distinguish between characteristics from a peripheral with the same
|
||||
// UUID and to make function calls that take in a characteristic identifier.
|
||||
// Present, if this instance represents a remote characteristic.
|
||||
DOMString? instanceId;
|
||||
|
||||
// The currently cached characteristic value. This value gets updated when
|
||||
// the value of the characteristic is read or updated via a notification
|
||||
// or indication.
|
||||
ArrayBuffer? value;
|
||||
};
|
||||
|
||||
// Represents a GATT characteristic descriptor, which provides further
|
||||
// information about a characteristic's value.
|
||||
dictionary Descriptor {
|
||||
// The UUID of the characteristic descriptor, e.g.
|
||||
// 00002902-0000-1000-8000-00805f9b34fb.
|
||||
DOMString uuid;
|
||||
|
||||
// The GATT characteristic this descriptor belongs to.
|
||||
Characteristic? characteristic;
|
||||
|
||||
// The permissions of this descriptor.
|
||||
DescriptorPermission[] permissions;
|
||||
|
||||
// Returns the identifier assigned to this descriptor. Use the instance ID
|
||||
// to distinguish between descriptors from a peripheral with the same UUID
|
||||
// and to make function calls that take in a descriptor identifier. Present,
|
||||
// if this instance represents a remote characteristic.
|
||||
DOMString? instanceId;
|
||||
|
||||
// The currently cached descriptor value. This value gets updated when
|
||||
// the value of the descriptor is read.
|
||||
ArrayBuffer? value;
|
||||
};
|
||||
|
||||
// The connection properties specified during a call to $(ref:connect).
|
||||
dictionary ConnectProperties {
|
||||
// Flag indicating whether a connection to the device is left open when the
|
||||
// event page of the application is unloaded (see <a
|
||||
// href="http://developer.chrome.com/apps/app_lifecycle.html">Manage App
|
||||
// Lifecycle</a>). The default value is <code>false.</code>
|
||||
boolean persistent;
|
||||
};
|
||||
|
||||
// Optional characteristic notification session properties specified during a
|
||||
// call to $(ref:startCharacteristicNotifications).
|
||||
dictionary NotificationProperties {
|
||||
// Flag indicating whether the app should receive notifications when the
|
||||
// event page of the application is unloaded (see <a
|
||||
// href="http://developer.chrome.com/apps/app_lifecycle.html">Manage App
|
||||
// Lifecycle</a>). The default value is <code>false</code>.
|
||||
boolean persistent;
|
||||
};
|
||||
|
||||
// Represents an entry of the "Manufacturer Specific Data" field of Bluetooth
|
||||
// LE advertisement data.
|
||||
dictionary ManufacturerData {
|
||||
long id;
|
||||
long[] data;
|
||||
};
|
||||
|
||||
// Represents an entry of the "Service Data" field of Bluetooth LE advertisement
|
||||
// data.
|
||||
dictionary ServiceData {
|
||||
DOMString uuid;
|
||||
long[] data;
|
||||
};
|
||||
|
||||
// Represents a Bluetooth LE advertisement instance.
|
||||
dictionary Advertisement {
|
||||
// Type of advertisement.
|
||||
AdvertisementType type;
|
||||
|
||||
// List of UUIDs to include in the "Service UUIDs" field of the Advertising
|
||||
// Data. These UUIDs can be of the 16bit, 32bit or 128 formats.
|
||||
DOMString[]? serviceUuids;
|
||||
|
||||
// List of manufacturer specific data to be included in "Manufacturer Specific
|
||||
// Data" fields of the advertising data.
|
||||
ManufacturerData[]? manufacturerData;
|
||||
|
||||
// List of UUIDs to include in the "Solicit UUIDs" field of the Advertising
|
||||
// Data. These UUIDs can be of the 16bit, 32bit or 128 formats.
|
||||
DOMString[]? solicitUuids;
|
||||
|
||||
// List of service data to be included in "Service Data" fields of the advertising
|
||||
// data.
|
||||
ServiceData[]? serviceData;
|
||||
};
|
||||
|
||||
// Represents a an attribute read/write request.
|
||||
dictionary Request {
|
||||
// Unique ID for this request. Use this ID when responding to this request.
|
||||
long requestId;
|
||||
// Device that send this request.
|
||||
Device device;
|
||||
// Value to write (if this is a write request).
|
||||
ArrayBuffer? value;
|
||||
};
|
||||
|
||||
// Represents a response to an attribute read/write request.
|
||||
dictionary Response {
|
||||
// Id of the request this is a response to.
|
||||
long requestId;
|
||||
// If this is an error response, this should be true.
|
||||
boolean isError;
|
||||
// Response value. Write requests and error responses will ignore this
|
||||
// parameter.
|
||||
ArrayBuffer? value;
|
||||
};
|
||||
|
||||
// Represents a notification to be sent to a remote device.
|
||||
dictionary Notification {
|
||||
// New value of the characteristic.
|
||||
ArrayBuffer value;
|
||||
// Optional flag for sending an indication instead of a notification.
|
||||
boolean? shouldIndicate;
|
||||
};
|
||||
|
||||
callback CharacteristicCallback = void(Characteristic result);
|
||||
callback CreateCharacteristicCallback = void(DOMString characteristicId);
|
||||
callback CharacteristicsCallback = void(Characteristic[] result);
|
||||
callback DescriptorCallback = void(Descriptor result);
|
||||
callback CreateDescriptorCallback = void(DOMString descriptorId);
|
||||
callback DescriptorsCallback = void(Descriptor[] result);
|
||||
callback ResultCallback = void();
|
||||
callback ServiceCallback = void(Service result);
|
||||
callback CreateServiceCallback = void(DOMString serviceId);
|
||||
callback ServicesCallback = void(Service[] result);
|
||||
callback RegisterAdvertisementCallback = void (long advertisementId);
|
||||
|
||||
// These functions all report failures via chrome.runtime.lastError.
|
||||
interface Functions {
|
||||
// Establishes a connection between the application and the device with the
|
||||
// given address. A device may be already connected and its GATT services
|
||||
// available without calling <code>connect</code>, however, an app that
|
||||
// wants to access GATT services of a device should call this function to
|
||||
// make sure that a connection to the device is maintained. If the device
|
||||
// is not connected, all GATT services of the device will be discovered
|
||||
// after a successful call to <code>connect</code>.
|
||||
// |deviceAddress|: The Bluetooth address of the remote device to which a
|
||||
// GATT connection should be opened.
|
||||
// |properties|: Connection properties (optional).
|
||||
// |callback|: Called when the connect request has completed.
|
||||
static void connect(
|
||||
DOMString deviceAddress,
|
||||
optional ConnectProperties properties,
|
||||
ResultCallback callback);
|
||||
|
||||
// Closes the app's connection to the device with the given address. Note
|
||||
// that this will not always destroy the physical link itself, since there
|
||||
// may be other apps with open connections.
|
||||
// |deviceAddress|: The Bluetooth address of the remote device.
|
||||
// |callback|: Called when the disconnect request has completed.
|
||||
static void disconnect(
|
||||
DOMString deviceAddress,
|
||||
optional ResultCallback callback);
|
||||
|
||||
// Get the GATT service with the given instance ID.
|
||||
// |serviceId|: The instance ID of the requested GATT service.
|
||||
// |callback|: Called with the requested Service object.
|
||||
static void getService(
|
||||
DOMString serviceId,
|
||||
ServiceCallback callback);
|
||||
|
||||
// Create a locally hosted GATT service. This service can be registered
|
||||
// to be available on a local GATT server.
|
||||
// This function is only available if the app has both the
|
||||
// bluetooth:low_energy and the bluetooth:peripheral permissions set to
|
||||
// true. The peripheral permission may not be available to all apps.
|
||||
// |service|: The service to create.
|
||||
// |callback|: Called with the created services's unique ID.
|
||||
static void createService(
|
||||
Service service,
|
||||
CreateServiceCallback callback);
|
||||
|
||||
// Get all the GATT services that were discovered on the remote device with
|
||||
// the given device address.
|
||||
//
|
||||
// <em>Note:</em> If service discovery is not yet complete on the device,
|
||||
// this API will return a subset (possibly empty) of services. A work around
|
||||
// is to add a time based delay and/or call repeatedly until the expected
|
||||
// number of services is returned.
|
||||
//
|
||||
// |deviceAddress|: The Bluetooth address of the remote device whose GATT
|
||||
// services should be returned.
|
||||
// |callback|: Called with the list of requested Service objects.
|
||||
static void getServices(
|
||||
DOMString deviceAddress,
|
||||
ServicesCallback callback);
|
||||
|
||||
// Get the GATT characteristic with the given instance ID that belongs to
|
||||
// the given GATT service, if the characteristic exists.
|
||||
// |characteristicId|: The instance ID of the requested GATT
|
||||
// characteristic.
|
||||
// |callback|: Called with the requested Characteristic object.
|
||||
static void getCharacteristic(
|
||||
DOMString characteristicId,
|
||||
CharacteristicCallback callback);
|
||||
|
||||
// Create a locally hosted GATT characteristic. This characteristic must
|
||||
// be hosted under a valid service. If the service ID is not valid, the
|
||||
// lastError will be set.
|
||||
// This function is only available if the app has both the
|
||||
// bluetooth:low_energy and the bluetooth:peripheral permissions set to
|
||||
// true. The peripheral permission may not be available to all apps.
|
||||
// |characteristic|: The characteristic to create.
|
||||
// |serviceId|: ID of the service to create this characteristic for.
|
||||
// |callback|: Called with the created characteristic's unique ID.
|
||||
static void createCharacteristic(
|
||||
Characteristic characteristic,
|
||||
DOMString serviceId,
|
||||
CreateCharacteristicCallback callback);
|
||||
|
||||
// Get a list of all discovered GATT characteristics that belong to the
|
||||
// given service.
|
||||
// |serviceId|: The instance ID of the GATT service whose characteristics
|
||||
// should be returned.
|
||||
// |callback|: Called with the list of characteristics that belong to the
|
||||
// given service.
|
||||
static void getCharacteristics(
|
||||
DOMString serviceId,
|
||||
CharacteristicsCallback callback);
|
||||
|
||||
// Get a list of GATT services that are included by the given service.
|
||||
// |serviceId|: The instance ID of the GATT service whose included
|
||||
// services should be returned.
|
||||
// |callback|: Called with the list of GATT services included from the
|
||||
// given service.
|
||||
static void getIncludedServices(
|
||||
DOMString serviceId,
|
||||
ServicesCallback callback);
|
||||
|
||||
// Get the GATT characteristic descriptor with the given instance ID.
|
||||
// |descriptorId|: The instance ID of the requested GATT characteristic
|
||||
// descriptor.
|
||||
// |callback|: Called with the requested Descriptor object.
|
||||
static void getDescriptor(
|
||||
DOMString descriptorId,
|
||||
DescriptorCallback callback);
|
||||
|
||||
// Create a locally hosted GATT descriptor. This descriptor must
|
||||
// be hosted under a valid characteristic. If the characteristic ID is not
|
||||
// valid, the lastError will be set.
|
||||
// This function is only available if the app has both the
|
||||
// bluetooth:low_energy and the bluetooth:peripheral permissions set to
|
||||
// true. The peripheral permission may not be available to all apps.
|
||||
// |descriptor|: The descriptor to create.
|
||||
// |characteristicId|: ID of the characteristic to create this descriptor
|
||||
// for.
|
||||
// |callback|: Called with the created descriptor's unique ID.
|
||||
static void createDescriptor(
|
||||
Descriptor descriptor,
|
||||
DOMString characteristicId,
|
||||
CreateDescriptorCallback callback);
|
||||
|
||||
// Get a list of GATT characteristic descriptors that belong to the given
|
||||
// characteristic.
|
||||
// |characteristicId|: The instance ID of the GATT characteristic whose
|
||||
// descriptors should be returned.
|
||||
// |callback|: Called with the list of descriptors that belong to the given
|
||||
// characteristic.
|
||||
static void getDescriptors(
|
||||
DOMString characteristicId,
|
||||
DescriptorsCallback callback);
|
||||
|
||||
// Retrieve the value of a specified characteristic from a remote
|
||||
// peripheral.
|
||||
// |characteristicId|: The instance ID of the GATT characteristic whose
|
||||
// value should be read from the remote device.
|
||||
// |callback|: Called with the Characteristic object whose value was
|
||||
// requested. The <code>value</code> field of the returned Characteristic
|
||||
// object contains the result of the read request.
|
||||
static void readCharacteristicValue(
|
||||
DOMString characteristicId,
|
||||
CharacteristicCallback callback);
|
||||
|
||||
// Write the value of a specified characteristic from a remote peripheral.
|
||||
// |characteristicId|: The instance ID of the GATT characteristic whose
|
||||
// value should be written to.
|
||||
// |value|: The value that should be sent to the remote characteristic as
|
||||
// part of the write request.
|
||||
// |callback|: Called when the write request has completed.
|
||||
static void writeCharacteristicValue(
|
||||
DOMString characteristicId,
|
||||
ArrayBuffer value,
|
||||
ResultCallback callback);
|
||||
|
||||
// Enable value notifications/indications from the specified characteristic.
|
||||
// Once enabled, an application can listen to notifications using the
|
||||
// $(ref:onCharacteristicValueChanged) event.
|
||||
// |characteristicId|: The instance ID of the GATT characteristic that
|
||||
// notifications should be enabled on.
|
||||
// |properties|: Notification session properties (optional).
|
||||
// |callback|: Called when the request has completed.
|
||||
static void startCharacteristicNotifications(
|
||||
DOMString characteristicId,
|
||||
optional NotificationProperties properties,
|
||||
ResultCallback callback);
|
||||
|
||||
// Disable value notifications/indications from the specified
|
||||
// characteristic. After a successful call, the application will stop
|
||||
// receiving notifications/indications from this characteristic.
|
||||
// |characteristicId|: The instance ID of the GATT characteristic on which
|
||||
// this app's notification session should be stopped.
|
||||
// |callback|: Called when the request has completed (optional).
|
||||
static void stopCharacteristicNotifications(
|
||||
DOMString characteristicId,
|
||||
optional ResultCallback callback);
|
||||
|
||||
// Notify a remote device of a new value for a characteristic. If the
|
||||
// shouldIndicate flag in the notification object is true, an indication
|
||||
// will be sent instead of a notification. Note, the characteristic needs
|
||||
// to correctly set the 'notify' or 'indicate' property during creation for
|
||||
// this call to succeed.
|
||||
// This function is only available if the app has both the
|
||||
// bluetooth:low_energy and the bluetooth:peripheral permissions set to
|
||||
// true. The peripheral permission may not be available to all apps.
|
||||
// |characteristicId|: The characteristic to send the notication for.
|
||||
// |notifcation|: The notification to send.
|
||||
// |callback|: Callback called once the notification or indication has
|
||||
// been sent successfully.
|
||||
static void notifyCharacteristicValueChanged(
|
||||
DOMString characteristicId,
|
||||
Notification notification,
|
||||
ResultCallback callback);
|
||||
|
||||
// Retrieve the value of a specified characteristic descriptor from a remote
|
||||
// peripheral.
|
||||
// |descriptorId|: The instance ID of the GATT characteristic descriptor
|
||||
// whose value should be read from the remote device.
|
||||
// |callback|: Called with the Descriptor object whose value was requested.
|
||||
// The <code>value</code> field of the returned Descriptor object contains
|
||||
// the result of the read request.
|
||||
static void readDescriptorValue(
|
||||
DOMString descriptorId,
|
||||
DescriptorCallback callback);
|
||||
|
||||
// Write the value of a specified characteristic descriptor from a remote
|
||||
// peripheral.
|
||||
// |descriptorId|: The instance ID of the GATT characteristic descriptor
|
||||
// whose value should be written to.
|
||||
// |value|: The value that should be sent to the remote descriptor as part
|
||||
// of the write request.
|
||||
// |callback|: Called when the write request has completed.
|
||||
static void writeDescriptorValue(
|
||||
DOMString descriptorId,
|
||||
ArrayBuffer value,
|
||||
ResultCallback callback);
|
||||
|
||||
// Register the given service with the local GATT server. If the service
|
||||
// ID is invalid, the lastError will be set.
|
||||
// This function is only available if the app has both the
|
||||
// bluetooth:low_energy and the bluetooth:peripheral permissions set to
|
||||
// true. The peripheral permission may not be available to all apps.
|
||||
// |serviceId|: Unique ID of a created service.
|
||||
// |callback|: Callback with the result of the register operation.
|
||||
static void registerService(
|
||||
DOMString serviceId,
|
||||
ResultCallback callback);
|
||||
|
||||
// Unregister the given service with the local GATT server. If the service
|
||||
// ID is invalid, the lastError will be set.
|
||||
// This function is only available if the app has both the
|
||||
// bluetooth:low_energy and the bluetooth:peripheral permissions set to
|
||||
// true. The peripheral permission may not be available to all apps.
|
||||
// |serviceId|: Unique ID of a current registered service.
|
||||
// |callback|: Callback with the result of the register operation.
|
||||
static void unregisterService(
|
||||
DOMString serviceId,
|
||||
ResultCallback callback);
|
||||
|
||||
// Remove the specified service, unregistering it if it was registered.
|
||||
// If the service ID is invalid, the lastError will be set.
|
||||
// This function is only available if the app has both the
|
||||
// bluetooth:low_energy and the bluetooth:peripheral permissions set to
|
||||
// true. The peripheral permission may not be available to all apps.
|
||||
// |serviceId|: Unique ID of a current registered service.
|
||||
// |callback|: Callback called once the service is removed.
|
||||
static void removeService(
|
||||
DOMString serviceId,
|
||||
optional ResultCallback callback);
|
||||
|
||||
// Create an advertisement and register it for advertising. To call this
|
||||
// function, the app must have the bluetooth:low_energy and
|
||||
// bluetooth:peripheral permissions set to true. Additionally this API
|
||||
// is only available to auto launched apps in Kiosk Mode or by setting
|
||||
// the '--enable-ble-advertising-in-apps' command-line switch.
|
||||
// See https://developer.chrome.com/apps/manifest/bluetooth
|
||||
// Note: On some hardware, central and peripheral modes at the same time is
|
||||
// supported but on hardware that doesn't support this, making this call
|
||||
// will switch the device to peripheral mode. In the case of hardware which
|
||||
// does not support both central and peripheral mode, attempting to use the
|
||||
// device in both modes will lead to undefined behavior or prevent other
|
||||
// central-role applications from behaving correctly (including the
|
||||
// discovery of Bluetooth Low Energy devices).
|
||||
// |advertisement|: The advertisement to advertise.
|
||||
// |callback|: Called once the registeration is done and we've started
|
||||
// advertising. Returns the id of the created advertisement.
|
||||
static void registerAdvertisement(
|
||||
Advertisement advertisement,
|
||||
RegisterAdvertisementCallback callback);
|
||||
|
||||
// Unregisters an advertisement and stops its advertising. If the
|
||||
// advertisement fails to unregister the only way to stop advertising
|
||||
// might be to restart the device.
|
||||
// |advertisementId|: Id of the advertisement to unregister.
|
||||
// |callback|: Called once the advertisement is unregistered and is no
|
||||
// longer being advertised.
|
||||
static void unregisterAdvertisement(
|
||||
long advertisementId,
|
||||
ResultCallback callback);
|
||||
|
||||
// Resets advertising on the current device. It will unregister and
|
||||
// stop all existing advertisements.
|
||||
// |callback|: Called once the advertisements are reset.
|
||||
static void resetAdvertising(ResultCallback callback);
|
||||
|
||||
// Set's the interval betweeen two consecutive advertisements. Note:
|
||||
// This is a best effort. The actual interval may vary non-trivially
|
||||
// from the requested intervals. On some hardware, there is a minimum
|
||||
// interval of 100ms. The minimum and maximum values cannot exceed the
|
||||
// the range allowed by the Bluetooth 4.2 specification.
|
||||
// |minInterval|: Minimum interval between advertisments (in
|
||||
// milliseconds). This cannot be lower than 20ms (as per the spec).
|
||||
// |maxInterval|: Maximum interval between advertisments (in
|
||||
// milliseconds). This cannot be more than 10240ms (as per the spec).
|
||||
// |callback|: Called once the interval has been set.
|
||||
static void setAdvertisingInterval(
|
||||
long minInterval,
|
||||
long maxInterval,
|
||||
ResultCallback callback);
|
||||
|
||||
// Sends a response for a characteristic or descriptor read/write
|
||||
// request.
|
||||
// This function is only available if the app has both the
|
||||
// bluetooth:low_energy and the bluetooth:peripheral permissions set to
|
||||
// true. The peripheral permission may not be available to all apps.
|
||||
// |response|: The response to the request.
|
||||
static void sendRequestResponse(Response response);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Fired whan a new GATT service has been discovered on a remote device.
|
||||
// |service|: The GATT service that was added.
|
||||
static void onServiceAdded(Service service);
|
||||
|
||||
// Fired when the state of a remote GATT service changes. This involves any
|
||||
// characteristics and/or descriptors that get added or removed from the
|
||||
// service, as well as "ServiceChanged" notifications from the remote
|
||||
// device.
|
||||
// |service|: The GATT service whose state has changed.
|
||||
static void onServiceChanged(Service service);
|
||||
|
||||
// Fired when a GATT service that was previously discovered on a remote
|
||||
// device has been removed.
|
||||
// |service|: The GATT service that was removed.
|
||||
static void onServiceRemoved(Service service);
|
||||
|
||||
// Fired when the value of a remote GATT characteristic changes, either as
|
||||
// a result of a read request, or a value change notification/indication
|
||||
// This event will only be sent if the app has enabled notifications by
|
||||
// calling $(ref:startCharacteristicNotifications).
|
||||
// |characteristic|: The GATT characteristic whose value has changed.
|
||||
static void onCharacteristicValueChanged(Characteristic characteristic);
|
||||
|
||||
// Fired when the value of a remote GATT characteristic descriptor changes,
|
||||
// usually as a result of a read request. This event exists
|
||||
// mostly for convenience and will always be sent after a successful
|
||||
// call to $(ref:readDescriptorValue).
|
||||
// |descriptor|: The GATT characteristic descriptor whose value has
|
||||
// changed.
|
||||
static void onDescriptorValueChanged(Descriptor descriptor);
|
||||
|
||||
// Fired when a connected central device requests to read the value of a
|
||||
// characteristic registered on the local GATT server. Not responding
|
||||
// to this request for a long time may lead to a disconnection.
|
||||
// This event is only available if the app has both the
|
||||
// bluetooth:low_energy and the bluetooth:peripheral permissions set to
|
||||
// true. The peripheral permission may not be available to all apps.
|
||||
// |request|: Request data for this request.
|
||||
// |characteristic|: The GATT characteristic whose value is requested.
|
||||
static void onCharacteristicReadRequest(
|
||||
Request request, DOMString characteristicId);
|
||||
|
||||
// Fired when a connected central device requests to write the value of a
|
||||
// characteristic registered on the local GATT server. Not responding
|
||||
// to this request for a long time may lead to a disconnection.
|
||||
// This event is only available if the app has both the
|
||||
// bluetooth:low_energy and the bluetooth:peripheral permissions set to
|
||||
// true. The peripheral permission may not be available to all apps.
|
||||
// |request|: Request data for this request.
|
||||
// |characteristic|: The GATT characteristic whose value is being written.
|
||||
static void onCharacteristicWriteRequest(
|
||||
Request request, DOMString characteristicId);
|
||||
|
||||
// Fired when a connected central device requests to read the value of a
|
||||
// descriptor registered on the local GATT server. Not responding to
|
||||
// this request for a long time may lead to a disconnection.
|
||||
// This event is only available if the app has both the
|
||||
// bluetooth:low_energy and the bluetooth:peripheral permissions set to
|
||||
// true. The peripheral permission may not be available to all apps.
|
||||
// |request|: Request data for this request.
|
||||
// |descriptor|: The GATT descriptor whose value is requested.
|
||||
static void onDescriptorReadRequest(
|
||||
Request request, DOMString descriptorId);
|
||||
|
||||
// Fired when a connected central device requests to write the value of a
|
||||
// descriptor registered on the local GATT server. Not responding to
|
||||
// this request for a long time may lead to a disconnection.
|
||||
// This event is only available if the app has both the
|
||||
// bluetooth:low_energy and the bluetooth:peripheral permissions set to
|
||||
// true. The peripheral permission may not be available to all apps.
|
||||
// |request|: Request data for this request.
|
||||
// |descriptor|: The GATT descriptor whose value is being written.
|
||||
static void onDescriptorWriteRequest(
|
||||
Request request, DOMString descriptorId);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,197 @@
|
||||
// Copyright 2015 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.bluetoothPrivate</code> API to control the Bluetooth
|
||||
// adapter state and handle device pairing.
|
||||
// NOTE: This IDL is dependent on bluetooth.idl.
|
||||
|
||||
[implemented_in = "extensions/browser/api/bluetooth/bluetooth_private_api.h"]
|
||||
namespace bluetoothPrivate {
|
||||
// Events that can occur during pairing. The method used for pairing varies
|
||||
// depending on the capability of the two devices.
|
||||
enum PairingEventType {
|
||||
// An alphanumeric PIN code is required to be entered by the user.
|
||||
requestPincode,
|
||||
|
||||
// Display a PIN code to the user.
|
||||
displayPincode,
|
||||
|
||||
// A numeric passkey is required to be entered by the user.
|
||||
requestPasskey,
|
||||
|
||||
// Display a zero padded 6 digit numeric passkey that the user entered on
|
||||
// the remote device. This event may occur multiple times during pairing to
|
||||
// update the entered passkey.
|
||||
displayPasskey,
|
||||
|
||||
// The number of keys inputted by the user on the remote device when
|
||||
// entering a passkey. This event may be called multiple times during
|
||||
// pairing to update the number of keys inputted.
|
||||
keysEntered,
|
||||
|
||||
// Requests that a 6 digit passkey be displayed and the user confirms that
|
||||
// both devies show the same passkey.
|
||||
confirmPasskey,
|
||||
|
||||
// Requests authorization for a pairing under the just-works model. It is up
|
||||
// to the app to ask for user confirmation.
|
||||
requestAuthorization,
|
||||
|
||||
// Pairing is completed.
|
||||
complete
|
||||
};
|
||||
|
||||
// Results for connect(). See function declaration for details.
|
||||
enum ConnectResultType {
|
||||
alreadyConnected,
|
||||
authCanceled,
|
||||
authFailed,
|
||||
authRejected,
|
||||
authTimeout,
|
||||
failed,
|
||||
inProgress,
|
||||
success,
|
||||
unknownError,
|
||||
unsupportedDevice,
|
||||
notReady,
|
||||
alreadyExists,
|
||||
notConnected,
|
||||
doesNotExist,
|
||||
invalidArgs,
|
||||
nonAuthTimeout,
|
||||
noMemory,
|
||||
jniEnvironment,
|
||||
jniThreadAttach,
|
||||
wakelock
|
||||
};
|
||||
|
||||
// Valid pairing responses.
|
||||
enum PairingResponse {
|
||||
confirm, reject, cancel
|
||||
};
|
||||
|
||||
enum TransportType {
|
||||
le, bredr, dual
|
||||
};
|
||||
|
||||
// A pairing event received from a Bluetooth device.
|
||||
dictionary PairingEvent {
|
||||
PairingEventType pairing;
|
||||
bluetooth.Device device;
|
||||
DOMString? pincode;
|
||||
long? passkey;
|
||||
long? enteredKey;
|
||||
};
|
||||
|
||||
dictionary NewAdapterState {
|
||||
// The human-readable name of the adapter.
|
||||
DOMString? name;
|
||||
|
||||
// Whether or not the adapter has power.
|
||||
boolean? powered;
|
||||
|
||||
// Whether the adapter is discoverable by other devices.
|
||||
boolean? discoverable;
|
||||
};
|
||||
|
||||
dictionary SetPairingResponseOptions {
|
||||
// The remote device to send the pairing response.
|
||||
bluetooth.Device device;
|
||||
|
||||
// The response type.
|
||||
PairingResponse response;
|
||||
|
||||
// A 1-16 character alphanumeric set in response to
|
||||
// <code>requestPincode</code>.
|
||||
DOMString? pincode;
|
||||
|
||||
// An integer between 0-999999 set in response to
|
||||
// <code>requestPasskey</code>.
|
||||
long? passkey;
|
||||
};
|
||||
|
||||
dictionary DiscoveryFilter {
|
||||
// Transport type.
|
||||
TransportType? transport;
|
||||
|
||||
// uuid of service or array of uuids
|
||||
(DOMString or DOMString[])? uuids;
|
||||
|
||||
// RSSI ranging value. Only devices with RSSI higher than this value will be
|
||||
// reported.
|
||||
long? rssi;
|
||||
|
||||
// Pathloss ranging value. Only devices with pathloss lower than this value
|
||||
// will be reported.
|
||||
long? pathloss;
|
||||
};
|
||||
|
||||
callback VoidCallback = void();
|
||||
callback ConnectCallback = void(ConnectResultType result);
|
||||
|
||||
// These functions all report failures via chrome.runtime.lastError.
|
||||
interface Functions {
|
||||
// Changes the state of the Bluetooth adapter.
|
||||
// |adapterState|: The new state of the adapter.
|
||||
// |callback|: Called when all the state changes have been completed.
|
||||
static void setAdapterState(
|
||||
NewAdapterState adapterState,
|
||||
optional VoidCallback callback);
|
||||
|
||||
static void setPairingResponse(
|
||||
SetPairingResponseOptions options,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Tears down all connections to the given device.
|
||||
static void disconnectAll(
|
||||
DOMString deviceAddress,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Forgets the given device.
|
||||
static void forgetDevice(
|
||||
DOMString deviceAddress,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Set or clear discovery filter.
|
||||
static void setDiscoveryFilter(
|
||||
DiscoveryFilter discoveryFilter,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Connects to the given device. This will only throw an error if the
|
||||
// device address is invalid or the device is already connected. Otherwise
|
||||
// this will succeed and invoke |callback| with ConnectResultType.
|
||||
static void connect(
|
||||
DOMString deviceAddress,
|
||||
optional ConnectCallback callback);
|
||||
|
||||
// Pairs the given device.
|
||||
static void pair(
|
||||
DOMString deviceAddress,
|
||||
optional VoidCallback callback);
|
||||
|
||||
// Record that a pairing attempt finished. Ignores cancellations.
|
||||
static void recordPairing(bluetooth.Transport transport,
|
||||
long pairingDurationMs,
|
||||
optional ConnectResultType result);
|
||||
|
||||
// Record that a user-initiated reconnection attempt to an already paired
|
||||
// device finished. Ignores cancellations.
|
||||
static void recordReconnection(optional ConnectResultType result);
|
||||
|
||||
// Record that a user selected a device to connect to.
|
||||
static void recordDeviceSelection(long selectionDurationMs,
|
||||
boolean wasPaired,
|
||||
bluetooth.Transport transport);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Fired when a pairing event occurs.
|
||||
// |pairingEvent|: A pairing event.
|
||||
[maxListeners=1] static void onPairing(PairingEvent pairingEvent);
|
||||
|
||||
// Fired when a Bluetooth device changed its address.
|
||||
static void onDeviceAddressChanged(bluetooth.Device device,
|
||||
DOMString oldAddress);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,326 @@
|
||||
// Copyright 2014 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.bluetoothSocket</code> API to send and receive data
|
||||
// to Bluetooth devices using RFCOMM and L2CAP connections.
|
||||
namespace bluetoothSocket {
|
||||
// The socket properties specified in the $ref:create or $ref:update
|
||||
// function. Each property is optional. If a property value is not specified,
|
||||
// a default value is used when calling $ref:create, or the existing value is
|
||||
// preserved when calling $ref:update.
|
||||
dictionary SocketProperties {
|
||||
// Flag indicating whether the socket is left open when the event page of
|
||||
// the application is unloaded (see <a
|
||||
// href="http://developer.chrome.com/apps/app_lifecycle.html">Manage App
|
||||
// Lifecycle</a>). The default value is <code>false.</code> When the
|
||||
// application is loaded, any sockets previously opened with persistent=true
|
||||
// can be fetched with $ref:getSockets.
|
||||
boolean? persistent;
|
||||
|
||||
// An application-defined string associated with the socket.
|
||||
DOMString? name;
|
||||
|
||||
// The size of the buffer used to receive data. The default value is 4096.
|
||||
long? bufferSize;
|
||||
};
|
||||
|
||||
// Result of <code>create</code> call.
|
||||
dictionary CreateInfo {
|
||||
// The ID of the newly created socket. Note that socket IDs created
|
||||
// from this API are not compatible with socket IDs created from other APIs,
|
||||
// such as the <code>$(ref:sockets.tcp)</code> API.
|
||||
long socketId;
|
||||
};
|
||||
|
||||
// Callback from the <code>create</code> method.
|
||||
// |createInfo| : The result of the socket creation.
|
||||
callback CreateCallback = void (CreateInfo createInfo);
|
||||
|
||||
// Callback from the <code>update</code> method.
|
||||
callback UpdateCallback = void ();
|
||||
|
||||
// Callback from the <code>setPaused</code> method.
|
||||
callback SetPausedCallback = void ();
|
||||
|
||||
// Options that may be passed to the <code>listenUsingRfcomm</code> and
|
||||
// <code>listenUsingL2cap</code> methods. Each property is optional with a
|
||||
// default being used if not specified.
|
||||
dictionary ListenOptions {
|
||||
// The RFCOMM Channel used by <code>listenUsingRfcomm</code>. If specified,
|
||||
// this channel must not be previously in use or the method call will fail.
|
||||
// When not specified, an unused channel will be automatically allocated.
|
||||
long? channel;
|
||||
|
||||
// The L2CAP PSM used by <code>listenUsingL2cap</code>. If specified, this
|
||||
// PSM must not be previously in use or the method call with fail. When
|
||||
// not specified, an unused PSM will be automatically allocated.
|
||||
long? psm;
|
||||
|
||||
// Length of the socket's listen queue. The default value depends on the
|
||||
// operating system's host subsystem.
|
||||
long? backlog;
|
||||
};
|
||||
|
||||
// Callback from the <code>listenUsingRfcomm</code> and
|
||||
// <code>listenUsingL2cap</code> methods.
|
||||
callback ListenCallback = void ();
|
||||
|
||||
// Callback from the <code>connect</code> method.
|
||||
callback ConnectCallback = void ();
|
||||
|
||||
// Callback from the <code>disconnect</code> method.
|
||||
callback DisconnectCallback = void ();
|
||||
|
||||
// Callback from the <code>close</code> method.
|
||||
callback CloseCallback = void ();
|
||||
|
||||
// Callback from the <code>send</code> method.
|
||||
// |bytesSent| : The number of bytes sent.
|
||||
callback SendCallback = void (long bytesSent);
|
||||
|
||||
// Result of the <code>getInfo</code> method.
|
||||
dictionary SocketInfo {
|
||||
// The socket identifier.
|
||||
long socketId;
|
||||
|
||||
// Flag indicating if the socket remains open when the event page of the
|
||||
// application is unloaded (see <code>SocketProperties.persistent</code>).
|
||||
// The default value is "false".
|
||||
boolean persistent;
|
||||
|
||||
// Application-defined string associated with the socket.
|
||||
DOMString? name;
|
||||
|
||||
// The size of the buffer used to receive data. If no buffer size has been
|
||||
// specified explictly, the value is not provided.
|
||||
long? bufferSize;
|
||||
|
||||
// Flag indicating whether a connected socket blocks its peer from sending
|
||||
// more data, or whether connection requests on a listening socket are
|
||||
// dispatched through the <code>onAccept</code> event or queued up in the
|
||||
// listen queue backlog.
|
||||
// See <code>setPaused</code>. The default value is "false".
|
||||
boolean paused;
|
||||
|
||||
// Flag indicating whether the socket is connected to a remote peer.
|
||||
boolean connected;
|
||||
|
||||
// If the underlying socket is connected, contains the Bluetooth address of
|
||||
// the device it is connected to.
|
||||
DOMString? address;
|
||||
|
||||
// If the underlying socket is connected, contains information about the
|
||||
// service UUID it is connected to, otherwise if the underlying socket is
|
||||
// listening, contains information about the service UUID it is listening
|
||||
// on.
|
||||
DOMString? uuid;
|
||||
};
|
||||
|
||||
// Callback from the <code>getInfo</code> method.
|
||||
// |socketInfo| : Object containing the socket information.
|
||||
callback GetInfoCallback = void (SocketInfo socketInfo);
|
||||
|
||||
// Callback from the <code>getSockets</code> method.
|
||||
// |socketInfos| : Array of object containing socket information.
|
||||
callback GetSocketsCallback = void (SocketInfo[] sockets);
|
||||
|
||||
// Data from an <code>onAccept</code> event.
|
||||
dictionary AcceptInfo {
|
||||
// The server socket identifier.
|
||||
long socketId;
|
||||
|
||||
// The client socket identifier, i.e. the socket identifier of the newly
|
||||
// established connection. This socket identifier should be used only with
|
||||
// functions from the <code>chrome.bluetoothSocket</code> namespace. Note
|
||||
// the client socket is initially paused and must be explictly un-paused by
|
||||
// the application to start receiving data.
|
||||
long clientSocketId;
|
||||
};
|
||||
|
||||
enum AcceptError {
|
||||
// A system error occurred and the connection may be unrecoverable.
|
||||
system_error,
|
||||
|
||||
// The socket is not listening.
|
||||
not_listening
|
||||
};
|
||||
|
||||
// Data from an <code>onAcceptError</code> event.
|
||||
dictionary AcceptErrorInfo {
|
||||
// The server socket identifier.
|
||||
long socketId;
|
||||
|
||||
// The error message.
|
||||
DOMString errorMessage;
|
||||
|
||||
// An error code indicating what went wrong.
|
||||
AcceptError error;
|
||||
};
|
||||
|
||||
// Data from an <code>onReceive</code> event.
|
||||
dictionary ReceiveInfo {
|
||||
// The socket identifier.
|
||||
long socketId;
|
||||
|
||||
// The data received, with a maxium size of <code>bufferSize</code>.
|
||||
ArrayBuffer data;
|
||||
};
|
||||
|
||||
enum ReceiveError {
|
||||
// The connection was disconnected.
|
||||
disconnected,
|
||||
|
||||
// A system error occurred and the connection may be unrecoverable.
|
||||
system_error,
|
||||
|
||||
// The socket has not been connected.
|
||||
not_connected
|
||||
};
|
||||
|
||||
// Data from an <code>onReceiveError</code> event.
|
||||
dictionary ReceiveErrorInfo {
|
||||
// The socket identifier.
|
||||
long socketId;
|
||||
|
||||
// The error message.
|
||||
DOMString errorMessage;
|
||||
|
||||
// An error code indicating what went wrong.
|
||||
ReceiveError error;
|
||||
};
|
||||
|
||||
// These functions all report failures via chrome.runtime.lastError.
|
||||
interface Functions {
|
||||
// Creates a Bluetooth socket.
|
||||
// |properties| : The socket properties (optional).
|
||||
// |callback| : Called when the socket has been created.
|
||||
static void create(
|
||||
optional SocketProperties properties,
|
||||
CreateCallback callback);
|
||||
|
||||
// Updates the socket properties.
|
||||
// |socketId| : The socket identifier.
|
||||
// |properties| : The properties to update.
|
||||
// |callback| : Called when the properties are updated.
|
||||
static void update(
|
||||
long socketId,
|
||||
SocketProperties properties,
|
||||
optional UpdateCallback callback);
|
||||
|
||||
// Enables or disables a connected socket from receiving messages from its
|
||||
// peer, or a listening socket from accepting new connections. The default
|
||||
// value is "false". Pausing a connected socket is typically used by an
|
||||
// application to throttle data sent by its peer. When a connected socket
|
||||
// is paused, no <code>onReceive</code>event is raised. When a socket is
|
||||
// connected and un-paused, <code>onReceive</code> events are raised again
|
||||
// when messages are received. When a listening socket is paused, new
|
||||
// connections are accepted until its backlog is full then additional
|
||||
// connection requests are refused. <code>onAccept</code> events are raised
|
||||
// only when the socket is un-paused.
|
||||
static void setPaused(
|
||||
long socketId,
|
||||
boolean paused,
|
||||
optional SetPausedCallback callback);
|
||||
|
||||
// Listen for connections using the RFCOMM protocol.
|
||||
// |socketId| : The socket identifier.
|
||||
// |uuid| : Service UUID to listen on.
|
||||
// |options| : Optional additional options for the service.
|
||||
// |callback| : Called when listen operation completes.
|
||||
static void listenUsingRfcomm(
|
||||
long socketId,
|
||||
DOMString uuid,
|
||||
optional ListenOptions options,
|
||||
ListenCallback callback);
|
||||
|
||||
// Listen for connections using the L2CAP protocol.
|
||||
// |socketId| : The socket identifier.
|
||||
// |uuid| : Service UUID to listen on.
|
||||
// |options| : Optional additional options for the service.
|
||||
// |callback| : Called when listen operation completes.
|
||||
static void listenUsingL2cap(
|
||||
long socketId,
|
||||
DOMString uuid,
|
||||
optional ListenOptions options,
|
||||
ListenCallback callback);
|
||||
|
||||
// Connects the socket to a remote Bluetooth device. When the
|
||||
// <code>connect</code> operation completes successfully,
|
||||
// <code>onReceive</code> events are raised when data is received from the
|
||||
// peer. If a network error occur while the runtime is receiving packets,
|
||||
// a <code>onReceiveError</code> event is raised, at which point no more
|
||||
// <code>onReceive</code> event will be raised for this socket until the
|
||||
// <code>setPaused(false)</code> method is called.
|
||||
// |socketId| : The socket identifier.
|
||||
// |address| : The address of the Bluetooth device.
|
||||
// |uuid| : The UUID of the service to connect to.
|
||||
// |callback| : Called when the connect attempt is complete.
|
||||
static void connect(
|
||||
long socketId,
|
||||
DOMString address,
|
||||
DOMString uuid,
|
||||
ConnectCallback callback);
|
||||
|
||||
// Disconnects the socket. The socket identifier remains valid.
|
||||
// |socketId| : The socket identifier.
|
||||
// |callback| : Called when the disconnect attempt is complete.
|
||||
static void disconnect(
|
||||
long socketId,
|
||||
optional DisconnectCallback callback);
|
||||
|
||||
// Disconnects and destroys the socket. Each socket created should be
|
||||
// closed after use. The socket id is no longer valid as soon at the
|
||||
// function is called. However, the socket is guaranteed to be closed only
|
||||
// when the callback is invoked.
|
||||
// |socketId| : The socket identifier.
|
||||
// |callback| : Called when the <code>close</code> operation completes.
|
||||
static void close(
|
||||
long socketId,
|
||||
optional CloseCallback callback);
|
||||
|
||||
// Sends data on the given Bluetooth socket.
|
||||
// |socketId| : The socket identifier.
|
||||
// |data| : The data to send.
|
||||
// |callback| : Called with the number of bytes sent.
|
||||
static void send(
|
||||
long socketId,
|
||||
ArrayBuffer data,
|
||||
optional SendCallback callback);
|
||||
|
||||
// Retrieves the state of the given socket.
|
||||
// |socketId| : The socket identifier.
|
||||
// |callback| : Called when the socket state is available.
|
||||
static void getInfo(
|
||||
long socketId,
|
||||
GetInfoCallback callback);
|
||||
|
||||
// Retrieves the list of currently opened sockets owned by the application.
|
||||
// |callback| : Called when the list of sockets is available.
|
||||
static void getSockets(GetSocketsCallback callback);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Event raised when a connection has been established for a given socket.
|
||||
// |info| : The event data.
|
||||
static void onAccept(AcceptInfo info);
|
||||
|
||||
// Event raised when a network error occurred while the runtime was waiting
|
||||
// for new connections on the given socket. Once this event is raised, the
|
||||
// socket is set to <code>paused</code> and no more <code>onAccept</code>
|
||||
// events are raised for this socket.
|
||||
// |info| : The event data.
|
||||
static void onAcceptError(AcceptErrorInfo info);
|
||||
|
||||
// Event raised when data has been received for a given socket.
|
||||
// |info| : The event data.
|
||||
static void onReceive(ReceiveInfo info);
|
||||
|
||||
// Event raised when a network error occured while the runtime was waiting
|
||||
// for data on the socket. Once this event is raised, the socket is set to
|
||||
// <code>paused</code> and no more <code>onReceive</code> events are raised
|
||||
// for this socket.
|
||||
// |info| : The event data.
|
||||
static void onReceiveError(ReceiveErrorInfo info);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,65 @@
|
||||
// Copyright 2018 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Private API for HDMI CEC functionality.
|
||||
[platforms=("chromeos", "lacros")]
|
||||
namespace cecPrivate {
|
||||
|
||||
enum DisplayCecPowerState {
|
||||
// There was an error querying the power state of the display.
|
||||
error,
|
||||
|
||||
// The kernel adapter for the CEC endpoint isn't configured (no EDID set).
|
||||
adapterNotConfigured,
|
||||
|
||||
// No device ACKed the request on the CEC bus.
|
||||
noDevice,
|
||||
|
||||
// The display is a powered on state.
|
||||
on,
|
||||
|
||||
// The display is in standby mode.
|
||||
standby,
|
||||
|
||||
// The display is currently transitioning to an awake state. It can't be
|
||||
// relied on to show any output yet.
|
||||
transitioningToOn,
|
||||
|
||||
// The display is currently transitioning to standby.
|
||||
transitioningToStandby,
|
||||
|
||||
// Found a CEC endpoint but unable to determine the power state.
|
||||
unknown
|
||||
};
|
||||
|
||||
callback DisplayCecPowerStateCallback =
|
||||
void(DisplayCecPowerState[] powerStates);
|
||||
|
||||
callback ChangePowerStateCallback = void();
|
||||
|
||||
interface Functions {
|
||||
// Attempt to put all HDMI CEC compatible devices in standby.
|
||||
//
|
||||
// This is not guaranteed to have any effect on the connected displays.
|
||||
// Displays that do not support HDMI CEC will not be affected.
|
||||
//
|
||||
// |callback| will be run as soon as all displays have been requested to
|
||||
// change their power state.
|
||||
static void sendStandBy(
|
||||
optional ChangePowerStateCallback callback);
|
||||
|
||||
// Attempt to announce this device as the active input source towards all
|
||||
// HDMI CEC enabled displays connected, waking them from standby if
|
||||
// necessary.
|
||||
//
|
||||
// |callback| will be run as soon as all displays have been requested to
|
||||
// change their power state.
|
||||
static void sendWakeUp(
|
||||
optional ChangePowerStateCallback callback);
|
||||
|
||||
// Queries all HDMI CEC capable displays for their current power state.
|
||||
static void queryDisplayCecPowerState(
|
||||
DisplayCecPowerStateCallback callback);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,55 @@
|
||||
// Copyright 2016 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// The <code>chrome.clipboard</code> API is provided to allow users to
|
||||
// access data of the clipboard. This is a temporary solution for
|
||||
// chromeos platform apps until open-web alternative is available. It will be
|
||||
// deprecated once open-web solution is available, which could be in 2017 Q4.
|
||||
[platforms=("chromeos", "lacros"),
|
||||
implemented_in="extensions/browser/api/clipboard/clipboard_api.h"]
|
||||
namespace clipboard {
|
||||
// Supported image types.
|
||||
enum ImageType {png, jpeg};
|
||||
|
||||
enum DataItemType {textPlain, textHtml};
|
||||
|
||||
// Additional data item to be added along with the |image_data| to describe
|
||||
// the |image_data|.
|
||||
dictionary AdditionalDataItem {
|
||||
// Type of the additional data item.
|
||||
DataItemType type;
|
||||
|
||||
// Content of the additional data item. Either the plain text string if
|
||||
// |type| is "textPlain" or markup string if |type| is "textHtml". The
|
||||
// data can not exceed 2MB.
|
||||
DOMString data;
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Fired when clipboard data changes.
|
||||
// Requires clipboard and clipboardRead permissions for adding listener to
|
||||
// chrome.clipboard.onClipboardDataChanged event.
|
||||
// After this event fires, the clipboard data is available by calling
|
||||
// document.execCommand('paste').
|
||||
static void onClipboardDataChanged();
|
||||
};
|
||||
|
||||
callback SetImageDataCallback = void();
|
||||
|
||||
interface Functions {
|
||||
// Sets image data to clipboard.
|
||||
//
|
||||
// |imageData|: The encoded image data.
|
||||
// |type|: The type of image being passed.
|
||||
// |additionalItems|: Additional data items for describing image data.
|
||||
// The callback is called with <code>chrome.runtime.lastError</code>
|
||||
// set to error code if there is an error.
|
||||
// Requires clipboard and clipboardWrite permissions.
|
||||
static void setImageData(
|
||||
ArrayBuffer imageData,
|
||||
ImageType type,
|
||||
optional AdditionalDataItem[] additionalItems,
|
||||
optional SetImageDataCallback callback);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,66 @@
|
||||
// Copyright 2020 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Stub namespace for the "content_scripts" manifest key.
|
||||
[generate_error_messages]
|
||||
namespace contentScripts {
|
||||
// Describes a content script to be injected into a web page.
|
||||
dictionary ContentScript {
|
||||
// Specifies which pages this content script will be injected into. See
|
||||
// <a href="develop/concepts/match-patterns">Match Patterns</a> for more
|
||||
// details on the syntax of these strings.
|
||||
DOMString[] matches;
|
||||
// Excludes pages that this content script would otherwise be injected into.
|
||||
// See <a href="develop/concepts/match-patterns">Match Patterns</a> for more
|
||||
// details on the syntax of these strings.
|
||||
DOMString[]? exclude_matches;
|
||||
// The list of CSS files to be injected into matching pages. These are
|
||||
// injected in the order they appear in this array, before any DOM is
|
||||
// constructed or displayed for the page.
|
||||
DOMString[]? css;
|
||||
// The list of JavaScript files to be injected into matching pages. These
|
||||
// are injected in the order they appear in this array.
|
||||
DOMString[]? js;
|
||||
// If specified true, it will inject into all frames, even if the frame is
|
||||
// not the top-most frame in the tab. Each frame is checked independently
|
||||
// for URL requirements; it will not inject into child frames if the URL
|
||||
// requirements are not met. Defaults to false, meaning that only the top
|
||||
// frame is matched.
|
||||
boolean? all_frames;
|
||||
// Whether the script should inject into any frames where the URL belongs to
|
||||
// a scheme that would never match a specified Match Pattern, including
|
||||
// about:, data:, blob:, and filesystem: schemes. In these cases, in order
|
||||
// to determine if the script should inject, the origin of the URL is
|
||||
// checked. If the origin is `null` (as is the case for data: URLs), then
|
||||
// the "initiator" or "creator" origin is used (i.e., the origin of the
|
||||
// frame that created or navigated this frame). Note that this may not
|
||||
// be the parent frame, if the frame was navigated by another frame in the
|
||||
// document hierarchy.
|
||||
boolean? match_origin_as_fallback;
|
||||
// Whether the script should inject into an about:blank frame where the
|
||||
// parent or opener frame matches one of the patterns declared in matches.
|
||||
// Defaults to false.
|
||||
boolean? match_about_blank;
|
||||
// Applied after matches to include only those URLs that also match this
|
||||
// glob. Intended to emulate the
|
||||
// <a href="http://wiki.greasespot.net/Metadata_Block#.40include">@include
|
||||
// </a> Greasemonkey keyword.
|
||||
DOMString[]? include_globs;
|
||||
// Applied after matches to exclude URLs that match this glob. Intended to
|
||||
// emulate the
|
||||
// <a href="https://wiki.greasespot.net/Metadata_Block#.40exclude">@exclude
|
||||
// </a> Greasemonkey keyword.
|
||||
DOMString[]? exclude_globs;
|
||||
// Specifies when JavaScript files are injected into the web page. The
|
||||
// preferred and default value is <code>document_idle</code>.
|
||||
extensionTypes.RunAt? run_at;
|
||||
// The JavaScript "world" to run the script in. Defaults to
|
||||
// <code>ISOLATED</code>. Only available in Manifest V3 extensions.
|
||||
extensionTypes.ExecutionWorld? world;
|
||||
};
|
||||
|
||||
dictionary ManifestKeys {
|
||||
ContentScript[] content_scripts;
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,16 @@
|
||||
// Copyright 2021 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Stub namespace for manifest keys relating to the cross origin isolation
|
||||
// response headers.
|
||||
namespace crossOriginIsolation {
|
||||
dictionary ResponseHeader {
|
||||
DOMString? value;
|
||||
};
|
||||
|
||||
dictionary ManifestKeys {
|
||||
ResponseHeader? cross_origin_embedder_policy;
|
||||
ResponseHeader? cross_origin_opener_policy;
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,850 @@
|
||||
// Copyright 2017 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// The <code>chrome.declarativeNetRequest</code> API is used to block or modify
|
||||
// network requests by specifying declarative rules. This lets extensions
|
||||
// modify network requests without intercepting them and viewing their content,
|
||||
// thus providing more privacy.
|
||||
[generate_error_messages]
|
||||
namespace declarativeNetRequest {
|
||||
// This describes the resource type of the network request.
|
||||
enum ResourceType {
|
||||
main_frame,
|
||||
sub_frame,
|
||||
stylesheet,
|
||||
script,
|
||||
image,
|
||||
font,
|
||||
object,
|
||||
xmlhttprequest,
|
||||
ping,
|
||||
csp_report,
|
||||
media,
|
||||
websocket,
|
||||
webtransport,
|
||||
webbundle,
|
||||
other
|
||||
};
|
||||
|
||||
// This describes the HTTP request method of a network request.
|
||||
enum RequestMethod {
|
||||
connect,
|
||||
delete,
|
||||
get,
|
||||
head,
|
||||
options,
|
||||
patch,
|
||||
post,
|
||||
put,
|
||||
other
|
||||
};
|
||||
|
||||
// This describes whether the request is first or third party to the frame in
|
||||
// which it originated. A request is said to be first party if it has the same
|
||||
// domain (eTLD+1) as the frame in which the request originated.
|
||||
enum DomainType {
|
||||
// The network request is first party to the frame in which it originated.
|
||||
firstParty,
|
||||
// The network request is third party to the frame in which it originated.
|
||||
thirdParty
|
||||
};
|
||||
|
||||
// This describes the possible operations for a "modifyHeaders" rule.
|
||||
enum HeaderOperation {
|
||||
// Adds a new entry for the specified header. This operation is not
|
||||
// supported for request headers.
|
||||
append,
|
||||
// Sets a new value for the specified header, removing any existing headers
|
||||
// with the same name.
|
||||
set,
|
||||
// Removes all entries for the specified header.
|
||||
remove
|
||||
};
|
||||
|
||||
// Describes the kind of action to take if a given RuleCondition matches.
|
||||
enum RuleActionType {
|
||||
// Block the network request.
|
||||
block,
|
||||
// Redirect the network request.
|
||||
redirect,
|
||||
// Allow the network request. The request won't be intercepted if there is
|
||||
// an allow rule which matches it.
|
||||
allow,
|
||||
// Upgrade the network request url's scheme to https if the request is http
|
||||
// or ftp.
|
||||
upgradeScheme,
|
||||
// Modify request/response headers from the network request.
|
||||
modifyHeaders,
|
||||
// Allow all requests within a frame hierarchy, including the frame request
|
||||
// itself.
|
||||
allowAllRequests
|
||||
};
|
||||
|
||||
// Describes the reason why a given regular expression isn't supported.
|
||||
enum UnsupportedRegexReason {
|
||||
// The regular expression is syntactically incorrect, or uses features
|
||||
// not available in the
|
||||
// <a href = "https://github.com/google/re2/wiki/Syntax">RE2 syntax</a>.
|
||||
syntaxError,
|
||||
// The regular expression exceeds the memory limit.
|
||||
memoryLimitExceeded
|
||||
};
|
||||
|
||||
// Describes a single static ruleset.
|
||||
dictionary Ruleset {
|
||||
// A non-empty string uniquely identifying the ruleset. IDs beginning with
|
||||
// '_' are reserved for internal use.
|
||||
DOMString id;
|
||||
// The path of the JSON ruleset relative to the extension directory.
|
||||
DOMString path;
|
||||
// Whether the ruleset is enabled by default.
|
||||
boolean enabled;
|
||||
};
|
||||
|
||||
// Represents a query key-value pair.
|
||||
dictionary QueryKeyValue {
|
||||
DOMString key;
|
||||
DOMString value;
|
||||
|
||||
// If true, the query key is replaced only if it's already present.
|
||||
// Otherwise, the key is also added if it's missing. Defaults to false.
|
||||
boolean? replaceOnly;
|
||||
};
|
||||
|
||||
// Describes modification to the url query.
|
||||
dictionary QueryTransform {
|
||||
// The list of query keys to be removed.
|
||||
DOMString[]? removeParams;
|
||||
// The list of query key-value pairs to be added or replaced.
|
||||
QueryKeyValue[]? addOrReplaceParams;
|
||||
};
|
||||
|
||||
// Describes modification to various url components.
|
||||
[noinline_doc]
|
||||
dictionary URLTransform {
|
||||
// The new scheme for the request. Allowed values are "http", "https",
|
||||
// "ftp" and "chrome-extension".
|
||||
DOMString? scheme;
|
||||
|
||||
// The new host for the request.
|
||||
DOMString? host;
|
||||
|
||||
// The new port for the request. If empty, the existing port is cleared.
|
||||
DOMString? port;
|
||||
|
||||
// The new path for the request. If empty, the existing path is cleared.
|
||||
DOMString? path;
|
||||
|
||||
// The new query for the request. Should be either empty, in which case the
|
||||
// existing query is cleared; or should begin with '?'.
|
||||
DOMString? query;
|
||||
|
||||
// Add, remove or replace query key-value pairs.
|
||||
QueryTransform? queryTransform;
|
||||
|
||||
// The new fragment for the request. Should be either empty, in which case
|
||||
// the existing fragment is cleared; or should begin with '#'.
|
||||
DOMString? fragment;
|
||||
|
||||
// The new username for the request.
|
||||
DOMString? username;
|
||||
|
||||
// The new password for the request.
|
||||
DOMString? password;
|
||||
};
|
||||
|
||||
dictionary Redirect {
|
||||
// Path relative to the extension directory. Should start with '/'.
|
||||
DOMString? extensionPath;
|
||||
// Url transformations to perform.
|
||||
URLTransform? transform;
|
||||
// The redirect url. Redirects to JavaScript urls are not allowed.
|
||||
DOMString? url;
|
||||
|
||||
// Substitution pattern for rules which specify a <code>regexFilter</code>.
|
||||
// The first match of <code>regexFilter</code> within the url will be
|
||||
// replaced with this pattern. Within <code>regexSubstitution</code>,
|
||||
// backslash-escaped digits (\1 to \9) can be used to insert the
|
||||
// corresponding capture groups. \0 refers to the entire matching text.
|
||||
DOMString? regexSubstitution;
|
||||
};
|
||||
|
||||
dictionary HeaderInfo {
|
||||
// The name of the header. This condition matches on the name
|
||||
// only if both `values` and `excludedValues` are not specified.
|
||||
DOMString header;
|
||||
// If specified, this condition matches if the header's value matches at
|
||||
// least one pattern in this list. This supports case-insensitive header
|
||||
// value matching plus the following constructs:
|
||||
//
|
||||
// <b>'*'</b> : Matches any number of characters.
|
||||
//
|
||||
// <b>'?'</b> : Matches zero or one character(s).
|
||||
//
|
||||
// '*' and '?' can be escaped with a backslash, e.g. '\*' and '\?'
|
||||
DOMString[]? values;
|
||||
// If specified, this condition is not matched if the header exists but its
|
||||
// value contains at least one element in this list. This uses the same
|
||||
// match pattern syntax as `values`.
|
||||
DOMString[]? excludedValues;
|
||||
};
|
||||
|
||||
[noinline_doc] dictionary RuleCondition {
|
||||
|
||||
// The pattern which is matched against the network request url.
|
||||
// Supported constructs:
|
||||
//
|
||||
// <b>'*'</b> : Wildcard: Matches any number of characters.
|
||||
//
|
||||
// <b>'|'</b> : Left/right anchor: If used at either end of the pattern,
|
||||
// specifies the beginning/end of the url respectively.
|
||||
//
|
||||
// <b>'||'</b> : Domain name anchor: If used at the beginning of the
|
||||
// pattern, specifies the start of a (sub-)domain of the URL.
|
||||
//
|
||||
// <b>'^'</b> : Separator character: This matches anything except a letter,
|
||||
// a digit, or one of the following: <code>_</code>,
|
||||
// <code>-</code>, <code>.</code>, or <code>%</code>. This
|
||||
// also match the end of the URL.
|
||||
//
|
||||
// Therefore <code>urlFilter</code> is composed of the following parts:
|
||||
// (optional Left/Domain name anchor) + pattern + (optional Right anchor).
|
||||
//
|
||||
// If omitted, all urls are matched. An empty string is not allowed.
|
||||
//
|
||||
// A pattern beginning with <code>||*</code> is not allowed. Use
|
||||
// <code>*</code> instead.
|
||||
//
|
||||
// Note: Only one of <code>urlFilter</code> or <code>regexFilter</code> can
|
||||
// be specified.
|
||||
//
|
||||
// Note: The <code>urlFilter</code> must be composed of only ASCII
|
||||
// characters. This is matched against a url where the host is encoded in
|
||||
// the punycode format (in case of internationalized domains) and any other
|
||||
// non-ascii characters are url encoded in utf-8.
|
||||
// For example, when the request url is
|
||||
// http://abc.рф?q=ф, the
|
||||
// <code>urlFilter</code> will be matched against the url
|
||||
// http://abc.xn--p1ai/?q=%D1%84.
|
||||
DOMString? urlFilter;
|
||||
|
||||
// Regular expression to match against the network request url. This follows
|
||||
// the <a href = "https://github.com/google/re2/wiki/Syntax">RE2 syntax</a>.
|
||||
//
|
||||
// Note: Only one of <code>urlFilter</code> or <code>regexFilter</code> can
|
||||
// be specified.
|
||||
//
|
||||
// Note: The <code>regexFilter</code> must be composed of only ASCII
|
||||
// characters. This is matched against a url where the host is encoded in
|
||||
// the punycode format (in case of internationalized domains) and any other
|
||||
// non-ascii characters are url encoded in utf-8.
|
||||
DOMString? regexFilter;
|
||||
|
||||
// Whether the <code>urlFilter</code> or <code>regexFilter</code>
|
||||
// (whichever is specified) is case sensitive. Default is false.
|
||||
boolean? isUrlFilterCaseSensitive;
|
||||
|
||||
// The rule will only match network requests originating from the list of
|
||||
// <code>initiatorDomains</code>. If the list is omitted, the rule is
|
||||
// applied to requests from all domains. An empty list is not allowed.
|
||||
//
|
||||
// Notes:
|
||||
// <ul>
|
||||
// <li>Sub-domains like "a.example.com" are also allowed.</li>
|
||||
// <li>The entries must consist of only ascii characters.</li>
|
||||
// <li>Use punycode encoding for internationalized domains.</li>
|
||||
// <li>
|
||||
// This matches against the request initiator and not the request url.
|
||||
// </li>
|
||||
// <li>Sub-domains of the listed domains are also matched.</li>
|
||||
// </ul>
|
||||
DOMString[]? initiatorDomains;
|
||||
|
||||
// The rule will not match network requests originating from the list of
|
||||
// <code>excludedInitiatorDomains</code>. If the list is empty or omitted,
|
||||
// no domains are excluded. This takes precedence over
|
||||
// <code>initiatorDomains</code>.
|
||||
//
|
||||
// Notes:
|
||||
// <ul>
|
||||
// <li>Sub-domains like "a.example.com" are also allowed.</li>
|
||||
// <li>The entries must consist of only ascii characters.</li>
|
||||
// <li>Use punycode encoding for internationalized domains.</li>
|
||||
// <li>
|
||||
// This matches against the request initiator and not the request url.
|
||||
// </li>
|
||||
// <li>Sub-domains of the listed domains are also excluded.</li>
|
||||
// </ul>
|
||||
DOMString[]? excludedInitiatorDomains;
|
||||
|
||||
// The rule will only match network requests when the domain matches one
|
||||
// from the list of <code>requestDomains</code>. If the list is omitted,
|
||||
// the rule is applied to requests from all domains. An empty list is not
|
||||
// allowed.
|
||||
//
|
||||
// Notes:
|
||||
// <ul>
|
||||
// <li>Sub-domains like "a.example.com" are also allowed.</li>
|
||||
// <li>The entries must consist of only ascii characters.</li>
|
||||
// <li>Use punycode encoding for internationalized domains.</li>
|
||||
// <li>Sub-domains of the listed domains are also matched.</li>
|
||||
// </ul>
|
||||
DOMString[]? requestDomains;
|
||||
|
||||
// The rule will not match network requests when the domains matches one
|
||||
// from the list of <code>excludedRequestDomains</code>. If the list is
|
||||
// empty or omitted, no domains are excluded. This takes precedence over
|
||||
// <code>requestDomains</code>.
|
||||
//
|
||||
// Notes:
|
||||
// <ul>
|
||||
// <li>Sub-domains like "a.example.com" are also allowed.</li>
|
||||
// <li>The entries must consist of only ascii characters.</li>
|
||||
// <li>Use punycode encoding for internationalized domains.</li>
|
||||
// <li>Sub-domains of the listed domains are also excluded.</li>
|
||||
// </ul>
|
||||
DOMString[]? excludedRequestDomains;
|
||||
|
||||
// The rule will only match network requests originating from the list of
|
||||
// <code>domains</code>.
|
||||
[deprecated="Use $(ref:initiatorDomains) instead"]
|
||||
DOMString[]? domains;
|
||||
|
||||
// The rule will not match network requests originating from the list of
|
||||
// <code>excludedDomains</code>.
|
||||
[deprecated="Use $(ref:excludedInitiatorDomains) instead"]
|
||||
DOMString[]? excludedDomains;
|
||||
|
||||
// List of resource types which the rule can match. An empty list is not
|
||||
// allowed.
|
||||
//
|
||||
// Note: this must be specified for <code>allowAllRequests</code> rules and
|
||||
// may only include the <code>sub_frame</code> and <code>main_frame</code>
|
||||
// resource types.
|
||||
ResourceType[]? resourceTypes;
|
||||
|
||||
// List of resource types which the rule won't match. Only one of
|
||||
// <code>resourceTypes</code> and <code>excludedResourceTypes</code> should
|
||||
// be specified. If neither of them is specified, all resource types except
|
||||
// "main_frame" are blocked.
|
||||
ResourceType[]? excludedResourceTypes;
|
||||
|
||||
// List of HTTP request methods which the rule can match. An empty list is
|
||||
// not allowed.
|
||||
//
|
||||
// Note: Specifying a <code>requestMethods</code> rule condition will also
|
||||
// exclude non-HTTP(s) requests, whereas specifying
|
||||
// <code>excludedRequestMethods</code> will not.
|
||||
RequestMethod[]? requestMethods;
|
||||
|
||||
// List of request methods which the rule won't match. Only one of
|
||||
// <code>requestMethods</code> and <code>excludedRequestMethods</code>
|
||||
// should be specified. If neither of them is specified, all request methods
|
||||
// are matched.
|
||||
RequestMethod[]? excludedRequestMethods;
|
||||
|
||||
// Specifies whether the network request is first-party or third-party to
|
||||
// the domain from which it originated. If omitted, all requests are
|
||||
// accepted.
|
||||
DomainType? domainType;
|
||||
|
||||
// List of $(ref:tabs.Tab.id) which the rule should match. An ID of
|
||||
// $(ref:tabs.TAB_ID_NONE) matches requests which don't originate from a
|
||||
// tab. An empty list is not allowed. Only supported for session-scoped
|
||||
// rules.
|
||||
long[]? tabIds;
|
||||
|
||||
// List of $(ref:tabs.Tab.id) which the rule should not match. An ID of
|
||||
// $(ref:tabs.TAB_ID_NONE) excludes requests which don't originate from a
|
||||
// tab. Only supported for session-scoped rules.
|
||||
long[]? excludedTabIds;
|
||||
|
||||
// Rule matches if the request matches any response header condition in this
|
||||
// list (if specified).
|
||||
HeaderInfo[]? responseHeaders;
|
||||
|
||||
// Rule does not match if the request matches any response header
|
||||
// condition in this list (if specified). If both `excludedResponseHeaders`
|
||||
// and `responseHeaders` are specified, then the `excludedResponseHeaders`
|
||||
// property takes precedence.
|
||||
HeaderInfo[]? excludedResponseHeaders;
|
||||
};
|
||||
|
||||
dictionary ModifyHeaderInfo {
|
||||
// The name of the header to be modified.
|
||||
DOMString header;
|
||||
|
||||
// The operation to be performed on a header.
|
||||
HeaderOperation operation;
|
||||
|
||||
// The new value for the header. Must be specified for <code>append</code>
|
||||
// and <code>set</code> operations.
|
||||
DOMString? value;
|
||||
};
|
||||
|
||||
[noinline_doc]
|
||||
dictionary RuleAction {
|
||||
// The type of action to perform.
|
||||
RuleActionType type;
|
||||
|
||||
// Describes how the redirect should be performed. Only valid for redirect
|
||||
// rules.
|
||||
Redirect? redirect;
|
||||
|
||||
// The request headers to modify for the request. Only valid if
|
||||
// RuleActionType is "modifyHeaders".
|
||||
ModifyHeaderInfo[]? requestHeaders;
|
||||
|
||||
// The response headers to modify for the request. Only valid if
|
||||
// RuleActionType is "modifyHeaders".
|
||||
ModifyHeaderInfo[]? responseHeaders;
|
||||
};
|
||||
|
||||
dictionary Rule {
|
||||
// An id which uniquely identifies a rule. Mandatory and should be >= 1.
|
||||
long id;
|
||||
|
||||
// Rule priority. Defaults to 1. When specified, should be >= 1.
|
||||
long? priority;
|
||||
|
||||
// The condition under which this rule is triggered.
|
||||
RuleCondition condition;
|
||||
|
||||
// The action to take if this rule is matched.
|
||||
RuleAction action;
|
||||
};
|
||||
|
||||
// Uniquely describes a declarative rule specified by the extension.
|
||||
dictionary MatchedRule {
|
||||
// A matching rule's ID.
|
||||
long ruleId;
|
||||
|
||||
// ID of the $(ref:Ruleset) this rule belongs to. For a rule originating
|
||||
// from the set of dynamic rules, this will be equal to
|
||||
// $(ref:DYNAMIC_RULESET_ID).
|
||||
DOMString rulesetId;
|
||||
};
|
||||
|
||||
[noinline_doc]
|
||||
dictionary GetRulesFilter {
|
||||
// If specified, only rules with matching IDs are included.
|
||||
long[]? ruleIds;
|
||||
};
|
||||
|
||||
[noinline_doc]
|
||||
dictionary MatchedRuleInfo {
|
||||
MatchedRule rule;
|
||||
|
||||
// The time the rule was matched. Timestamps will correspond to the
|
||||
// Javascript convention for times, i.e. number of milliseconds since the
|
||||
// epoch.
|
||||
double timeStamp;
|
||||
|
||||
// The tabId of the tab from which the request originated if the tab is
|
||||
// still active. Else -1.
|
||||
long tabId;
|
||||
};
|
||||
|
||||
dictionary MatchedRulesFilter {
|
||||
// If specified, only matches rules for the given tab. Matches rules not
|
||||
// associated with any active tab if set to -1.
|
||||
long? tabId;
|
||||
|
||||
// If specified, only matches rules after the given timestamp.
|
||||
double? minTimeStamp;
|
||||
};
|
||||
|
||||
dictionary RulesMatchedDetails {
|
||||
// Rules matching the given filter.
|
||||
MatchedRuleInfo[] rulesMatchedInfo;
|
||||
};
|
||||
|
||||
[noinline_doc]
|
||||
dictionary RequestDetails {
|
||||
// The ID of the request. Request IDs are unique within a browser session.
|
||||
DOMString requestId;
|
||||
|
||||
// The URL of the request.
|
||||
DOMString url;
|
||||
|
||||
// The origin where the request was initiated. This does not change through
|
||||
// redirects. If this is an opaque origin, the string 'null' will be used.
|
||||
DOMString? initiator;
|
||||
|
||||
// Standard HTTP method.
|
||||
DOMString method;
|
||||
|
||||
// The value 0 indicates that the request happens in the main frame; a
|
||||
// positive value indicates the ID of a subframe in which the request
|
||||
// happens. If the document of a (sub-)frame is loaded (<code>type</code> is
|
||||
// <code>main_frame</code> or <code>sub_frame</code>), <code>frameId</code>
|
||||
// indicates the ID of this frame, not the ID of the outer frame. Frame IDs
|
||||
// are unique within a tab.
|
||||
long frameId;
|
||||
|
||||
// The unique identifier for the frame's document, if this request is for a
|
||||
// frame.
|
||||
DOMString? documentId;
|
||||
|
||||
// The type of the frame, if this request is for a frame.
|
||||
extensionTypes.FrameType? frameType;
|
||||
|
||||
// The lifecycle of the frame's document, if this request is for a
|
||||
// frame.
|
||||
extensionTypes.DocumentLifecycle? documentLifecycle;
|
||||
|
||||
// ID of frame that wraps the frame which sent the request. Set to -1 if no
|
||||
// parent frame exists.
|
||||
long parentFrameId;
|
||||
|
||||
// The unique identifier for the frame's parent document, if this request
|
||||
// is for a frame and has a parent.
|
||||
DOMString? parentDocumentId;
|
||||
|
||||
// The ID of the tab in which the request takes place. Set to -1 if the
|
||||
// request isn't related to a tab.
|
||||
long tabId;
|
||||
|
||||
// The resource type of the request.
|
||||
ResourceType type;
|
||||
};
|
||||
|
||||
dictionary TestMatchRequestDetails {
|
||||
// The URL of the hypothetical request.
|
||||
DOMString url;
|
||||
|
||||
// The initiator URL (if any) for the hypothetical request.
|
||||
DOMString? initiator;
|
||||
|
||||
// Standard HTTP method of the hypothetical request. Defaults to "get" for
|
||||
// HTTP requests and is ignored for non-HTTP requests.
|
||||
RequestMethod? method;
|
||||
|
||||
// The resource type of the hypothetical request.
|
||||
ResourceType type;
|
||||
|
||||
// The ID of the tab in which the hypothetical request takes place. Does
|
||||
// not need to correspond to a real tab ID. Default is -1, meaning that
|
||||
// the request isn't related to a tab.
|
||||
long? tabId;
|
||||
};
|
||||
|
||||
dictionary MatchedRuleInfoDebug {
|
||||
MatchedRule rule;
|
||||
|
||||
// Details about the request for which the rule was matched.
|
||||
RequestDetails request;
|
||||
};
|
||||
|
||||
[nodoc] dictionary DNRInfo {
|
||||
Ruleset[] rule_resources;
|
||||
};
|
||||
|
||||
[nodoc] dictionary ManifestKeys {
|
||||
DNRInfo declarative_net_request;
|
||||
};
|
||||
|
||||
dictionary RegexOptions {
|
||||
// The regular expresson to check.
|
||||
DOMString regex;
|
||||
|
||||
// Whether the <code>regex</code> specified is case sensitive. Default is
|
||||
// true.
|
||||
boolean? isCaseSensitive;
|
||||
|
||||
// Whether the <code>regex</code> specified requires capturing. Capturing is
|
||||
// only required for redirect rules which specify a
|
||||
// <code>regexSubstition</code> action. The default is false.
|
||||
boolean? requireCapturing;
|
||||
};
|
||||
|
||||
dictionary IsRegexSupportedResult {
|
||||
boolean isSupported;
|
||||
|
||||
// Specifies the reason why the regular expression is not supported. Only
|
||||
// provided if <code>isSupported</code> is false.
|
||||
UnsupportedRegexReason? reason;
|
||||
};
|
||||
|
||||
dictionary TestMatchOutcomeResult {
|
||||
// The rules (if any) that match the hypothetical request.
|
||||
MatchedRule[] matchedRules;
|
||||
};
|
||||
|
||||
dictionary UpdateRuleOptions {
|
||||
// IDs of the rules to remove. Any invalid IDs will be ignored.
|
||||
long[]? removeRuleIds;
|
||||
// Rules to add.
|
||||
Rule[]? addRules;
|
||||
};
|
||||
|
||||
dictionary UpdateRulesetOptions {
|
||||
// The set of ids corresponding to a static $(ref:Ruleset) that should be
|
||||
// disabled.
|
||||
DOMString[]? disableRulesetIds;
|
||||
// The set of ids corresponding to a static $(ref:Ruleset) that should be
|
||||
// enabled.
|
||||
DOMString[]? enableRulesetIds;
|
||||
};
|
||||
|
||||
dictionary UpdateStaticRulesOptions {
|
||||
// The id corresponding to a static $(ref:Ruleset).
|
||||
DOMString rulesetId;
|
||||
// Set of ids corresponding to rules in the $(ref:Ruleset) to disable.
|
||||
long[]? disableRuleIds;
|
||||
// Set of ids corresponding to rules in the $(ref:Ruleset) to enable.
|
||||
long[]? enableRuleIds;
|
||||
};
|
||||
|
||||
dictionary GetDisabledRuleIdsOptions {
|
||||
// The id corresponding to a static $(ref:Ruleset).
|
||||
DOMString rulesetId;
|
||||
};
|
||||
|
||||
dictionary TabActionCountUpdate {
|
||||
// The tab for which to update the action count.
|
||||
long tabId;
|
||||
// The amount to increment the tab's action count by. Negative values will
|
||||
// decrement the count.
|
||||
long increment;
|
||||
};
|
||||
|
||||
dictionary ExtensionActionOptions {
|
||||
// Whether to automatically display the action count for a page as the
|
||||
// extension's badge text. This preference is persisted across sessions.
|
||||
boolean? displayActionCountAsBadgeText;
|
||||
// Details of how the tab's action count should be adjusted.
|
||||
TabActionCountUpdate? tabUpdate;
|
||||
};
|
||||
|
||||
callback EmptyCallback = void();
|
||||
callback GetAllowedPagesCallback = void(DOMString[] result);
|
||||
callback GetRulesCallback = void(Rule[] rules);
|
||||
callback GetMatchedRulesCallback = void(RulesMatchedDetails details);
|
||||
callback GetEnabledRulesetsCallback = void(DOMString[] rulesetIds);
|
||||
callback GetDisabledRuleIdsCallback = void(long[] disabledRuleIds);
|
||||
callback IsRegexSupportedCallback = void(IsRegexSupportedResult result);
|
||||
callback GetAvailableStaticRuleCountCallback = void(long count);
|
||||
callback TestMatchOutcomeCallback = void(TestMatchOutcomeResult result);
|
||||
|
||||
interface Functions {
|
||||
|
||||
// Modifies the current set of dynamic rules for the extension.
|
||||
// The rules with IDs listed in <code>options.removeRuleIds</code> are first
|
||||
// removed, and then the rules given in <code>options.addRules</code> are
|
||||
// added. Notes:
|
||||
// <ul>
|
||||
// <li>This update happens as a single atomic operation: either all
|
||||
// specified rules are added and removed, or an error is returned.</li>
|
||||
// <li>These rules are persisted across browser sessions and across
|
||||
// extension updates.</li>
|
||||
// <li>Static rules specified as part of the extension package can not be
|
||||
// removed using this function.</li>
|
||||
// <li>$(ref:MAX_NUMBER_OF_DYNAMIC_RULES) is the maximum number
|
||||
// of dynamic rules an extension can add. The number of
|
||||
// <a href="#safe_rules">unsafe rules</a> must not exceed
|
||||
// $(ref:MAX_NUMBER_OF_UNSAFE_DYNAMIC_RULES).</li>
|
||||
// </ul>
|
||||
// |callback|: Called once the update is complete or has failed. In case of
|
||||
// an error, $(ref:runtime.lastError) will be set and no change will be made
|
||||
// to the rule set. This can happen for multiple reasons, such as invalid
|
||||
// rule format, duplicate rule ID, rule count limit exceeded, internal
|
||||
// errors, and others.
|
||||
static void updateDynamicRules(
|
||||
UpdateRuleOptions options,
|
||||
optional EmptyCallback callback);
|
||||
|
||||
// Returns the current set of dynamic rules for the extension. Callers can
|
||||
// optionally filter the list of fetched rules by specifying a
|
||||
// <code>filter</code>.
|
||||
// |filter|: An object to filter the list of fetched rules.
|
||||
// |callback|: Called with the set of dynamic rules. An error might be
|
||||
// raised in case of transient internal errors.
|
||||
static void getDynamicRules(
|
||||
optional GetRulesFilter filter,
|
||||
GetRulesCallback callback);
|
||||
|
||||
// Modifies the current set of session scoped rules for the extension.
|
||||
// The rules with IDs listed in <code>options.removeRuleIds</code> are first
|
||||
// removed, and then the rules given in <code>options.addRules</code> are
|
||||
// added. Notes:
|
||||
// <ul>
|
||||
// <li>This update happens as a single atomic operation: either all
|
||||
// specified rules are added and removed, or an error is returned.</li>
|
||||
// <li>These rules are not persisted across sessions and are backed in
|
||||
// memory.</li>
|
||||
// <li>$(ref:MAX_NUMBER_OF_SESSION_RULES) is the maximum number
|
||||
// of session rules an extension can add.</li>
|
||||
// </ul>
|
||||
// |callback|: Called once the update is complete or has failed. In case of
|
||||
// an error, $(ref:runtime.lastError) will be set and no change will be made
|
||||
// to the rule set. This can happen for multiple reasons, such as invalid
|
||||
// rule format, duplicate rule ID, rule count limit exceeded, and others.
|
||||
static void updateSessionRules(
|
||||
UpdateRuleOptions options,
|
||||
optional EmptyCallback callback);
|
||||
|
||||
// Returns the current set of session scoped rules for the extension.
|
||||
// Callers can optionally filter the list of fetched rules by specifying a
|
||||
// <code>filter</code>.
|
||||
// |filter|: An object to filter the list of fetched rules.
|
||||
// |callback|: Called with the set of session scoped rules.
|
||||
static void getSessionRules(
|
||||
optional GetRulesFilter filter,
|
||||
GetRulesCallback callback);
|
||||
|
||||
// Updates the set of enabled static rulesets for the extension. The
|
||||
// rulesets with IDs listed in <code>options.disableRulesetIds</code> are
|
||||
// first removed, and then the rulesets listed in
|
||||
// <code>options.enableRulesetIds</code> are added.<br/>
|
||||
// Note that the set of enabled static rulesets is persisted across sessions
|
||||
// but not across extension updates, i.e. the <code>rule_resources</code>
|
||||
// manifest key will determine the set of enabled static rulesets on each
|
||||
// extension update.
|
||||
// |callback|: Called once the update is complete. In case of an error,
|
||||
// $(ref:runtime.lastError) will be set and no change will be made to set of
|
||||
// enabled rulesets. This can happen for multiple reasons, such as invalid
|
||||
// ruleset IDs, rule count limit exceeded, or internal errors.
|
||||
static void updateEnabledRulesets(
|
||||
UpdateRulesetOptions options,
|
||||
optional EmptyCallback callback);
|
||||
|
||||
// Returns the ids for the current set of enabled static rulesets.
|
||||
// |callback|: Called with a list of ids, where each id corresponds to an
|
||||
// enabled static $(ref:Ruleset).
|
||||
static void getEnabledRulesets(
|
||||
GetEnabledRulesetsCallback callback);
|
||||
|
||||
// Disables and enables individual static rules in a $(ref:Ruleset).
|
||||
// Changes to rules belonging to a disabled $(ref:Ruleset) will take
|
||||
// effect the next time that it becomes enabled.
|
||||
// |callback|: Called once the update is complete. In case of an error,
|
||||
// $(ref:runtime.lastError) will be set and no change will be made to the
|
||||
// enabled static rules.
|
||||
static void updateStaticRules(
|
||||
UpdateStaticRulesOptions options,
|
||||
optional EmptyCallback callback);
|
||||
|
||||
// Returns the list of static rules in the given $(ref:Ruleset) that are
|
||||
// currently disabled.
|
||||
// |options|: Specifies the ruleset to query.
|
||||
// |callback|: Called with a list of ids that correspond to the disabled
|
||||
// rules in that ruleset.
|
||||
static void getDisabledRuleIds(
|
||||
GetDisabledRuleIdsOptions options,
|
||||
GetDisabledRuleIdsCallback callback);
|
||||
|
||||
// Returns all rules matched for the extension. Callers can optionally
|
||||
// filter the list of matched rules by specifying a <code>filter</code>.
|
||||
// This method is only available to extensions with the
|
||||
// <code>"declarativeNetRequestFeedback"</code> permission or having the
|
||||
// <code>"activeTab"</code> permission granted for the <code>tabId</code>
|
||||
// specified in <code>filter</code>.
|
||||
// Note: Rules not associated with an active document that were matched more
|
||||
// than five minutes ago will not be returned.
|
||||
// |filter|: An object to filter the list of matched rules.
|
||||
// |callback|: Called once the list of matched rules has been fetched. In
|
||||
// case of an error, $(ref:runtime.lastError) will be set and no rules will
|
||||
// be returned. This can happen for multiple reasons, such as insufficient
|
||||
// permissions, or exceeding the quota.
|
||||
static void getMatchedRules(
|
||||
optional MatchedRulesFilter filter,
|
||||
GetMatchedRulesCallback callback);
|
||||
|
||||
// Configures if the action count for tabs should be displayed as the
|
||||
// extension action's badge text and provides a way for that action count to
|
||||
// be incremented.
|
||||
static void setExtensionActionOptions(
|
||||
ExtensionActionOptions options,
|
||||
optional EmptyCallback callback);
|
||||
|
||||
// Checks if the given regular expression will be supported as a
|
||||
// <code>regexFilter</code> rule condition.
|
||||
// |regexOptions|: The regular expression to check.
|
||||
// |callback|: Called with details consisting of whether the regular
|
||||
// expression is supported and the reason if not.
|
||||
static void isRegexSupported(
|
||||
RegexOptions regexOptions,
|
||||
IsRegexSupportedCallback callback);
|
||||
|
||||
// Returns the number of static rules an extension can enable before the
|
||||
// <a href="#global-static-rule-limit">global static rule limit</a> is
|
||||
// reached.
|
||||
static void getAvailableStaticRuleCount(
|
||||
GetAvailableStaticRuleCountCallback callback);
|
||||
|
||||
// Checks if any of the extension's declarativeNetRequest rules would match
|
||||
// a hypothetical request.
|
||||
// Note: Only available for unpacked extensions as this is only intended to
|
||||
// be used during extension development.
|
||||
// |requestDetails|: The request details to test.
|
||||
// |callback|: Called with the details of matched rules.
|
||||
static void testMatchOutcome(
|
||||
TestMatchRequestDetails request,
|
||||
TestMatchOutcomeCallback callback);
|
||||
};
|
||||
|
||||
interface Properties {
|
||||
// The minimum number of static rules guaranteed to an extension across its
|
||||
// enabled static rulesets. Any rules above this limit will count towards
|
||||
// the <a href="#global-static-rule-limit">global static rule limit</a>.
|
||||
[value=30000] static long GUARANTEED_MINIMUM_STATIC_RULES();
|
||||
|
||||
// The maximum number of combined dynamic and session scoped rules an
|
||||
// extension can add.
|
||||
[nodoc, value=5000, deprecated="There is no longer a combined limit. See $(ref:MAX_NUMBER_OF_DYNAMIC_RULES) and $(ref:MAX_NUMBER_OF_SESSION_RULES)."] static long MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES();
|
||||
|
||||
// The maximum number of dynamic rules that an extension can add.
|
||||
[value=30000] static long MAX_NUMBER_OF_DYNAMIC_RULES();
|
||||
|
||||
// The maximum number of "unsafe" dynamic rules that an extension can add.
|
||||
[value=5000] static long MAX_NUMBER_OF_UNSAFE_DYNAMIC_RULES();
|
||||
|
||||
// The maximum number of session scoped rules that an extension can add.
|
||||
[value=5000] static long MAX_NUMBER_OF_SESSION_RULES();
|
||||
|
||||
// The maximum number of "unsafe" session scoped rules that an extension can
|
||||
// add.
|
||||
[value=5000] static long MAX_NUMBER_OF_UNSAFE_SESSION_RULES();
|
||||
|
||||
// Time interval within which <code>MAX_GETMATCHEDRULES_CALLS_PER_INTERVAL
|
||||
// getMatchedRules</code> calls can be made, specified in minutes.
|
||||
// Additional calls will fail immediately and set $(ref:runtime.lastError).
|
||||
// Note: <code>getMatchedRules</code> calls associated with a user gesture
|
||||
// are exempt from the quota.
|
||||
[value=10] static long GETMATCHEDRULES_QUOTA_INTERVAL();
|
||||
|
||||
// The number of times <code>getMatchedRules</code> can be called within a
|
||||
// period of <code>GETMATCHEDRULES_QUOTA_INTERVAL</code>.
|
||||
[value=20] static long MAX_GETMATCHEDRULES_CALLS_PER_INTERVAL();
|
||||
|
||||
// The maximum number of regular expression rules that an extension can
|
||||
// add. This limit is evaluated separately for the set of dynamic rules and
|
||||
// those specified in the rule resources file.
|
||||
[value=1000] static long MAX_NUMBER_OF_REGEX_RULES();
|
||||
|
||||
// The maximum number of static <code>Rulesets</code> an extension can
|
||||
// specify as part of the <code>"rule_resources"</code> manifest key.
|
||||
[value=100] static long MAX_NUMBER_OF_STATIC_RULESETS();
|
||||
|
||||
// The maximum number of static <code>Rulesets</code> an extension can
|
||||
// enable at any one time.
|
||||
[value=50] static long MAX_NUMBER_OF_ENABLED_STATIC_RULESETS();
|
||||
|
||||
// Ruleset ID for the dynamic rules added by the extension.
|
||||
[value="_dynamic"] static DOMString DYNAMIC_RULESET_ID();
|
||||
|
||||
// Ruleset ID for the session-scoped rules added by the extension.
|
||||
[value="_session"] static DOMString SESSION_RULESET_ID();
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Fired when a rule is matched with a request. Only available for unpacked
|
||||
// extensions with the <code>"declarativeNetRequestFeedback"</code> permission
|
||||
// as this is intended to be used for debugging purposes only.
|
||||
// |info|: The rule that has been matched along with information about the
|
||||
// associated request.
|
||||
static void onRuleMatchedDebug(MatchedRuleInfoDebug info);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
// Copyright 2013 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.diagnostics</code> API to query various properties of
|
||||
// the environment that may be useful for diagnostics.
|
||||
namespace diagnostics {
|
||||
dictionary SendPacketOptions {
|
||||
// Target IP address.
|
||||
DOMString ip;
|
||||
// Packet time to live value. If omitted, the system default value will be
|
||||
// used.
|
||||
long? ttl;
|
||||
// Packet timeout in seconds. If omitted, the system default value will be
|
||||
// used.
|
||||
long? timeout;
|
||||
// Size of the payload. If omitted, the system default value will be used.
|
||||
long? size;
|
||||
};
|
||||
|
||||
dictionary SendPacketResult {
|
||||
// The IP of the host which we receives the ICMP reply from.
|
||||
// The IP may differs from our target IP if the packet's ttl is used up.
|
||||
DOMString ip;
|
||||
|
||||
// Latency in millisenconds.
|
||||
double latency;
|
||||
};
|
||||
|
||||
callback SendPacketCallback = void(SendPacketResult result);
|
||||
|
||||
interface Functions {
|
||||
// Send a packet of the given type with the given parameters.
|
||||
static void sendPacket(
|
||||
SendPacketOptions options,
|
||||
SendPacketCallback callback);
|
||||
};
|
||||
};
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// Copyright 2014 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.dns</code> API for dns resolution.
|
||||
namespace dns {
|
||||
|
||||
dictionary ResolveCallbackResolveInfo {
|
||||
// The result code. Zero indicates success.
|
||||
long resultCode;
|
||||
|
||||
// A string representing the IP address literal. Supplied only if resultCode
|
||||
// indicates success.
|
||||
DOMString? address;
|
||||
};
|
||||
|
||||
callback ResolveCallback = void (ResolveCallbackResolveInfo resolveInfo);
|
||||
|
||||
interface Functions {
|
||||
// Resolves the given hostname or IP address literal.
|
||||
// |hostname| : The hostname to resolve.
|
||||
// |callback| : Called when the resolution operation completes.
|
||||
static void resolve(
|
||||
DOMString hostname,
|
||||
ResolveCallback callback);
|
||||
};
|
||||
|
||||
};
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// Copyright 2014 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Internal API for the <extensiontoptions> tag
|
||||
namespace extensionOptionsInternal {
|
||||
dictionary SizeChangedOptions {
|
||||
long oldWidth;
|
||||
long oldHeight;
|
||||
long newWidth;
|
||||
long newHeight;
|
||||
};
|
||||
|
||||
dictionary PreferredSizeChangedOptions {
|
||||
double width;
|
||||
double height;
|
||||
};
|
||||
|
||||
interface Events {
|
||||
static void onClose();
|
||||
static void onLoad();
|
||||
static void onPreferredSizeChanged(PreferredSizeChangedOptions options);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,288 @@
|
||||
// Copyright 2013 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.feedbackPrivate</code> API to provide Chrome [OS]
|
||||
// feedback to the Google Feedback servers.
|
||||
namespace feedbackPrivate {
|
||||
|
||||
dictionary AttachedFile {
|
||||
DOMString name;
|
||||
[instanceOf=Blob] object? data;
|
||||
};
|
||||
|
||||
dictionary LogsMapEntry {
|
||||
DOMString key;
|
||||
DOMString value;
|
||||
};
|
||||
|
||||
// Supported feedback flows.
|
||||
enum FeedbackFlow {
|
||||
// Flow for regular user. This is the default.
|
||||
regular,
|
||||
|
||||
// Flow on the ChromeOS login screen. URL entry, file attaching and landing
|
||||
// page is disabled for this flow.
|
||||
login,
|
||||
|
||||
// Flow when the feedback is requested from the sad tab ("Aw, Snap!") page
|
||||
// when the renderer crashes.
|
||||
sadTabCrash,
|
||||
|
||||
// Flow for internal Google users.
|
||||
googleInternal,
|
||||
|
||||
// Flow for AI features.
|
||||
ai
|
||||
};
|
||||
|
||||
dictionary FeedbackInfo {
|
||||
// File to attach to the feedback report.
|
||||
AttachedFile? attachedFile;
|
||||
|
||||
// An optional tag to label what type this feedback is.
|
||||
DOMString? categoryTag;
|
||||
|
||||
// The feedback text describing the user issue.
|
||||
DOMString description;
|
||||
|
||||
// The placeholder text that will be shown in the description field when
|
||||
// it's empty.
|
||||
DOMString? descriptionPlaceholder;
|
||||
|
||||
// The e-mail of the user that initiated this feedback.
|
||||
DOMString? email;
|
||||
|
||||
// The URL of the page that this issue was being experienced on.
|
||||
DOMString? pageUrl;
|
||||
|
||||
// Optional product ID to override the Chrome [OS] product id that is
|
||||
// usually passed to the feedback server.
|
||||
long? productId;
|
||||
|
||||
// Screenshot to send with this feedback.
|
||||
[instanceOf=Blob] object? screenshot;
|
||||
|
||||
// Optional id for performance trace data that can be included in this
|
||||
// report.
|
||||
long? traceId;
|
||||
|
||||
// An array of key/value pairs providing system information for this
|
||||
// feedback report.
|
||||
LogsMapEntry[]? systemInformation;
|
||||
|
||||
// True if we have permission to add histograms to this feedback report.
|
||||
boolean? sendHistograms;
|
||||
|
||||
// Optional feedback UI flow. Default is the regular user flow.
|
||||
FeedbackFlow? flow;
|
||||
|
||||
// TODO(rkc): Remove these once we have bindings to send blobs to Chrome.
|
||||
// Used internally to store the blob uuid after parameter customization.
|
||||
DOMString? attachedFileBlobUuid;
|
||||
DOMString? screenshotBlobUuid;
|
||||
|
||||
// Whether to use the system-provided window frame or custom frame controls.
|
||||
boolean? useSystemWindowFrame;
|
||||
|
||||
// Whether or not to send bluetooth logs with this report.
|
||||
boolean? sendBluetoothLogs;
|
||||
|
||||
// Whether or not to send tab titles with this report.
|
||||
boolean? sendTabTitles;
|
||||
|
||||
// Whether or not to send Assistant feedback to Assistant server.
|
||||
boolean? assistantDebugInfoAllowed;
|
||||
|
||||
// Whether or not triggered from Assistant.
|
||||
boolean? fromAssistant;
|
||||
|
||||
// Whether or not to include bluetooth logs.
|
||||
boolean? includeBluetoothLogs;
|
||||
|
||||
// Whether to show questionnaire in the report description based on detected
|
||||
// domain-related keywords (crbug/1241169).
|
||||
boolean? showQuestionnaire;
|
||||
|
||||
// Whether or not triggered for Autofill.
|
||||
boolean? fromAutofill;
|
||||
|
||||
// A JSON formatted string containing autofill metadata for this
|
||||
// feedback report.
|
||||
DOMString? autofillMetadata;
|
||||
|
||||
// Whether or not |autofillMetadata| should be included in the feedback
|
||||
// report.
|
||||
boolean? sendAutofillMetadata;
|
||||
|
||||
// Whether or not the content is offensive or unsafe.
|
||||
boolean? isOffensiveOrUnsafe;
|
||||
|
||||
// A JSON formatted string containing ai metadata.
|
||||
DOMString? aiMetadata;
|
||||
};
|
||||
|
||||
// Possible statuses that can result from sending feedback.
|
||||
enum Status {success, delayed};
|
||||
|
||||
// Landing page types that can be shown after sending feedback.
|
||||
enum LandingPageType {normal, techstop, noLandingPage};
|
||||
|
||||
// Result returned from a $(ref:sendFeedback) call.
|
||||
dictionary SendFeedbackResult {
|
||||
// Status of the sending of a feedback report.
|
||||
Status status;
|
||||
|
||||
// The type of landing page shown to the use when the feedback report is
|
||||
// successfully sent, if one should be shown.
|
||||
LandingPageType landingPageType;
|
||||
};
|
||||
|
||||
// Allowed log sources on Chrome OS.
|
||||
enum LogSource {
|
||||
// Chrome OS system messages.
|
||||
messages,
|
||||
|
||||
// Latest Chrome OS UI logs.
|
||||
uiLatest,
|
||||
|
||||
// Info about display connectors and connected displays from DRM subsystem.
|
||||
drmModetest,
|
||||
|
||||
// USB device list and connectivity graph.
|
||||
lsusb,
|
||||
|
||||
// Logs from daemon for Atrus device.
|
||||
atrusLog,
|
||||
|
||||
// Network log.
|
||||
netLog,
|
||||
|
||||
// Log of system events.
|
||||
eventLog,
|
||||
|
||||
// Update engine log.
|
||||
updateEngineLog,
|
||||
|
||||
// Log of the current power manager session.
|
||||
powerdLatest,
|
||||
|
||||
// Log of the previous power manager session.
|
||||
powerdPrevious,
|
||||
|
||||
// Info about system PCI buses devices.
|
||||
lspci,
|
||||
|
||||
// Info about system network interface.
|
||||
ifconfig,
|
||||
|
||||
// Info about system uptime.
|
||||
uptime
|
||||
};
|
||||
|
||||
// Source of the feedback.
|
||||
enum FeedbackSource {quickoffice};
|
||||
|
||||
// Input parameters for a readLogSource() call.
|
||||
dictionary ReadLogSourceParams {
|
||||
// The log source from which to read.
|
||||
LogSource source;
|
||||
|
||||
// For file-based log sources, read from source without closing the file
|
||||
// handle. The next time $(ref:readLogSource) is called, the file read will
|
||||
// continue where it left off. $(ref:readLogSource) can be called with
|
||||
// <code>incremental=true</code> repeatedly. To subsequently close the file
|
||||
// handle, pass in <code>incremental=false</code>.
|
||||
boolean incremental;
|
||||
|
||||
// To read from an existing file handle, set this to a valid
|
||||
// <code>readerId</code> value that was returned from a previous
|
||||
// $(ref:readLogSource) call. The reader must previously have been created
|
||||
// for the same value of <code>source</code>. If no <code>readerId</code> is
|
||||
// provided, $(ref:readLogSource) will attempt to open a new log source
|
||||
// reader handle.
|
||||
long? readerId;
|
||||
};
|
||||
|
||||
// Result returned from a $(ref:readLogSource) call.
|
||||
dictionary ReadLogSourceResult {
|
||||
// The ID of the log source reader that was created to read from the log
|
||||
// source. If the reader was destroyed at the end of a read by passing in
|
||||
// <code>incremental=false</code>, this is always set to 0. If the call was
|
||||
// to use an existing reader with an existing ID, this will be set to the
|
||||
// same <code>readerId</code> that was passed into $(ref:readLogSource).
|
||||
long readerId;
|
||||
|
||||
// Each DOMString in this array represents one line of logging that was
|
||||
// fetched from the log source.
|
||||
DOMString[] logLines;
|
||||
};
|
||||
|
||||
callback GetUserEmailCallback = void(DOMString email);
|
||||
callback GetSystemInformationCallback =
|
||||
void(LogsMapEntry[] systemInformation);
|
||||
callback SendFeedbackCallback = void(SendFeedbackResult result);
|
||||
callback ReadLogSourceCallback = void (ReadLogSourceResult result);
|
||||
|
||||
interface Functions {
|
||||
// Returns the email of the currently active or logged in user.
|
||||
static void getUserEmail(GetUserEmailCallback callback);
|
||||
|
||||
// Returns the system information dictionary.
|
||||
static void getSystemInformation(GetSystemInformationCallback callback);
|
||||
|
||||
// Opens the feedback report window.
|
||||
static void openFeedback(FeedbackSource source);
|
||||
|
||||
// Sends a feedback report.
|
||||
// |loadSystemInfo|: Optional flag when present and is true, the backend
|
||||
// should load system information before sending the report. This is added
|
||||
// to reduce user's wait time when sending reports because loading system
|
||||
// information is slow.
|
||||
// |formOpenTime|: The epoch time when the feedback form was opened. This is
|
||||
// used for metrics.
|
||||
static void sendFeedback(
|
||||
FeedbackInfo feedback,
|
||||
optional boolean loadSystemInfo,
|
||||
optional double formOpenTime,
|
||||
SendFeedbackCallback callback);
|
||||
|
||||
// Reads from a log source indicated by <code>source</code>.
|
||||
// <p>If <code>incremental</code> is false:
|
||||
// <ul>
|
||||
// <li>Returns the entire contents of the log file.</li>
|
||||
// <li>Returns <code>readerId</code> value of 0 to callback.</li>
|
||||
// </ul>
|
||||
// If <code>incremental</code> is true, and no <code>readerId</code> is
|
||||
// provided:
|
||||
// <ul>
|
||||
// <li>Returns the entire contents of the log file.</li>
|
||||
// <li>Starts tracking the file read handle, which is returned as a
|
||||
// nonzero <code>readerId</code> value in the callback.
|
||||
// </li>
|
||||
// <li>If can't create a new file handle, returns <code>readerId</code>
|
||||
// value of 0 in the callback.
|
||||
// </li>
|
||||
// </ul>
|
||||
// If <code>incremental</code> is true, and a valid non-zero
|
||||
// <code>readerId</code> is provided:
|
||||
// <ul>
|
||||
// <li>Returns new lines written to the file since the last time this
|
||||
// function was called for the same file and <code>readerId</code>.
|
||||
// </li>
|
||||
// <li>Returns the same <code>readerId</code> value to the callback.</li>
|
||||
// </ul>
|
||||
static void readLogSource(
|
||||
ReadLogSourceParams params,
|
||||
ReadLogSourceCallback callback);
|
||||
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Fired when the a user requests the launch of the feedback UI. We're
|
||||
// using an event for this versus using the override API since we want
|
||||
// to be invoked, but not showing a UI, so the feedback extension can
|
||||
// take a screenshot of the user's desktop.
|
||||
static void onFeedbackRequested(FeedbackInfo feedback);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,55 @@
|
||||
// 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.
|
||||
|
||||
// `file_handlers` manifest key defintion. File Handlers allow developers to
|
||||
// let extensions interact with files on the operating system. This manifest key
|
||||
// can be used by developers to register an extension to a given file type.
|
||||
[generate_error_messages] namespace fileHandlers {
|
||||
|
||||
// Icon specification similar to an ImageResource.
|
||||
dictionary Icon {
|
||||
// TODO(crbug.com/40238266) Add `DOMString? label;` for accessibility.
|
||||
|
||||
// URL from which a user agent can fetch image data.
|
||||
DOMString src;
|
||||
|
||||
// Multiple space-separated size values to also accommodate image formats
|
||||
// that can act as containers for multiple images of varying dimensions:
|
||||
// e.g. "16x16", "16x16 32x32".
|
||||
DOMString? sizes;
|
||||
|
||||
// MIME type is purely advisory with no default value.
|
||||
DOMString? type;
|
||||
};
|
||||
|
||||
// A FileHandler registers the ability to read, stream, or edit files of given
|
||||
// MIME types and/or file extensions.
|
||||
dictionary FileHandler {
|
||||
// A mapping of one or more MIME types to one or more file extensions.
|
||||
// e.g. "accept": {"text/csv": ".csv"} or {"text/csv": [".csv", ".txt"]}.
|
||||
object accept;
|
||||
|
||||
// Specifies the url after the origin that is the navigation destination for
|
||||
// file handling launches.
|
||||
DOMString action;
|
||||
|
||||
// Description of the file type.
|
||||
DOMString name;
|
||||
|
||||
// Array of ImageResources. Only icons declared at the manifest level are
|
||||
// currently supported. The icon for the extension will appear in the "Open"
|
||||
// menu.
|
||||
Icon[]? icons;
|
||||
|
||||
// Whether multiple files should be opened in a single client or multiple.
|
||||
// Defaults to `single-client`, which makes all files available in only one
|
||||
// tab. `multiple-client` opens a new tab for each file.
|
||||
DOMString? launch_type;
|
||||
};
|
||||
|
||||
dictionary ManifestKeys {
|
||||
// File Handlers to register onto the target system.
|
||||
FileHandler[] file_handlers;
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,186 @@
|
||||
// Copyright 2012 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Use the <code>chrome.fileSystem</code> API to create, read, navigate,
|
||||
// and write to the user's local file system. With this API, Chrome Apps can
|
||||
// read and write to a user-selected location. For example, a text editor app
|
||||
// can use the API to read and write local documents. All failures are notified
|
||||
// via chrome.runtime.lastError.
|
||||
namespace fileSystem {
|
||||
dictionary AcceptOption {
|
||||
// This is the optional text description for this option. If not present,
|
||||
// a description will be automatically generated; typically containing an
|
||||
// expanded list of valid extensions (e.g. "text/html" may expand to
|
||||
// "*.html, *.htm").
|
||||
DOMString? description;
|
||||
|
||||
// Mime-types to accept, e.g. "image/jpeg" or "audio/*". One of mimeTypes or
|
||||
// extensions must contain at least one valid element.
|
||||
DOMString[]? mimeTypes;
|
||||
|
||||
// Extensions to accept, e.g. "jpg", "gif", "crx".
|
||||
DOMString[]? extensions;
|
||||
};
|
||||
|
||||
enum ChooseEntryType {
|
||||
|
||||
// Prompts the user to open an existing file and returns a FileEntry on
|
||||
// success. From Chrome 31 onwards, the FileEntry will be writable if the
|
||||
// application has the 'write' permission under 'fileSystem'; otherwise, the
|
||||
// FileEntry will be read-only.
|
||||
openFile,
|
||||
|
||||
// Prompts the user to open an existing file and returns a writable
|
||||
// FileEntry on success. Calls using this type will fail with a runtime
|
||||
// error if the application doesn't have the 'write' permission under
|
||||
// 'fileSystem'.
|
||||
openWritableFile,
|
||||
|
||||
// Prompts the user to open an existing file or a new file and returns a
|
||||
// writable FileEntry on success. Calls using this type will fail with a
|
||||
// runtime error if the application doesn't have the 'write' permission
|
||||
// under 'fileSystem'.
|
||||
saveFile,
|
||||
|
||||
// Prompts the user to open a directory and returns a DirectoryEntry on
|
||||
// success. Calls using this type will fail with a runtime error if the
|
||||
// application doesn't have the 'directory' permission under 'fileSystem'.
|
||||
// If the application has the 'write' permission under 'fileSystem', the
|
||||
// returned DirectoryEntry will be writable; otherwise it will be read-only.
|
||||
// New in Chrome 31.
|
||||
openDirectory
|
||||
};
|
||||
|
||||
dictionary ChooseEntryOptions {
|
||||
// Type of the prompt to show. The default is 'openFile'.
|
||||
ChooseEntryType? type;
|
||||
|
||||
// The suggested file name that will be presented to the user as the
|
||||
// default name to read or write. This is optional.
|
||||
DOMString? suggestedName;
|
||||
|
||||
// The optional list of accept options for this file opener. Each option
|
||||
// will be presented as a unique group to the end-user.
|
||||
AcceptOption[]? accepts;
|
||||
|
||||
// Whether to accept all file types, in addition to the options specified
|
||||
// in the accepts argument. The default is true. If the accepts field is
|
||||
// unset or contains no valid entries, this will always be reset to true.
|
||||
boolean? acceptsAllTypes;
|
||||
|
||||
// Whether to accept multiple files. This is only supported for openFile and
|
||||
// openWritableFile. The callback to chooseEntry will be called with a list
|
||||
// of entries if this is set to true. Otherwise it will be called with a
|
||||
// single Entry.
|
||||
boolean? acceptsMultiple;
|
||||
};
|
||||
|
||||
dictionary RequestFileSystemOptions {
|
||||
// The ID of the requested volume.
|
||||
DOMString volumeId;
|
||||
|
||||
// Whether the requested file system should be writable. The default is
|
||||
// read-only.
|
||||
boolean? writable;
|
||||
};
|
||||
|
||||
// Represents a mounted volume, which can be accessed via <code>chrome.
|
||||
// fileSystem.requestFileSystem</code>.
|
||||
dictionary Volume {
|
||||
DOMString volumeId;
|
||||
boolean writable;
|
||||
};
|
||||
|
||||
// Event notifying about an inserted or a removed volume from the system.
|
||||
dictionary VolumeListChangedEvent {
|
||||
Volume[] volumes;
|
||||
};
|
||||
|
||||
callback GetDisplayPathCallback = void (DOMString displayPath);
|
||||
callback EntryCallback = void ([instanceOf=Entry] object entry);
|
||||
callback EntriesCallback = void (
|
||||
[instanceOf=Entry] optional object entry,
|
||||
[instanceOf=FileEntry] optional object[] fileEntries);
|
||||
callback IsWritableCallback = void (boolean isWritable);
|
||||
callback IsRestorableCallback = void (boolean isRestorable);
|
||||
callback RequestFileSystemCallback = void(
|
||||
[instanceOf=FileSystem] optional object fileSystem);
|
||||
callback GetVolumeListCallback = void(optional Volume[] volumes);
|
||||
|
||||
interface Functions {
|
||||
// Get the display path of an Entry object. The display path is based on
|
||||
// the full path of the file or directory on the local file system, but may
|
||||
// be made more readable for display purposes.
|
||||
static void getDisplayPath(
|
||||
[instanceOf=Entry] object entry,
|
||||
GetDisplayPathCallback callback);
|
||||
|
||||
// Get a writable Entry from another Entry. This call will fail with a
|
||||
// runtime error if the application does not have the 'write' permission
|
||||
// under 'fileSystem'. If entry is a DirectoryEntry, this call will fail if
|
||||
// the application does not have the 'directory' permission under
|
||||
// 'fileSystem'.
|
||||
[doesNotSupportPromises="Custom hook sets lastError crbug.com/1504349"]
|
||||
static void getWritableEntry(
|
||||
[instanceOf=Entry] object entry,
|
||||
EntryCallback callback);
|
||||
|
||||
// Gets whether this Entry is writable or not.
|
||||
static void isWritableEntry(
|
||||
[instanceOf=Entry] object entry,
|
||||
IsWritableCallback callback);
|
||||
|
||||
// Ask the user to choose a file or directory.
|
||||
[doesNotSupportPromises="Multi-parameter callback crbug.com/1313625,
|
||||
Custom hook sets lastError crbug.com/1504349"]
|
||||
static void chooseEntry(optional ChooseEntryOptions options,
|
||||
EntriesCallback callback);
|
||||
|
||||
// Returns the file entry with the given id if it can be restored. This call
|
||||
// will fail with a runtime error otherwise.
|
||||
[doesNotSupportPromises="Custom hook sets lastError crbug.com/1504349"]
|
||||
static void restoreEntry(DOMString id,
|
||||
EntryCallback callback);
|
||||
|
||||
// Returns whether the app has permission to restore the entry with the
|
||||
// given id.
|
||||
static void isRestorable(
|
||||
DOMString id,
|
||||
IsRestorableCallback callback);
|
||||
|
||||
// Returns an id that can be passed to restoreEntry to regain access to a
|
||||
// given file entry. Only the 500 most recently used entries are retained,
|
||||
// where calls to retainEntry and restoreEntry count as use. If the app has
|
||||
// the 'retainEntries' permission under 'fileSystem', entries are retained
|
||||
// indefinitely. Otherwise, entries are retained only while the app is
|
||||
// running and across restarts.
|
||||
static DOMString retainEntry([instanceOf=Entry] object entry);
|
||||
|
||||
// Requests access to a file system for a volume represented by <code>
|
||||
// options.volumeId</code>. If <code>options.writable</code> is set to true,
|
||||
// then the file system will be writable. Otherwise, it will be read-only.
|
||||
// The <code>writable</code> option requires the <code>
|
||||
// "fileSystem": {"write"}</code> permission in the manifest. Available to
|
||||
// kiosk apps running in kiosk session only. For manual-launch kiosk mode, a
|
||||
// confirmation dialog will be shown on top of the active app window.
|
||||
// In case of an error, <code>fileSystem</code> will be undefined, and
|
||||
// <code>chrome.runtime.lastError</code> will be set.
|
||||
static void requestFileSystem(
|
||||
RequestFileSystemOptions options,
|
||||
RequestFileSystemCallback callback);
|
||||
|
||||
// Returns a list of volumes available for <code>requestFileSystem()</code>.
|
||||
// The <code>"fileSystem": {"requestFileSystem"}</code> manifest permission
|
||||
// is required. Available to kiosk apps running in the kiosk session only.
|
||||
// In case of an error, <code>volumes</code> will be undefined, and <code>
|
||||
// chrome.runtime.lastError</code> will be set.
|
||||
static void getVolumeList(
|
||||
GetVolumeListCallback callback);
|
||||
};
|
||||
|
||||
interface Events {
|
||||
// Called when a list of available volumes is changed.
|
||||
static void onVolumeListChanged(VolumeListChangedEvent event);
|
||||
};
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user