It didn't seem to me like a full-on attack from the shark. My take was that it was just popping up for a quick bite to check things out. That, of course, would have ruined the swimmer's whole vacation.
I have to assume that what the dolphin did does constitute some kind of defensive behavior. While the swimmer was clueless, the dolphin certainly wasn't. Once the shark turned away, there was really no reason for the dolphin to pursue, so it's logical that it would veer off. I'm sure it didn't want to tangle with the shark, mission accomplished, so why bother?
As to warning the swimmer, what could they possibly do: reach down and thump it on the nose? (see other thread) Of course I would have grabbed it by the face, swung it around over my head, and tossed it back out to sea. But that's just me, Mr. Seahunt.
Seriously, had the swimmer started thrashing around, flailing and crying and screaming and kicking &c. I'm sure someone probably would have been bitten. In that case, I wouldn't be suprised to see the dolphin take a chomp. As stated, tough moral decision, but <Italian accent> whatcha gonna do?
A few years back there was footage of a killer whale and her pup taken off of the Fairillon (sp?) Islands, west of San Francisco. A nice sized great white rolled in to attack the pup, and momma whale showed it what for. Lovely footage. If anyone knows where to find that online, please post a link (maybe I'll look now).