Is it possible to get a shiny legendary? If so, when is it decided?
Yes, it is possible to get a shiny legendary.
For an interactive legendary, the overworld sprite will not reflect the shiny status. It is generated when you initiate the battle, which is why some people save in front of the legendary, battle it, and reset until it's shiny (a process called soft resetting or SRing).
For a roaming Pokemon, the conditions occasionally vary. Typically it's set when you first encounter it and it's registered in your Pokedex.
After 5th generation, most of the main, story line Legendaries in the the games (like for instance Groundon, Kyogre, Raquazza and Deoxys in ORAS) are shiny locked, meaning they cannot be shinies, or rather they have a 0% chance of being a shiny.
However most other legendaries that you find in various locations after you have completed the main storyline can be caught as shinies. The overworld sprite does not reflect shiny status on these pokemon, and the chance of a shiny is generated every time you encounter them, which is why soft-resetting works.
As for generation changes, the only think that has changed is the chance of a shiny being generated, which halved in 6th generation. Since you can't breed legendaries, the breeding method doesn’t count, and for the same reason neither does wild encounter or chaining.