| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * @fileoverview The event page for Google Now for Chrome implementation. | 8 * @fileoverview The event page for Google Now for Chrome implementation. |
| 9 * The Google Now event page gets Google Now cards from the server and shows | 9 * The Google Now event page gets Google Now cards from the server and shows |
| 10 * them as Chrome notifications. | 10 * them as Chrome notifications. |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 if (typeof actionUrls != 'object') { | 597 if (typeof actionUrls != 'object') { |
| 598 return; | 598 return; |
| 599 } | 599 } |
| 600 | 600 |
| 601 var url = selector(actionUrls); | 601 var url = selector(actionUrls); |
| 602 | 602 |
| 603 if (typeof url != 'string') | 603 if (typeof url != 'string') |
| 604 return; | 604 return; |
| 605 | 605 |
| 606 instrumented.tabs.create({url: url}, function(tab) { | 606 instrumented.tabs.create({url: url}, function(tab) { |
| 607 if (!tab) | 607 if (tab) |
| 608 chrome.windows.create({url: url}); | 608 chrome.windows.update(tab.windowId, {focused: true}); |
| 609 else |
| 610 chrome.windows.create({url: url, focused: true}); |
| 609 }); | 611 }); |
| 610 }); | 612 }); |
| 611 } | 613 } |
| 612 | 614 |
| 613 /** | 615 /** |
| 614 * Responds to a click of one of the buttons on the welcome toast. | 616 * Responds to a click of one of the buttons on the welcome toast. |
| 615 * @param {number} buttonIndex The index of the button which was clicked. | 617 * @param {number} buttonIndex The index of the button which was clicked. |
| 616 */ | 618 */ |
| 617 function onToastNotificationClicked(buttonIndex) { | 619 function onToastNotificationClicked(buttonIndex) { |
| 618 chrome.storage.local.set({userRespondedToToast: true}); | 620 chrome.storage.local.set({userRespondedToToast: true}); |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 985 | 987 |
| 986 instrumented.location.onLocationUpdate.addListener(function(position) { | 988 instrumented.location.onLocationUpdate.addListener(function(position) { |
| 987 recordEvent(GoogleNowEvent.LOCATION_UPDATE); | 989 recordEvent(GoogleNowEvent.LOCATION_UPDATE); |
| 988 updateNotificationsCards(position); | 990 updateNotificationsCards(position); |
| 989 }); | 991 }); |
| 990 | 992 |
| 991 instrumented.omnibox.onInputEntered.addListener(function(text) { | 993 instrumented.omnibox.onInputEntered.addListener(function(text) { |
| 992 localStorage['server_url'] = NOTIFICATION_CARDS_URL = text; | 994 localStorage['server_url'] = NOTIFICATION_CARDS_URL = text; |
| 993 initialize(); | 995 initialize(); |
| 994 }); | 996 }); |
| OLD | NEW |