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 (function() { | 5 (function() { |
6 | 6 |
7 <include src="../../../../ui/webui/resources/js/util.js"></include> | 7 <include src="../../../../ui/webui/resources/js/util.js"></include> |
8 <include src="viewport.js"></include> | 8 <include src="viewport.js"></include> |
9 | 9 |
10 // The plugin element is sized to fill the entire window and is set to be fixed | 10 // The plugin element is sized to fill the entire window and is set to be fixed |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
55 | 55 |
56 // Called when a message is received from the plugin. | 56 // Called when a message is received from the plugin. |
57 function handleMessage(message) { | 57 function handleMessage(message) { |
58 if (message.data.type == 'documentDimensions') { | 58 if (message.data.type == 'documentDimensions') { |
59 documentDimensions = message.data; | 59 documentDimensions = message.data; |
60 viewport.setDocumentDimensions(documentDimensions); | 60 viewport.setDocumentDimensions(documentDimensions); |
61 viewerToolbar.style.visibility = 'visible'; | 61 viewerToolbar.style.visibility = 'visible'; |
62 viewerPageIndicator.initialFadeIn(); | 62 viewerPageIndicator.initialFadeIn(); |
63 viewerToolbar.initialFadeIn(); | 63 viewerToolbar.initialFadeIn(); |
64 } else if (message.data.type == 'loadProgress') { | 64 } else if (message.data.type == 'loadProgress') { |
65 updateProgress(message.data['progress']); | 65 updateProgress(message.data.progress); |
66 } else if (message.data.type == 'goToPage') { | |
arv (Not doing code reviews)
2014/02/19 02:18:08
Maybe use a switch instead?
raymes
2014/02/19 03:24:35
Done.
| |
67 viewport.goToPage(message.data.page); | |
66 } | 68 } |
67 } | 69 } |
68 | 70 |
69 // Callback that's called when the viewport changes. | 71 // Callback that's called when the viewport changes. |
70 function viewportChangedCallback(zoom, | 72 function viewportChangedCallback(zoom, |
71 x, | 73 x, |
72 y, | 74 y, |
73 scrollbarWidth, | 75 scrollbarWidth, |
74 hasScrollbars, | 76 hasScrollbars, |
75 page) { | 77 page) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
189 e.preventDefault(); | 191 e.preventDefault(); |
190 } | 192 } |
191 return; | 193 return; |
192 } | 194 } |
193 }; | 195 }; |
194 } | 196 } |
195 | 197 |
196 load(); | 198 load(); |
197 | 199 |
198 })(); | 200 })(); |
OLD | NEW |