Allow tilegrid creation from projection or extent

The XYZ tiling convention assumes the origin is the top-left and z: 0 is a single tile covering some maximum extent.

The current `ol.tilegrid.XYZ` assumes the maximum extent is the EPSG:3857 extent.  This should be configurable - and I think it is more general to provide an extent rather than a projection.

The current `ol.tilegrid.XYZ` assumes the tile size is `ol.DEFAULT_TILE_SIZE`.  This should be configurable.

The `ol.source.XYZ` accepts a `projection` option, but generated tile grid cannot be configured with this projection's extent.
`ol.source.BingMaps` being EPSG:3857 only, using `this.getProjection().getExtent()` would be sufficient here, no? Unless you also want to deal with the case where EPSG:3857 was defined using proj4js and that no validity extent for it.