Barcelona agrees deal to sign Vidal from Bayern