Moving code injection logic into code injection window controller