The masks are connected to a chemical oxygen generator by a lanyard. Pulling the mask pulls the lanyard, which pulls a pin from the generator and starts the reaction. They typically last betweeen about 10 and 20 minutes, more than enough time to get down to 10,000 feet where additional oxygen is not required.
There is no need for a % of flight time since the crew will descend to a safe altitude then divert to the nearest suitable field. Therefore, the only requirement is to last during the (emergency) descent.
You cannot "repressurise" since the cabin altitude will be the same as the external altitude. The only thing to do is to increase the partial pressure of oxygen by descending.
It's worth mentioning that the flight crew each have their own, isolated supply from a bottle which lasts significantly longer. This is so that they can continue to fly if there are fumes in the cockpit. Cabin crew often have their own, smaller, portable bottles so that they can freely move about the cabin to assist the "self loading freight".
Many's a morning when I would arrive to work feeling, ahem, a little "under the weather" and nip into the cockpit for a couple of minutes on 100% oxygen. Works wonders - and don't worry, they are topped up to full as part of the pre-flight service.