Push API: Don't require notification if tab is visible.
commit266a9e0aa173d6bffbc6484d09c6407c096e6ac3
authorjohnme <johnme@chromium.org>
Wed, 4 Feb 2015 18:17:23 +0000 (4 10:17 -0800)
committerCommit bot <commit-bot@chromium.org>
Wed, 4 Feb 2015 18:18:52 +0000 (4 18:18 +0000)
tree9e0856f58659abddf9098d6ff094af1ed744c7da
parenta016a7e9fd9e6c45f32da553b2dc7fe8bd44f33b
Push API: Don't require notification if tab is visible.

For developers who have opted in to showing a user-visible UI change on every push (in exchange for showing the user a less scary permission prompt), we currently[1] enforce that each push shows a notification.

This patch relaxes the requirement slightly, so that sites don't need to show user-visible UI if a same-origin-ish[2] tab is currently visible, i.e. is the active tab of a non-minimized window. That's because updating the UI of such a tab instead of showing a notification is a valid way to show user-visible UI.

See also:
- https://crbug.com/437277
- http://lists.w3.org/Archives/Public/public-webapps/2014OctDec/0214.html
- https://github.com/w3c/push-api/pull/87

[1]: (since https://codereview.chromium.org/842233003)

[2]: (see comment in push_messaging_service_impl.cc)

BUG=437277

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

Cr-Commit-Position: refs/heads/master@{#314586}
chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabList.java
chrome/browser/services/gcm/push_messaging_browsertest.cc
chrome/browser/services/gcm/push_messaging_service_impl.cc
chrome/browser/ui/android/tab_model/tab_model.cc
chrome/browser/ui/android/tab_model/tab_model.h