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 #include "chrome/browser/dom_ui/options/sync_options_handler.h" | 5 #include "chrome/browser/dom_ui/options/sync_options_handler.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 localized_strings->SetString("syncpasswords", | 45 localized_strings->SetString("syncpasswords", |
46 l10n_util::GetStringUTF16(IDS_SYNC_DATATYPE_PASSWORDS)); | 46 l10n_util::GetStringUTF16(IDS_SYNC_DATATYPE_PASSWORDS)); |
47 localized_strings->SetString("syncextensions", | 47 localized_strings->SetString("syncextensions", |
48 l10n_util::GetStringUTF16(IDS_SYNC_DATATYPE_EXTENSIONS)); | 48 l10n_util::GetStringUTF16(IDS_SYNC_DATATYPE_EXTENSIONS)); |
49 localized_strings->SetString("syncautofill", | 49 localized_strings->SetString("syncautofill", |
50 l10n_util::GetStringUTF16(IDS_SYNC_DATATYPE_AUTOFILL)); | 50 l10n_util::GetStringUTF16(IDS_SYNC_DATATYPE_AUTOFILL)); |
51 localized_strings->SetString("syncthemes", | 51 localized_strings->SetString("syncthemes", |
52 l10n_util::GetStringUTF16(IDS_SYNC_DATATYPE_THEMES)); | 52 l10n_util::GetStringUTF16(IDS_SYNC_DATATYPE_THEMES)); |
53 localized_strings->SetString("syncapps", | 53 localized_strings->SetString("syncapps", |
54 l10n_util::GetStringUTF16(IDS_SYNC_DATATYPE_APPS)); | 54 l10n_util::GetStringUTF16(IDS_SYNC_DATATYPE_APPS)); |
| 55 localized_strings->SetString("syncsessions", |
| 56 l10n_util::GetStringUTF16(IDS_SYNC_DATATYPE_SESSIONS)); |
55 } | 57 } |
56 | 58 |
57 void SyncOptionsHandler::Initialize() { | 59 void SyncOptionsHandler::Initialize() { |
58 ProfileSyncService* service = | 60 ProfileSyncService* service = |
59 dom_ui_->GetProfile()->GetOriginalProfile()->GetProfileSyncService(); | 61 dom_ui_->GetProfile()->GetOriginalProfile()->GetProfileSyncService(); |
60 // If service is unavailable for some good reason, 'IsEnabled()' method | 62 // If service is unavailable for some good reason, 'IsEnabled()' method |
61 // should return false. Otherwise something is broken. | 63 // should return false. Otherwise something is broken. |
62 DCHECK(service); | 64 DCHECK(service); |
63 | 65 |
64 DictionaryValue args; | 66 DictionaryValue args; |
65 SyncSetupFlow::GetArgsForConfigure(service, &args); | 67 SyncSetupFlow::GetArgsForConfigure(service, &args); |
66 | 68 |
67 dom_ui_->CallJavascriptFunction(L"SyncOptions.setRegisteredDataTypes", args); | 69 dom_ui_->CallJavascriptFunction(L"SyncOptions.setRegisteredDataTypes", args); |
68 } | 70 } |
69 | 71 |
70 void SyncOptionsHandler::RegisterMessages() { | 72 void SyncOptionsHandler::RegisterMessages() { |
71 dom_ui_->RegisterMessageCallback("updatePreferredDataTypes", | 73 dom_ui_->RegisterMessageCallback("updatePreferredDataTypes", |
72 NewCallback(this, &SyncOptionsHandler::OnPreferredDataTypesUpdated)); | 74 NewCallback(this, &SyncOptionsHandler::OnPreferredDataTypesUpdated)); |
73 } | 75 } |
74 | 76 |
75 void SyncOptionsHandler::OnPreferredDataTypesUpdated(const ListValue* args) { | 77 void SyncOptionsHandler::OnPreferredDataTypesUpdated(const ListValue* args) { |
76 NotificationService::current()->Notify( | 78 NotificationService::current()->Notify( |
77 NotificationType::SYNC_DATA_TYPES_UPDATED, | 79 NotificationType::SYNC_DATA_TYPES_UPDATED, |
78 Source<Profile>(dom_ui_->GetProfile()), | 80 Source<Profile>(dom_ui_->GetProfile()), |
79 NotificationService::NoDetails()); | 81 NotificationService::NoDetails()); |
80 } | 82 } |
OLD | NEW |