Sen.John McCain has been diagnosed with brain cancer, his office says.