Add private window entry point
This commit is contained in:
@@ -77,6 +77,18 @@ pub struct ElyShell {
|
||||
|
||||
impl ElyShell {
|
||||
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
|
||||
Self::new_with_config(InitialBrowserConfig::ely_defaults(), window, cx)
|
||||
}
|
||||
|
||||
pub fn new_private(window: &mut Window, cx: &mut Context<Self>) -> Self {
|
||||
Self::new_with_config(InitialBrowserConfig::private_window(), window, cx)
|
||||
}
|
||||
|
||||
fn new_with_config(
|
||||
config: Result<InitialBrowserConfig, ely_domain::DomainError>,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) -> Self {
|
||||
let command_input =
|
||||
cx.new(|cx| InputState::new(window, cx).placeholder("Search or enter address"));
|
||||
|
||||
@@ -112,7 +124,7 @@ impl ElyShell {
|
||||
},
|
||||
);
|
||||
|
||||
let state = match InitialBrowserConfig::ely_defaults().and_then(|config| {
|
||||
let state = match config.and_then(|config| {
|
||||
BrowserCore::new(config).map_err(|error| match error {
|
||||
ely_browser_core::CoreError::Domain(source) => source,
|
||||
_ => ely_domain::DomainError::InvalidCommand,
|
||||
|
||||
@@ -74,7 +74,10 @@ mod tests {
|
||||
let mut core = BrowserCore::new(InitialBrowserConfig {
|
||||
space_name: "Work".to_string(),
|
||||
space_icon: "W".to_string(),
|
||||
space_color_hex: 0xf54e00,
|
||||
profile_name: "Default".to_string(),
|
||||
profile_color_hex: 0x26251e,
|
||||
profile_kind: ely_domain::ProfileKind::Standard,
|
||||
new_tab_destination: Default::default(),
|
||||
})?;
|
||||
core.open_tab(UrlText::parse(url)?);
|
||||
|
||||
Reference in New Issue
Block a user