In some algae ( such as the heterokonts ) , chloroplasts seem to have evolved through a secondary event of endosymbiosis , in which a eukaryotic cell engulfed a second eukaryotic cell containing chloroplasts , forming chloroplasts with three or four membrane layers . In some algae ( such as the heterokonts and other protists such as Euglenozoa and Cercozoa ) , chloroplasts seem to have evolved through a secondary event of endosymbiosis , in which a eukaryotic cell engulfed a second eukaryotic cell containing chloroplasts , forming chloroplasts with three or four membrane layers .