All the charging circuitry resides in the laptop itself, the AC adapter is just a power supply. The reason why there is all this complexity is the MagSafe connector that makes it physically trivial to short the power pins together, which given the power levels involved might very well be plausible fire hazard.