GUIYANG, China - China and the Association of Southeast Asian Nations have agreed on a framework of a legally binding code of conduct in the South China Sea following years of negotiations, a senior Chinese diplomat said Thursday.