Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8225)

Unified Diff: chrome/common/extensions/docs/examples/extensions/gmail/background.js

Issue 10984030: Fix Gmail Checker to update on reference fragment navigations, so the unread (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fix.onUpdated Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/common/extensions/docs/examples/extensions/gmail/manifest.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/docs/examples/extensions/gmail/background.js
diff --git a/chrome/common/extensions/docs/examples/extensions/gmail/background.js b/chrome/common/extensions/docs/examples/extensions/gmail/background.js
index 8f26bfed9faab3bc64530d430f7eb307f087408e..8673e5213224c0c7f7c54e493316edec8dde8412 100644
--- a/chrome/common/extensions/docs/examples/extensions/gmail/background.js
+++ b/chrome/common/extensions/docs/examples/extensions/gmail/background.js
@@ -324,13 +324,23 @@ var filters = {
url: [{urlContains: getGmailUrl().replace(/^https?\:\/\//, '')}]
};
-chrome.webNavigation.onDOMContentLoaded.addListener(function(changeInfo) {
- if (changeInfo.url && isGmailUrl(changeInfo.url)) {
- console.log('Recognized Gmail navigation to: ' + changeInfo.url + '.' +
+function onNavigate(details) {
+ if (details.url && isGmailUrl(details.url)) {
+ console.log('Recognized Gmail navigation to: ' + details.url + '.' +
'Refreshing count...');
startRequest({scheduleRequest:false, showLoadingAnimation:false});
}
-}, filters);
+}
+if (chrome.webNavigation && chrome.webNavigation.onDOMContentLoaded &&
+ chrome.webNavigation.onReferenceFragmentUpdated) {
+ chrome.webNavigation.onDOMContentLoaded.addListener(onNavigate, filters);
+ chrome.webNavigation.onReferenceFragmentUpdated.addListener(
+ onNavigate, filters);
+} else {
+ chrome.tabs.onUpdated.addListener(function(_, details) {
+ onNavigate(details);
+ });
+}
chrome.browserAction.onClicked.addListener(goToInbox);
« no previous file with comments | « no previous file | chrome/common/extensions/docs/examples/extensions/gmail/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698