I can only speak about St Tropez as this is where I am.
There are many restaurants in town, and the best ones are not necessarily located on the harbor.
One of the best (and not the cheapest!) is Château de la Messardière "Les 3 saisons" (the Chef has one star at the Michelin).....
Also: Hotel Byblos, Sube, Café de Paris, Salama, Le Sporting, La Tour Joseph, Le Quai, Papagayo...
In Pampelonne Beach (lunch): Les Jumeaux, Tiki Beach, Club 55, Niki Beach.......
Hope this helps.....