He figured it out
He knows that Layla is taking the code out in pieces and that somehow she must be getting it past physical security. The logical way of doing that is by using a flashdrive.
Since the flashdrive contains metal it must be in something that does not pass through the metal detectors.
Since all hand luggage is inspected...and the only other thing that doesn't go through is her insulated travel coffee mug...it must be in there.
There's a realisation effect montage thingy at 1:54:10 - 25 in the movie where you can see him figuring it out at the same time Layla is transferring the (final) code to the flash drive.