| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // File Description: | 5 // File Description: |
| 6 // Contains all the necessary functions for rendering the NTP on mobile | 6 // Contains all the necessary functions for rendering the NTP on mobile |
| 7 // devices. | 7 // devices. |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * The event type used to determine when a touch starts. | 10 * The event type used to determine when a touch starts. |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 * | 465 * |
| 466 * @param {Object} item The item specification. | 466 * @param {Object} item The item specification. |
| 467 * @param {function} evt The browser click event triggered. | 467 * @param {function} evt The browser click event triggered. |
| 468 */ | 468 */ |
| 469 function itemShortcutClickHandler(item, evt) { | 469 function itemShortcutClickHandler(item, evt) { |
| 470 // Handle the touch callback | 470 // Handle the touch callback |
| 471 if (item['folder']) { | 471 if (item['folder']) { |
| 472 browseToBookmarkFolder(item.id); | 472 browseToBookmarkFolder(item.id); |
| 473 } else { | 473 } else { |
| 474 if (bookmarkShortcutMode) { | 474 if (bookmarkShortcutMode) { |
| 475 chrome.send('shortcutToBookmark', [item.id]); | 475 chrome.send('createHomeScreenBookmarkShortcut', [item.id]); |
| 476 } else if (!!item.url) { | 476 } else if (!!item.url) { |
| 477 window.location = item.url; | 477 window.location = item.url; |
| 478 } | 478 } |
| 479 } | 479 } |
| 480 } | 480 } |
| 481 | 481 |
| 482 /** | 482 /** |
| 483 * Opens a recently closed tab. | 483 * Opens a recently closed tab. |
| 484 * | 484 * |
| 485 * @param {Object} item An object containing the necessary information to | 485 * @param {Object} item An object containing the necessary information to |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1100 chrome.send('deleteBookmark', [contextMenuItem.id]); | 1100 chrome.send('deleteBookmark', [contextMenuItem.id]); |
| 1101 break; | 1101 break; |
| 1102 | 1102 |
| 1103 case ContextMenuItemIds.MOST_VISITED_REMOVE: | 1103 case ContextMenuItemIds.MOST_VISITED_REMOVE: |
| 1104 if (contextMenuUrl != null) | 1104 if (contextMenuUrl != null) |
| 1105 chrome.send('blacklistURLFromMostVisited', [contextMenuUrl]); | 1105 chrome.send('blacklistURLFromMostVisited', [contextMenuUrl]); |
| 1106 break; | 1106 break; |
| 1107 | 1107 |
| 1108 case ContextMenuItemIds.BOOKMARK_SHORTCUT: | 1108 case ContextMenuItemIds.BOOKMARK_SHORTCUT: |
| 1109 if (contextMenuUrl != null) | 1109 if (contextMenuUrl != null) |
| 1110 chrome.send('shortcutToBookmark', [contextMenuItem.id]); | 1110 chrome.send('createHomeScreenBookmarkShortcut', [contextMenuItem.id]); |
| 1111 break; | 1111 break; |
| 1112 | 1112 |
| 1113 case ContextMenuItemIds.RECENTLY_CLOSED_REMOVE: | 1113 case ContextMenuItemIds.RECENTLY_CLOSED_REMOVE: |
| 1114 chrome.send('clearRecentlyClosed'); | 1114 chrome.send('clearRecentlyClosed'); |
| 1115 break; | 1115 break; |
| 1116 | 1116 |
| 1117 case ContextMenuItemIds.FOREIGN_SESSIONS_REMOVE: | 1117 case ContextMenuItemIds.FOREIGN_SESSIONS_REMOVE: |
| 1118 if (contextMenuItem != null) { | 1118 if (contextMenuItem != null) { |
| 1119 chrome.send( | 1119 chrome.send( |
| 1120 'deleteForeignSession', [contextMenuItem.sessionTag]); | 1120 'deleteForeignSession', [contextMenuItem.sessionTag]); |
| (...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2479 // NTP Entry point. | 2479 // NTP Entry point. |
| 2480 ///////////////////////////////////////////////////////////////////////////// | 2480 ///////////////////////////////////////////////////////////////////////////// |
| 2481 | 2481 |
| 2482 /* | 2482 /* |
| 2483 * Handles initializing the UI when the page has finished loading. | 2483 * Handles initializing the UI when the page has finished loading. |
| 2484 */ | 2484 */ |
| 2485 window.addEventListener('DOMContentLoaded', function(evt) { | 2485 window.addEventListener('DOMContentLoaded', function(evt) { |
| 2486 ntp.init(); | 2486 ntp.init(); |
| 2487 $('content-area').style.display = 'block'; | 2487 $('content-area').style.display = 'block'; |
| 2488 }); | 2488 }); |
| OLD | NEW |