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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** | 7 /** |
8 * @return {number} Width of a scrollbar in pixels | 8 * @return {number} Width of a scrollbar in pixels |
9 */ | 9 */ |
10 function getScrollbarWidth() { | 10 function getScrollbarWidth() { |
(...skipping 26 matching lines...) Expand all Loading... | |
37 return filename; | 37 return filename; |
38 throw e; | 38 throw e; |
39 } | 39 } |
40 } | 40 } |
41 | 41 |
42 /** | 42 /** |
43 * Called when navigation happens in the current tab. | 43 * Called when navigation happens in the current tab. |
44 * @param {string} url The url to be opened in the current tab. | 44 * @param {string} url The url to be opened in the current tab. |
45 */ | 45 */ |
46 function onNavigateInCurrentTab(url) { | 46 function onNavigateInCurrentTab(url) { |
47 // Prefer the tabs API because it can navigate from one file:// URL to | 47 // chrome.tabs.update should not be used here, since it blocks the ability |
48 // another. | 48 // of an app embedding a PDF viewer inside a webview to perform in-place |
49 if (chrome.tabs) | 49 // navigations (e.g. to the current tab). In these cases chrome.tabs.update |
Sam McNally
2015/09/18 01:03:47
Could we change this to
if (chrome.tabs && this.
wjmaclean
2015/09/18 16:20:45
Yes, but in this context |this| is a "Navigator" a
| |
50 chrome.tabs.update({url: url}); | 50 // just refers the navigation to the current browser, causing the navigation |
51 else | 51 // to occur in a new tab in the browser window, which is unexpected. |
52 window.location.href = url; | 52 window.location.href = url; |
53 } | 53 } |
54 | 54 |
55 /** | 55 /** |
56 * Called when navigation happens in the new tab. | 56 * Called when navigation happens in the new tab. |
57 * @param {string} url The url to be opened in the new tab. | 57 * @param {string} url The url to be opened in the new tab. |
58 */ | 58 */ |
59 function onNavigateInNewTab(url) { | 59 function onNavigateInNewTab(url) { |
60 // Prefer the tabs API because it guarantees we can just open a new tab. | 60 // Prefer the tabs API because it guarantees we can just open a new tab. |
61 // window.open doesn't have this guarantee. | 61 // window.open doesn't have this guarantee. |
62 if (chrome.tabs) | 62 if (chrome.tabs) |
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
872 * Each bookmark is an Object containing a: | 872 * Each bookmark is an Object containing a: |
873 * - title | 873 * - title |
874 * - page (optional) | 874 * - page (optional) |
875 * - array of children (themselves bookmarks) | 875 * - array of children (themselves bookmarks) |
876 * @type {Array} the top-level bookmarks of the PDF. | 876 * @type {Array} the top-level bookmarks of the PDF. |
877 */ | 877 */ |
878 get bookmarks() { | 878 get bookmarks() { |
879 return this.bookmarks_; | 879 return this.bookmarks_; |
880 } | 880 } |
881 }; | 881 }; |
OLD | NEW |