| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 /** | 5 /** |
| 6 * @fileoverview This file provides a class that can be used to open URLs based | 6 * @fileoverview This file provides a class that can be used to open URLs based |
| 7 * on user interactions. It ensures a consistent behavior when it comes to | 7 * on user interactions. It ensures a consistent behavior when it comes to |
| 8 * holding down Ctrl and Shift while clicking or activating the a link. | 8 * holding down Ctrl and Shift while clicking or activating the a link. |
| 9 * | 9 * |
| 10 * This depends on the {@code chrome.windows} and {@code chrome.tabs} | 10 * This depends on the {@code chrome.windows} and {@code chrome.tabs} |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 * Opens a URL in a new tab, window or incognito window. | 101 * Opens a URL in a new tab, window or incognito window. |
| 102 * @param {string} url The URL to open. | 102 * @param {string} url The URL to open. |
| 103 * @param {cr.LinkKind} kind The kind of open we want to do. | 103 * @param {cr.LinkKind} kind The kind of open we want to do. |
| 104 */ | 104 */ |
| 105 openUrl: function(url, kind) { | 105 openUrl: function(url, kind) { |
| 106 this.openUrls([url], kind); | 106 this.openUrls([url], kind); |
| 107 }, | 107 }, |
| 108 | 108 |
| 109 /** | 109 /** |
| 110 * Opens URLs in new tab, window or incognito mode. | 110 * Opens URLs in new tab, window or incognito mode. |
| 111 * @param {!Array.<string>} urls The URLs to open. | 111 * @param {!Array<string>} urls The URLs to open. |
| 112 * @param {cr.LinkKind} kind The kind of open we want to do. | 112 * @param {cr.LinkKind} kind The kind of open we want to do. |
| 113 */ | 113 */ |
| 114 openUrls: function(urls, kind) { | 114 openUrls: function(urls, kind) { |
| 115 if (urls.length < 1) | 115 if (urls.length < 1) |
| 116 return; | 116 return; |
| 117 | 117 |
| 118 if (urls.length > this.warningLimit) { | 118 if (urls.length > this.warningLimit) { |
| 119 if (!this.window.confirm(this.getWarningMessage(urls.length))) | 119 if (!this.window.confirm(this.getWarningMessage(urls.length))) |
| 120 return; | 120 return; |
| 121 } | 121 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 145 this.window.location.href = urls[0]; | 145 this.window.location.href = urls[0]; |
| 146 } | 146 } |
| 147 } | 147 } |
| 148 }; | 148 }; |
| 149 | 149 |
| 150 // Export | 150 // Export |
| 151 return { | 151 return { |
| 152 LinkController: LinkController, | 152 LinkController: LinkController, |
| 153 }; | 153 }; |
| 154 }); | 154 }); |
| OLD | NEW |