OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // PersonalOptions class | 6 // PersonalOptions class |
7 // Encapsulated handling of personal options page. | 7 // Encapsulated handling of personal options page. |
8 // | 8 // |
9 function PersonalOptions() { | 9 function PersonalOptions() { |
10 OptionsPage.call(this, 'personal', templateData.personalPage, 'personalPage'); | 10 OptionsPage.call(this, 'personal', templateData.personalPage, 'personalPage'); |
11 } | 11 } |
12 | 12 |
13 cr.addSingletonGetter(PersonalOptions); | 13 cr.addSingletonGetter(PersonalOptions); |
14 | 14 |
15 PersonalOptions.prototype = { | 15 PersonalOptions.prototype = { |
16 // Inherit PersonalOptions from OptionsPage. | 16 // Inherit PersonalOptions from OptionsPage. |
17 __proto__: OptionsPage.prototype, | 17 __proto__: OptionsPage.prototype, |
18 | 18 |
19 // Initialize PersonalOptions page. | 19 // Initialize PersonalOptions page. |
20 initializePage: function() { | 20 initializePage: function() { |
21 // Call base class implementation to starts preference initialization. | 21 // Call base class implementation to starts preference initialization. |
22 OptionsPage.prototype.initializePage.call(this); | 22 OptionsPage.prototype.initializePage.call(this); |
23 | 23 |
24 | |
25 // Listen to pref changes. | 24 // Listen to pref changes. |
26 Preferences.getInstance().addEventListener('sync.has_setup_completed', | 25 Preferences.getInstance().addEventListener('sync.has_setup_completed', |
27 function(event) { | 26 function(event) { |
28 if(event.value) { | 27 if(event.value) { |
| 28 chrome.send('getSyncStatus'); |
29 $('text-when-synced').style.display = 'block'; | 29 $('text-when-synced').style.display = 'block'; |
30 $('button-when-synced').style.display = 'block'; | 30 $('button-when-synced').style.display = 'block'; |
| 31 $('stop-sync').onclick = function(event) { |
| 32 OptionsPage.showOverlay('stopSyncingOverlay'); |
| 33 }; |
| 34 |
| 35 $('sync-customize').onclick = function(event) { |
| 36 OptionsPage.showPageByName('sync'); |
| 37 }; |
| 38 |
| 39 $('text-when-not-synced').style.display = 'none'; |
| 40 $('button-when-not-synced').style.display = 'none'; |
31 } | 41 } |
32 else { | 42 else { |
33 $('text-when-not-synced').style.display = 'block'; | 43 $('text-when-not-synced').style.display = 'block'; |
34 $('button-when-not-synced').style.display = 'block'; | 44 $('button-when-not-synced').style.display = 'block'; |
| 45 $('start-sync').onclick = function(event) { |
| 46 //TODO(sargrass): Show start-sync subpage, after dhg done. |
| 47 }; |
| 48 |
| 49 $('text-when-synced').style.display = 'none'; |
| 50 $('button-when-synced').style.display = 'none'; |
35 } | 51 } |
36 }); | 52 }); |
37 | 53 |
38 $('sync-customize').onclick = function(event) { | |
39 OptionsPage.showPageByName('sync'); | |
40 }; | |
41 | 54 |
42 $('showpasswords').onclick = function(event) { | 55 $('showpasswords').onclick = function(event) { |
43 //TODO(sargrass): Show passwords dialog here. | 56 //TODO(sargrass): Show passwords dialog here. |
44 }; | 57 }; |
45 | 58 |
46 $('autofill_options').onclick = function(event) { | 59 $('autofill_options').onclick = function(event) { |
47 //TODO(sargrass): Show autofill dialog here. | 60 //TODO(sargrass): Show autofill dialog here. |
48 }; | 61 }; |
49 | 62 |
50 $('import_data').onclick = function(event) { | 63 $('import_data').onclick = function(event) { |
51 //TODO(sargrass): Show import_data dialog here. | 64 OptionsPage.showOverlay('importDataOverlay'); |
52 }; | 65 }; |
53 | 66 |
54 if(!cr.isChromeOS && navigator.platform.match(/linux|BSD/i)) { | 67 if(!cr.isChromeOS && navigator.platform.match(/linux|BSD/i)) { |
55 $('themes_GTK_button').onclick = function(event) { | 68 $('themes_GTK_button').onclick = function(event) { |
56 //TODO(sargrass): Show themes GTK dialog here. | 69 //TODO(sargrass): Show themes GTK dialog here. |
57 }; | 70 }; |
58 | 71 |
59 $('themes_set_classic').onclick = function(event) { | 72 $('themes_set_classic').onclick = function(event) { |
60 //TODO(sargrass): Show themes set classic dialog here. | 73 //TODO(sargrass): Show themes set classic dialog here. |
61 }; | 74 }; |
62 } | 75 } |
63 | 76 |
64 if(cr.isMac || cr.isWindows || cr.isChromeOS) { | 77 if(cr.isMac || cr.isWindows || cr.isChromeOS) { |
65 $('themes_reset').onclick = function(event) { | 78 $('themes_reset').onclick = function(event) { |
66 //TODO(sargrass): Show themes reset dialog here. | 79 //TODO(sargrass): Show themes reset dialog here. |
67 }; | 80 }; |
68 } | 81 } |
| 82 }, |
69 | 83 |
| 84 syncStatusCallback_: function(statusString) { |
| 85 $('synced_to_user_with_time').textContent = statusString; |
70 }, | 86 }, |
71 }; | 87 }; |
| 88 |
| 89 PersonalOptions.syncStatusCallback = function(statusString){ |
| 90 PersonalOptions.getInstance().syncStatusCallback_(statusString); |
| 91 }; |
OLD | NEW |