Skip to content

Commit eb79785

Browse files
committed
Bug 1930984 - Implement default search engine selection on the search engine selector.
1 parent e6b997a commit eb79785

File tree

6 files changed

+846
-23
lines changed

6 files changed

+846
-23
lines changed

Diff for: Cargo.lock

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: components/search/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ firefox-versioning = { path = "../support/firefox-versioning" }
1717

1818
[build-dependencies]
1919
uniffi = { version = "0.28.2", features = ["build"] }
20+
21+
[dev-dependencies]
22+
once_cell = "1.18.0"

Diff for: components/search/src/configuration_types.rs

+32-1
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,43 @@ pub(crate) struct JSONEngineRecord {
182182
pub variants: Vec<JSONEngineVariant>,
183183
}
184184

185+
#[derive(Debug, Deserialize, Clone)]
186+
#[serde(rename_all = "camelCase")]
187+
pub(crate) struct JSONSpecificDefaultRecord {
188+
/// The identifier of the engine that will be used as the application default
189+
/// for the associated environment. If the entry is suffixed with a star,
190+
/// matching is applied on a "starts with" basis.
191+
#[serde(default)]
192+
pub default: String,
193+
194+
/// The identifier of the engine that will be used as the application default
195+
/// in private mode for the associated environment. If the entry is suffixed
196+
/// with a star, matching is applied on a "starts with" basis.
197+
#[serde(default)]
198+
pub default_private: String,
199+
200+
/// The specific environment to match for this record.
201+
pub environment: JSONVariantEnvironment,
202+
}
203+
185204
/// Represents the default engines record.
186205
#[derive(Debug, Deserialize, Clone)]
187206
#[serde(rename_all = "camelCase")]
188207
pub(crate) struct JSONDefaultEnginesRecord {
208+
/// The identifier of the engine that will be used as the application default
209+
/// if no other engines are specified as default.
189210
pub global_default: String,
190-
pub global_default_private: Option<String>,
211+
212+
/// The identifier of the engine that will be used as the application default
213+
/// in private mode if no other engines are specified as default.
214+
#[serde(default)]
215+
pub global_default_private: String,
216+
217+
/// The specific environment filters to set a different default engine. The
218+
/// array is ordered, when multiple entries match on environments, the later
219+
/// entry will override earlier entries.
220+
#[serde(default)]
221+
pub specific_defaults: Vec<JSONSpecificDefaultRecord>,
191222
}
192223

193224
/// Represents the engine orders record.

0 commit comments

Comments
 (0)