| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 // This file provides common methods that can be shared by other JavaScripts. | 5 // This file provides common methods that can be shared by other JavaScripts. |
| 6 | 6 |
| 7 goog.provide('__crWeb.common'); | 7 goog.provide('__crWeb.common'); |
| 8 | 8 |
| 9 goog.require('__crWeb.base'); | 9 goog.require('__crWeb.base'); |
| 10 | 10 |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 rel: links[i].rel.toLowerCase(), | 627 rel: links[i].rel.toLowerCase(), |
| 628 href: links[i].href | 628 href: links[i].href |
| 629 }; | 629 }; |
| 630 favicons.push(favicon); | 630 favicons.push(favicon); |
| 631 if (rel == 'icon' || rel == 'shortcut icon') { | 631 if (rel == 'icon' || rel == 'shortcut icon') { |
| 632 hasFavicon = true; | 632 hasFavicon = true; |
| 633 } | 633 } |
| 634 } | 634 } |
| 635 } | 635 } |
| 636 } | 636 } |
| 637 if (!hasFavicon) { | |
| 638 // If an HTTP(S)? webpage does not reference a "favicon" then search | |
| 639 // for a file named "favicon.ico" at the root of the website (legacy). | |
| 640 // http://en.wikipedia.org/wiki/Favicon | |
| 641 var location = document.location; | |
| 642 if (location.protocol == 'http:' || location.protocol == 'https:') { | |
| 643 var favicon = { | |
| 644 rel: 'icon', | |
| 645 href: location.origin + '/favicon.ico' | |
| 646 }; | |
| 647 favicons.push(favicon); | |
| 648 } | |
| 649 } | |
| 650 return favicons; | 637 return favicons; |
| 651 }; | 638 }; |
| 652 | 639 |
| 653 /** | 640 /** |
| 654 * Checks whether an <object> node is plugin content (as <object> can also be | 641 * Checks whether an <object> node is plugin content (as <object> can also be |
| 655 * used to embed images). | 642 * used to embed images). |
| 656 * @param {HTMLElement} node The <object> node to check. | 643 * @param {HTMLElement} node The <object> node to check. |
| 657 * @return {boolean} Whether the node appears to be a plugin. | 644 * @return {boolean} Whether the node appears to be a plugin. |
| 658 * @private | 645 * @private |
| 659 */ | 646 */ |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 if (plugins.length > 0) { | 697 if (plugins.length > 0) { |
| 711 // Store the list of plugins in a known place for the replacement script | 698 // Store the list of plugins in a known place for the replacement script |
| 712 // to use, then trigger it. | 699 // to use, then trigger it. |
| 713 __gCrWeb['placeholderTargetPlugins'] = plugins; | 700 __gCrWeb['placeholderTargetPlugins'] = plugins; |
| 714 return true; | 701 return true; |
| 715 } | 702 } |
| 716 return false; | 703 return false; |
| 717 }; | 704 }; |
| 718 | 705 |
| 719 }()); // End of anonymous object | 706 }()); // End of anonymous object |
| OLD | NEW |