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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 137 |
138 // Once sync has been enabled, the supported "sync statuses" for the NNTP | 138 // Once sync has been enabled, the supported "sync statuses" for the NNTP |
139 // from the user's perspective are: | 139 // from the user's perspective are: |
140 // | 140 // |
141 // "Sync error", when we can't authenticate or establish a connection with | 141 // "Sync error", when we can't authenticate or establish a connection with |
142 // the sync server (appropriate information appended to | 142 // the sync server (appropriate information appended to |
143 // message). | 143 // message). |
144 string16 status_msg; | 144 string16 status_msg; |
145 string16 link_text; | 145 string16 link_text; |
146 sync_ui_util::MessageType type = | 146 sync_ui_util::MessageType type = |
147 sync_ui_util::GetStatusLabels(sync_service_, &status_msg, &link_text); | 147 sync_ui_util::GetStatusLabelsForNewTabPage(sync_service_, |
| 148 &status_msg, |
| 149 &link_text); |
148 SendSyncMessageToPage(FromSyncStatusMessageType(type), | 150 SendSyncMessageToPage(FromSyncStatusMessageType(type), |
149 UTF16ToUTF8(status_msg), UTF16ToUTF8(link_text)); | 151 UTF16ToUTF8(status_msg), UTF16ToUTF8(link_text)); |
150 } | 152 } |
151 | 153 |
152 void NewTabPageSyncHandler::HandleSyncLinkClicked(const ListValue* args) { | 154 void NewTabPageSyncHandler::HandleSyncLinkClicked(const ListValue* args) { |
153 DCHECK(!waiting_for_initial_page_load_); | 155 DCHECK(!waiting_for_initial_page_load_); |
154 DCHECK(sync_service_); | 156 DCHECK(sync_service_); |
155 if (!sync_service_->IsSyncEnabled()) | 157 if (!sync_service_->IsSyncEnabled()) |
156 return; | 158 return; |
157 if (sync_service_->HasSyncSetupCompleted()) { | 159 if (sync_service_->HasSyncSetupCompleted()) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 if (linkurl.empty()) { | 212 if (linkurl.empty()) { |
211 value.SetBoolean("linkurlisset", false); | 213 value.SetBoolean("linkurlisset", false); |
212 } else { | 214 } else { |
213 value.SetBoolean("linkurlisset", true); | 215 value.SetBoolean("linkurlisset", true); |
214 value.SetString("linkurl", linkurl); | 216 value.SetString("linkurl", linkurl); |
215 } | 217 } |
216 } | 218 } |
217 } | 219 } |
218 dom_ui_->CallJavascriptFunction(L"syncMessageChanged", value); | 220 dom_ui_->CallJavascriptFunction(L"syncMessageChanged", value); |
219 } | 221 } |
OLD | NEW |