Keep private profiles out of history
This commit is contained in:
@@ -60,6 +60,10 @@ pub(crate) fn new_profile_name(command: &str) -> Option<&str> {
|
||||
command_argument(command, &["new-profile ", "new profile "])
|
||||
}
|
||||
|
||||
pub(crate) fn new_private_profile_name(command: &str) -> Option<&str> {
|
||||
command_argument(command, &["new-private-profile ", "new private profile "])
|
||||
}
|
||||
|
||||
pub(crate) fn switch_profile_name(command: &str) -> Option<&str> {
|
||||
command_argument(command, &["switch-profile ", "switch profile "])
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@ use crate::{
|
||||
CoreError,
|
||||
navigation::{
|
||||
about_url, bookmarks_url, downloads_url, history_url, move_tab_space_name,
|
||||
new_profile_name, new_space_name, plugin_detail_url, plugins_url, reading_list_url,
|
||||
search_url, settings_page_url, settings_url, space_icon, switch_profile_name,
|
||||
sync_status_url, task_manager_url,
|
||||
new_private_profile_name, new_profile_name, new_space_name, plugin_detail_url, plugins_url,
|
||||
reading_list_url, search_url, settings_page_url, settings_url, space_icon,
|
||||
switch_profile_name, sync_status_url, task_manager_url,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -97,6 +97,10 @@ impl BrowserCore {
|
||||
self.create_profile(name.to_string(), 0xf54e00, ProfileKind::Standard)?;
|
||||
return Ok(true);
|
||||
}
|
||||
if let Some(name) = new_private_profile_name(command) {
|
||||
self.create_profile(name.to_string(), 0x807d72, ProfileKind::Private)?;
|
||||
return Ok(true);
|
||||
}
|
||||
if let Some(name) = move_tab_space_name(command) {
|
||||
let Some(space_id) = self.find_space_match(name) else {
|
||||
return Ok(false);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::time::SystemTime;
|
||||
|
||||
use ely_domain::{BrowserTab, HistoryEntry, UrlText};
|
||||
use ely_domain::{BrowserTab, HistoryEntry, ProfileId, ProfileKind, UrlText};
|
||||
|
||||
use crate::navigation::records_history;
|
||||
|
||||
@@ -8,7 +8,7 @@ use super::BrowserCore;
|
||||
|
||||
impl BrowserCore {
|
||||
pub(super) fn record_history_entry(&mut self, tab: &BrowserTab) {
|
||||
if !records_history(tab.url()) {
|
||||
if !records_history(tab.url()) || !self.profile_records_history(tab.profile_id()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -46,6 +46,13 @@ impl BrowserCore {
|
||||
.cloned()
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn profile_records_history(&self, profile_id: &ProfileId) -> bool {
|
||||
match self.profiles.iter().find(|profile| profile.id() == profile_id) {
|
||||
Some(profile) => profile.kind() == &ProfileKind::Standard,
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn history_entry_matches_query(entry: &HistoryEntry, normalized_query: &str) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user