Extract and share the common code for the 2 cookie controls.