| 1038 | } |
| 1039 | |
| 1040 | fn parse_application_list(args: &Dictionary) -> Vec<WebKitApplication> { |
| 1041 | let Some(apps) = args |
| 1042 | .get("WIRApplicationDictionaryKey") |
| 1043 | .and_then(Value::as_dictionary) |
| 1044 | else { |
| 1045 | return Vec::new(); |
| 1046 | }; |
| 1047 | |
| 1048 | apps.iter() |
| 1049 | .filter_map(|(app_id, value)| { |
| 1050 | let app = value.as_dictionary()?; |
| 1051 | Some(WebKitApplication { |
| 1052 | id: string_value(app, "WIRApplicationIdentifierKey") |
| 1053 | .unwrap_or_else(|| app_id.clone()), |
| 1054 | name: string_value(app, "WIRApplicationNameKey"), |
| 1055 | bundle_identifier: string_value(app, "WIRApplicationBundleIdentifierKey"), |
| 1056 | active: integer_value(app, "WIRIsApplicationActiveKey").unwrap_or(0) > 0, |
| 1057 | is_proxy: bool_value(app, "WIRIsApplicationProxyKey").unwrap_or(false), |
| 1058 | }) |
| 1059 | }) |
| 1060 | .collect() |
| 1061 | } |
| 1062 | |
| 1063 | fn parse_application(args: &Dictionary) -> Option<WebKitApplication> { |
| 1064 | let id = string_value(args, "WIRApplicationIdentifierKey")?; |