Sanitize access to services in HistoryCounter.

HistoryService:
  - Request it with EXPLICIT_ACCESS. This is valid, because the counters only count data and do not modify them (and they're also only used in the chrome://settings/ menu which cannot be opened in the incognito mode).
  - Otherwise, the counter would (crash and) fail to count history if prefs::kSavingBrowserHistoryDisabled == true, but deletion would still work, since BrowsingDataRemover also asks for EXPLICIT_ACCESS.

ProfileSyncService:
  - Do not DCHECK if it does not exist, since it is not essential for the counter to run. If the Sync service is not present, we do not get any callbacks from it, and the counter behaves the same way as if history sync was simply disabled.
  - Otherwise, this will crash if Sync service does not exist, which is a valid circumstance (e.g. when switches::kDisableSync flag is present).

BUG=510028,553640

Review URL: https://codereview.chromium.org/1413373012

Cr-Commit-Position: refs/heads/master@{#358819}
1 file changed