Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Side by Side Diff: chrome/browser/dom_ui/new_tab_page_sync_handler.cc

Issue 6293010: Change all the places where the multi-purpose sync error link is surfaced to ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 SendSyncMessageToPage(FromSyncStatusMessageType(type), 148 SendSyncMessageToPage(FromSyncStatusMessageType(type),
149 UTF16ToUTF8(status_msg), UTF16ToUTF8(link_text)); 149 UTF16ToUTF8(status_msg), UTF16ToUTF8(link_text));
150 } 150 }
151 151
152 void NewTabPageSyncHandler::HandleSyncLinkClicked(const ListValue* args) { 152 void NewTabPageSyncHandler::HandleSyncLinkClicked(const ListValue* args) {
153 DCHECK(!waiting_for_initial_page_load_); 153 DCHECK(!waiting_for_initial_page_load_);
154 DCHECK(sync_service_); 154 DCHECK(sync_service_);
155 if (!sync_service_->IsSyncEnabled()) 155 if (!sync_service_->IsSyncEnabled())
156 return; 156 return;
157 if (sync_service_->HasSyncSetupCompleted()) { 157 if (sync_service_->HasSyncSetupCompleted()) {
158 if (sync_service_->observed_passphrase_required()) { 158 sync_service_->ShowErrorUI(NULL);
159 if (sync_service_->IsUsingSecondaryPassphrase())
160 sync_service_->PromptForExistingPassphrase(NULL);
161 else
162 sync_service_->SigninForPassphrase(dom_ui_->tab_contents());
163 return;
164 }
165 if (sync_service_->GetAuthError().state() ==
166 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS ||
167 sync_service_->GetAuthError().state() ==
168 GoogleServiceAuthError::CAPTCHA_REQUIRED ||
169 sync_service_->GetAuthError().state() ==
170 GoogleServiceAuthError::ACCOUNT_DELETED ||
171 sync_service_->GetAuthError().state() ==
172 GoogleServiceAuthError::ACCOUNT_DISABLED ||
173 sync_service_->GetAuthError().state() ==
174 GoogleServiceAuthError::SERVICE_UNAVAILABLE) {
175 sync_service_->ShowLoginDialog(NULL);
176 return;
177 }
178 DictionaryValue value; 159 DictionaryValue value;
179 value.SetString("syncEnabledMessage", 160 value.SetString("syncEnabledMessage",
180 l10n_util::GetStringFUTF16(IDS_SYNC_NTP_SYNCED_TO, 161 l10n_util::GetStringFUTF16(IDS_SYNC_NTP_SYNCED_TO,
181 sync_service_->GetAuthenticatedUsername())); 162 sync_service_->GetAuthenticatedUsername()));
182 dom_ui_->CallJavascriptFunction(L"syncAlreadyEnabled", value); 163 dom_ui_->CallJavascriptFunction(L"syncAlreadyEnabled", value);
183 } else { 164 } else {
184 // User clicked the 'Start now' link to begin syncing. 165 // User clicked the 'Start now' link to begin syncing.
185 ProfileSyncService::SyncEvent(ProfileSyncService::START_FROM_NTP); 166 ProfileSyncService::SyncEvent(ProfileSyncService::START_FROM_NTP);
186 sync_service_->ShowLoginDialog(NULL); 167 sync_service_->ShowLoginDialog(NULL);
187 } 168 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 if (linkurl.empty()) { 210 if (linkurl.empty()) {
230 value.SetBoolean("linkurlisset", false); 211 value.SetBoolean("linkurlisset", false);
231 } else { 212 } else {
232 value.SetBoolean("linkurlisset", true); 213 value.SetBoolean("linkurlisset", true);
233 value.SetString("linkurl", linkurl); 214 value.SetString("linkurl", linkurl);
234 } 215 }
235 } 216 }
236 } 217 }
237 dom_ui_->CallJavascriptFunction(L"syncMessageChanged", value); 218 dom_ui_->CallJavascriptFunction(L"syncMessageChanged", value);
238 } 219 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/new_new_tab.css » ('j') | chrome/browser/sync/profile_sync_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698