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/new_tab_page_sync_handler.h" | 5 #include "chrome/browser/dom_ui/new_tab_page_sync_handler.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 return; | 161 return; |
162 } | 162 } |
163 DictionaryValue value; | 163 DictionaryValue value; |
164 value.SetString("syncEnabledMessage", | 164 value.SetString("syncEnabledMessage", |
165 l10n_util::GetStringFUTF16(IDS_SYNC_NTP_SYNCED_TO, | 165 l10n_util::GetStringFUTF16(IDS_SYNC_NTP_SYNCED_TO, |
166 sync_service_->GetAuthenticatedUsername())); | 166 sync_service_->GetAuthenticatedUsername())); |
167 dom_ui_->CallJavascriptFunction(L"syncAlreadyEnabled", value); | 167 dom_ui_->CallJavascriptFunction(L"syncAlreadyEnabled", value); |
168 } else { | 168 } else { |
169 // User clicked the 'Start now' link to begin syncing. | 169 // User clicked the 'Start now' link to begin syncing. |
170 ProfileSyncService::SyncEvent(ProfileSyncService::START_FROM_NTP); | 170 ProfileSyncService::SyncEvent(ProfileSyncService::START_FROM_NTP); |
171 sync_service_->EnableForUser(NULL); | 171 sync_service_->ShowLoginDialog(NULL); |
172 } | 172 } |
173 } | 173 } |
174 | 174 |
175 void NewTabPageSyncHandler::OnStateChanged() { | 175 void NewTabPageSyncHandler::OnStateChanged() { |
176 // Don't do anything if the page has not yet loaded. | 176 // Don't do anything if the page has not yet loaded. |
177 if (waiting_for_initial_page_load_) | 177 if (waiting_for_initial_page_load_) |
178 return; | 178 return; |
179 BuildAndSendSyncStatus(); | 179 BuildAndSendSyncStatus(); |
180 } | 180 } |
181 | 181 |
(...skipping 28 matching lines...) Expand all Loading... |
210 if (linkurl.empty()) { | 210 if (linkurl.empty()) { |
211 value.SetBoolean("linkurlisset", false); | 211 value.SetBoolean("linkurlisset", false); |
212 } else { | 212 } else { |
213 value.SetBoolean("linkurlisset", true); | 213 value.SetBoolean("linkurlisset", true); |
214 value.SetString("linkurl", linkurl); | 214 value.SetString("linkurl", linkurl); |
215 } | 215 } |
216 } | 216 } |
217 } | 217 } |
218 dom_ui_->CallJavascriptFunction(L"syncMessageChanged", value); | 218 dom_ui_->CallJavascriptFunction(L"syncMessageChanged", value); |
219 } | 219 } |
OLD | NEW |