browser_info/
url_extraction.rs

1use crate::{BrowserInfoError, BrowserType};
2use active_win_pos_rs::ActiveWindow;
3
4/// Extract URL from the active browser window
5pub fn extract_url(
6    window: &ActiveWindow,
7    browser_type: &BrowserType,
8) -> Result<String, BrowserInfoError> {
9    #[cfg(target_os = "windows")]
10    {
11        crate::platform::windows::extract_url(window, browser_type)
12    }
13
14    #[cfg(target_os = "macos")]
15    {
16        crate::platform::macos::extract_url(window, browser_type)
17    }
18
19    #[cfg(target_os = "linux")]
20    {
21        let _ = (window, browser_type); // Suppress unused variable warnings
22        // TODO: Implement Linux URL extraction
23        Err(BrowserInfoError::PlatformError(
24            "Linux not yet implemented".to_string(),
25        ))
26    }
27
28    #[cfg(not(any(target_os = "windows", target_os = "macos", target_os = "linux")))]
29    {
30        let _ = (window, browser_type); // Suppress unused variable warnings
31        Err(BrowserInfoError::PlatformError(
32            "Unsupported platform".to_string(),
33        ))
34    }
35}