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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
584 if (typeof actionUrls != 'object') { | 584 if (typeof actionUrls != 'object') { |
585 return; | 585 return; |
586 } | 586 } |
587 | 587 |
588 var url = selector(actionUrls); | 588 var url = selector(actionUrls); |
589 | 589 |
590 if (typeof url != 'string') | 590 if (typeof url != 'string') |
591 return; | 591 return; |
592 | 592 |
593 instrumented.tabs.create({url: url}, function(tab) { | 593 instrumented.tabs.create({url: url}, function(tab) { |
594 if (!tab) | 594 if (tab) |
595 chrome.windows.update(tab.windowId, {focused: true}); | |
596 else | |
595 chrome.windows.create({url: url}); | 597 chrome.windows.create({url: url}); |
rgustafson
2013/08/14 01:02:03
My concern is whether the same will happen with th
vadimt
2013/08/14 01:35:03
Done.
| |
596 }); | 598 }); |
597 }); | 599 }); |
598 } | 600 } |
599 | 601 |
600 /** | 602 /** |
601 * Responds to a click of one of the buttons on the welcome toast. | 603 * Responds to a click of one of the buttons on the welcome toast. |
602 * @param {number} buttonIndex The index of the button which was clicked. | 604 * @param {number} buttonIndex The index of the button which was clicked. |
603 */ | 605 */ |
604 function onToastNotificationClicked(buttonIndex) { | 606 function onToastNotificationClicked(buttonIndex) { |
605 chrome.storage.local.set({userRespondedToToast: true}); | 607 chrome.storage.local.set({userRespondedToToast: true}); |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
925 | 927 |
926 instrumented.location.onLocationUpdate.addListener(function(position) { | 928 instrumented.location.onLocationUpdate.addListener(function(position) { |
927 recordEvent(GoogleNowEvent.LOCATION_UPDATE); | 929 recordEvent(GoogleNowEvent.LOCATION_UPDATE); |
928 updateNotificationsCards(position); | 930 updateNotificationsCards(position); |
929 }); | 931 }); |
930 | 932 |
931 instrumented.omnibox.onInputEntered.addListener(function(text) { | 933 instrumented.omnibox.onInputEntered.addListener(function(text) { |
932 localStorage['server_url'] = NOTIFICATION_CARDS_URL = text; | 934 localStorage['server_url'] = NOTIFICATION_CARDS_URL = text; |
933 initialize(); | 935 initialize(); |
934 }); | 936 }); |
OLD | NEW |