| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifdef CHROME_PERSONALIZATION | 5 #ifdef CHROME_PERSONALIZATION |
| 6 | 6 |
| 7 #include "chrome/browser/dom_ui/new_tab_page_sync_handler.h" | 7 #include "chrome/browser/dom_ui/new_tab_page_sync_handler.h" |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "base/json_writer.h" | 10 #include "base/json_writer.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 SyncStatusUIHelper::GetLabels(sync_service_, &status_msg, &link_text); | 150 SyncStatusUIHelper::GetLabels(sync_service_, &status_msg, &link_text); |
| 151 SendSyncMessageToPage(FromSyncStatusMessageType(type), | 151 SendSyncMessageToPage(FromSyncStatusMessageType(type), |
| 152 WideToUTF8(status_msg), WideToUTF8(link_text)); | 152 WideToUTF8(status_msg), WideToUTF8(link_text)); |
| 153 } | 153 } |
| 154 | 154 |
| 155 void NewTabPageSyncHandler::HandleSyncLinkClicked(const Value* value) { | 155 void NewTabPageSyncHandler::HandleSyncLinkClicked(const Value* value) { |
| 156 DCHECK(!waiting_for_initial_page_load_); | 156 DCHECK(!waiting_for_initial_page_load_); |
| 157 DCHECK(sync_service_); | 157 DCHECK(sync_service_); |
| 158 if (sync_service_->HasSyncSetupCompleted()) { | 158 if (sync_service_->HasSyncSetupCompleted()) { |
| 159 // User clicked the 'Login again' link to re-authenticate. | 159 // User clicked the 'Login again' link to re-authenticate. |
| 160 sync_service_->ShowLoginDialog(); | 160 sync_service_->ShowLoginDialog(NULL); |
| 161 } else { | 161 } else { |
| 162 // User clicked the 'Start now' link to begin syncing. | 162 // User clicked the 'Start now' link to begin syncing. |
| 163 ProfileSyncService::SyncEvent(ProfileSyncService::START_FROM_NTP); | 163 ProfileSyncService::SyncEvent(ProfileSyncService::START_FROM_NTP); |
| 164 sync_service_->EnableForUser(); | 164 sync_service_->EnableForUser(NULL); |
| 165 } | 165 } |
| 166 } | 166 } |
| 167 | 167 |
| 168 void NewTabPageSyncHandler::OnStateChanged() { | 168 void NewTabPageSyncHandler::OnStateChanged() { |
| 169 // Don't do anything if the page has not yet loaded. | 169 // Don't do anything if the page has not yet loaded. |
| 170 if (waiting_for_initial_page_load_) | 170 if (waiting_for_initial_page_load_) |
| 171 return; | 171 return; |
| 172 BuildAndSendSyncStatus(); | 172 BuildAndSendSyncStatus(); |
| 173 } | 173 } |
| 174 | 174 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 } else { | 221 } else { |
| 222 value.SetBoolean(L"linkurlisset", true); | 222 value.SetBoolean(L"linkurlisset", true); |
| 223 value.SetString(L"linkurl", linkurl); | 223 value.SetString(L"linkurl", linkurl); |
| 224 } | 224 } |
| 225 } | 225 } |
| 226 } | 226 } |
| 227 dom_ui_->CallJavascriptFunction(L"syncMessageChanged", value); | 227 dom_ui_->CallJavascriptFunction(L"syncMessageChanged", value); |
| 228 } | 228 } |
| 229 | 229 |
| 230 #endif // CHROME_PERSONALIZATION | 230 #endif // CHROME_PERSONALIZATION |
| OLD | NEW |