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 #if defined(BROWSER_SYNC) | 5 #if defined(BROWSER_SYNC) |
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/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } | 138 } |
139 return; | 139 return; |
140 } | 140 } |
141 | 141 |
142 // Once sync has been enabled, the supported "sync statuses" for the NNTP | 142 // Once sync has been enabled, the supported "sync statuses" for the NNTP |
143 // from the user's perspective are: | 143 // from the user's perspective are: |
144 // | 144 // |
145 // "Sync error", when we can't authenticate or establish a connection with | 145 // "Sync error", when we can't authenticate or establish a connection with |
146 // the sync server (appropriate information appended to | 146 // the sync server (appropriate information appended to |
147 // message). | 147 // message). |
148 std::wstring status_msg; | 148 string16 status_msg; |
149 std::wstring link_text; | 149 string16 link_text; |
150 SyncStatusUIHelper::MessageType type = | 150 SyncStatusUIHelper::MessageType type = |
151 SyncStatusUIHelper::GetLabels(sync_service_, &status_msg, &link_text); | 151 SyncStatusUIHelper::GetLabels(sync_service_, &status_msg, &link_text); |
152 SendSyncMessageToPage(FromSyncStatusMessageType(type), | 152 SendSyncMessageToPage(FromSyncStatusMessageType(type), |
153 WideToUTF8(status_msg), WideToUTF8(link_text)); | 153 UTF16ToUTF8(status_msg), UTF16ToUTF8(link_text)); |
154 } | 154 } |
155 | 155 |
156 void NewTabPageSyncHandler::HandleSyncLinkClicked(const Value* value) { | 156 void NewTabPageSyncHandler::HandleSyncLinkClicked(const Value* value) { |
157 DCHECK(!waiting_for_initial_page_load_); | 157 DCHECK(!waiting_for_initial_page_load_); |
158 DCHECK(sync_service_); | 158 DCHECK(sync_service_); |
159 if (sync_service_->HasSyncSetupCompleted()) { | 159 if (sync_service_->HasSyncSetupCompleted()) { |
160 // User clicked the 'Login again' link to re-authenticate. | 160 // User clicked the 'Login again' link to re-authenticate. |
161 sync_service_->ShowLoginDialog(); | 161 sync_service_->ShowLoginDialog(); |
162 } else { | 162 } else { |
163 // User clicked the 'Start now' link to begin syncing. | 163 // User clicked the 'Start now' link to begin syncing. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 } else { | 222 } else { |
223 value.SetBoolean(L"linkurlisset", true); | 223 value.SetBoolean(L"linkurlisset", true); |
224 value.SetString(L"linkurl", linkurl); | 224 value.SetString(L"linkurl", linkurl); |
225 } | 225 } |
226 } | 226 } |
227 } | 227 } |
228 dom_ui_->CallJavascriptFunction(L"syncMessageChanged", value); | 228 dom_ui_->CallJavascriptFunction(L"syncMessageChanged", value); |
229 } | 229 } |
230 | 230 |
231 #endif // defined(BROWSER_SYNC) | 231 #endif // defined(BROWSER_SYNC) |
OLD | NEW |