[Cast MRP] Use app availability caching when adding sink query.

The availability caching will now be checked when a new sink query is
added. Before that, it is only checked during Refresh() (user gesture)
and when sink is added. This prevents a request from being re-sent if
a query was removed and re-added while the sink is still on the list.
In addition, the cache rule now applies when a sink is added or
updated. This means a request will be re-sent (subject to timing
threshold) if its cached availability is kUnavailable.

Note the rule to always use cache if the availability value is
kAvailable hasn't changed. An app is considered to be available until
it is offline, at which point the cache value will be invalidated.

Bug: 809249
Change-Id: Iadcee4953b51464211c3ee91777683a640f1291a
Reviewed-on: https://chromium-review.googlesource.com/1173477
Commit-Queue: Derek Cheng <imcheng@chromium.org>
Reviewed-by: Takumi Fujimoto <takumif@chromium.org>
Cr-Commit-Position: refs/heads/master@{#588947}
3 files changed