Notify GCMAppHandlers when the store is reset, so they clear cached IDs

The GCM Store can be reset due to corruption or GCM rejecting the
checkin (with a HTTP_UNAUTHORIZED or HTTP_BAD_REQUEST response status).

When this happens, the device ID changes and so all registrations are
invalidated, hence app handlers should clear any registration IDs they
store (locally and ideally remotely too). This patch does that for
locally cached registration IDs; it does not yet attempt to clear
remotely cached registration IDs.

It does so by adding an OnStoreReset method to the GCMAppHandler
interface, which suffers the known race condition that app handlers
that are not yet registered will not find out about the store being
reset (e.g. during startup); the comment on OnStoreReset warns about
this.

BUG=661660
TBR=rdevlin.cronin@chromium.org (based on jianli's review)

Review-Url: https://codereview.chromium.org/2473813002
Cr-Commit-Position: refs/heads/master@{#432865}
30 files changed