Skip to content

Commit

Permalink
Bug 1930984 - Implement default search engine selection on the search…
Browse files Browse the repository at this point in the history
… engine selector.
  • Loading branch information
Standard8 committed Dec 12, 2024
1 parent e6b997a commit 78e5e1c
Show file tree
Hide file tree
Showing 6 changed files with 845 additions and 22 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions components/search/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ firefox-versioning = { path = "../support/firefox-versioning" }

[build-dependencies]
uniffi = { version = "0.28.2", features = ["build"] }

[dev-dependencies]
once_cell = "1.18.0"
33 changes: 32 additions & 1 deletion components/search/src/configuration_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,43 @@ pub(crate) struct JSONEngineRecord {
pub variants: Vec<JSONEngineVariant>,
}

#[derive(Debug, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub(crate) struct JSONSpecificDefaultRecord {
/// The identifier of the engine that will be used as the application default
/// for the associated environment. If the entry is suffixed with a star,
/// matching is applied on a "starts with" basis.
#[serde(default)]
pub default: String,

/// The identifier of the engine that will be used as the application default
/// in private mode for the associated environment. If the entry is suffixed
/// with a star, matching is applied on a "starts with" basis.
#[serde(default)]
pub default_private: String,

/// The specific environment to match for this record.
pub environment: JSONVariantEnvironment,
}

/// Represents the default engines record.
#[derive(Debug, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub(crate) struct JSONDefaultEnginesRecord {
/// The identifier of the engine that will be used as the application default
/// if no other engines are specified as default.
pub global_default: String,
pub global_default_private: Option<String>,

/// The identifier of the engine that will be used as the application default
/// in private mode if no other engines are specified as default.
#[serde(default)]
pub global_default_private: String,

/// The specific environment filters to set a different default engine. The
/// array is ordered, when multiple entries match on environments, the later
/// entry will override earlier entries.
#[serde(default)]
pub specific_defaults: Vec<JSONSpecificDefaultRecord>,
}

/// Represents the engine orders record.
Expand Down
Loading

0 comments on commit 78e5e1c

Please sign in to comment.