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

Side by Side Diff: chrome/browser/resources/google_now/background.js

Issue 23128005: Bring windows with new tabs to foreground (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing unit tests. Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/resources/google_now/background_unittest.gtestjs » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/google_now/background_unittest.gtestjs » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698