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

Side by Side Diff: chrome/browser/resources/ntp4/apps_page.js

Issue 7739007: ntp4: app generation tweak (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix for overlapping extents Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/webui/ntp/app_launcher_handler.cc » ('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) 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 cr.define('ntp4', function() { 5 cr.define('ntp4', function() {
6 'use strict'; 6 'use strict';
7 7
8 var localStrings = new LocalStrings; 8 var localStrings = new LocalStrings;
9 9
10 var APP_LAUNCH = { 10 var APP_LAUNCH = {
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 // title of the new link. 616 // title of the new link.
617 var html = dataTransfer.getData('text/html'); 617 var html = dataTransfer.getData('text/html');
618 var title; 618 var title;
619 if (html) { 619 if (html) {
620 // It's important that we don't attach this node to the document 620 // It's important that we don't attach this node to the document
621 // because it might contain scripts. 621 // because it might contain scripts.
622 var node = this.ownerDocument.createElement('div'); 622 var node = this.ownerDocument.createElement('div');
623 node.innerHTML = html; 623 node.innerHTML = html;
624 title = node.textContent; 624 title = node.textContent;
625 } 625 }
626
627 // Make sure title is >=1 and <=45 characters for Chrome app limits.
626 if (!title) 628 if (!title)
627 title = url; 629 title = url;
630 if (title.length > 45)
631 title = title.substring(0, 45);
632 var data = {url: url, title: title};
628 633
629 // Synthesize an app. 634 // Synthesize an app.
630 var data = {url: url, title: title};
631 // Make sure title is >=1 and <=45 characters for Chrome app limits.
632 if (data.title.length > 45)
633 data.title = data.title.substring(0,45);
634 if (data.title.length == 0)
635 data.title = data.url;
636 this.generateAppForLink(data); 635 this.generateAppForLink(data);
637 }, 636 },
638 637
639 /** 638 /**
640 * Creates a new crx-less app manifest and installs it. 639 * Creates a new crx-less app manifest and installs it.
641 * @param {Object} data The data object describing the link. Must have |url| 640 * @param {Object} data The data object describing the link. Must have |url|
642 * and |title| members. 641 * and |title| members.
643 * TODO(estade): pass along an index. 642 * TODO(estade): pass along an index.
644 */ 643 */
645 generateAppForLink: function(data) { 644 generateAppForLink: function(data) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 appsPrefChangeCallback: appsPrefChangeCallback, 714 appsPrefChangeCallback: appsPrefChangeCallback,
716 launchAppAfterEnable: launchAppAfterEnable, 715 launchAppAfterEnable: launchAppAfterEnable,
717 }; 716 };
718 }); 717 });
719 718
720 // TODO(estade): update the content handlers to use ntp namespace instead of 719 // TODO(estade): update the content handlers to use ntp namespace instead of
721 // making these global. 720 // making these global.
722 var appNotificationChanged = ntp4.appNotificationChanged; 721 var appNotificationChanged = ntp4.appNotificationChanged;
723 var appsPrefChangeCallback = ntp4.appsPrefChangeCallback; 722 var appsPrefChangeCallback = ntp4.appsPrefChangeCallback;
724 var launchAppAfterEnable = ntp4.launchAppAfterEnable; 723 var launchAppAfterEnable = ntp4.launchAppAfterEnable;
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/ntp/app_launcher_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698