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 cr.define('options', function() { | 5 cr.define('options', function() { |
6 var FocusManager = cr.ui.FocusManager; | 6 var FocusManager = cr.ui.FocusManager; |
7 var PageManager = cr.ui.pageManager.PageManager; | 7 var PageManager = cr.ui.pageManager.PageManager; |
8 | 8 |
9 function OptionsFocusManager() { | 9 function OptionsFocusManager() {} |
10 } | |
11 | 10 |
12 cr.addSingletonGetter(OptionsFocusManager); | 11 cr.addSingletonGetter(OptionsFocusManager); |
13 | 12 |
14 OptionsFocusManager.prototype = { | 13 OptionsFocusManager.prototype = { |
15 __proto__: FocusManager.prototype, | 14 __proto__: FocusManager.prototype, |
16 | 15 |
17 /** @override */ | 16 /** @override */ |
18 getFocusParent: function() { | 17 getFocusParent: function() { |
19 var topPage = PageManager.getTopmostVisiblePage().pageDiv; | 18 var topPage = PageManager.getTopmostVisiblePage().pageDiv; |
20 | 19 |
21 // The default page and search page include a search field that is a | 20 // The default page and search page include a search field that is a |
22 // sibling of the rest of the page instead of a child. Thus, use the | 21 // sibling of the rest of the page instead of a child. Thus, use the |
23 // parent node to allow the search field to receive focus. | 22 // parent node to allow the search field to receive focus. |
24 if (topPage.parentNode.id == 'page-container') | 23 if (topPage.parentNode.id == 'page-container') |
25 return topPage.parentNode; | 24 return topPage.parentNode; |
26 | 25 |
27 return topPage; | 26 return topPage; |
28 }, | 27 }, |
29 }; | 28 }; |
30 | 29 |
31 return { | 30 return { |
32 OptionsFocusManager: OptionsFocusManager, | 31 OptionsFocusManager: OptionsFocusManager, |
33 }; | 32 }; |
34 }); | 33 }); |
OLD | NEW |