pub struct ProfileManager { /* private fields */ }Expand description
Manages Chrome user-data directories used as named Glass profiles.
Chrome owns cookies, local storage, and all other persisted browser state.
Glass intentionally does not maintain a second JSON representation of that
state: the directory passed to --user-data-dir is the sole source of
truth.
Implementations§
Source§impl ProfileManager
impl ProfileManager
pub fn new() -> Self
pub fn validate_name(name: &str) -> Result<(), Box<dyn Error>>
Sourcepub fn profile_dir(&self, name: &str) -> PathBuf
pub fn profile_dir(&self, name: &str) -> PathBuf
Return the canonical Chrome user-data directory for a profile.
Sourcepub fn create_profile(&self, name: &str) -> Result<PathBuf, Box<dyn Error>>
pub fn create_profile(&self, name: &str) -> Result<PathBuf, Box<dyn Error>>
Create (or return) a named profile’s Chrome user-data directory.
Older Glass versions stored Chrome data in <name>_chrome alongside a
JSON metadata file. Move that existing browser data into the canonical
directory before use so Chrome remains the authority for persistence.
Sourcepub fn ensure_profile_dir(&self, name: &str) -> Result<PathBuf, Box<dyn Error>>
pub fn ensure_profile_dir(&self, name: &str) -> Result<PathBuf, Box<dyn Error>>
Ensure a named profile exists and return its Chrome user-data directory.
pub fn list_profiles(&self) -> Result<Vec<String>, Box<dyn Error>>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ProfileManager
impl RefUnwindSafe for ProfileManager
impl Send for ProfileManager
impl Sync for ProfileManager
impl Unpin for ProfileManager
impl UnsafeUnpin for ProfileManager
impl UnwindSafe for ProfileManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more