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

Side by Side Diff: chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc

Issue 7093004: Sync: Refactor the ProfileSyncService and sync setup flow to remove use of WebUI from PSS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes and cleanups. Created 9 years, 6 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ui/webui/ntp/new_tab_page_sync_handler.h" 5 #include "chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/string_split.h" 10 #include "base/string_split.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 SendSyncMessageToPage(FromSyncStatusMessageType(type), 149 SendSyncMessageToPage(FromSyncStatusMessageType(type),
150 UTF16ToUTF8(status_msg), UTF16ToUTF8(link_text)); 150 UTF16ToUTF8(status_msg), UTF16ToUTF8(link_text));
151 } 151 }
152 152
153 void NewTabPageSyncHandler::HandleSyncLinkClicked(const ListValue* args) { 153 void NewTabPageSyncHandler::HandleSyncLinkClicked(const ListValue* args) {
154 DCHECK(!waiting_for_initial_page_load_); 154 DCHECK(!waiting_for_initial_page_load_);
155 DCHECK(sync_service_); 155 DCHECK(sync_service_);
156 if (!sync_service_->IsSyncEnabled()) 156 if (!sync_service_->IsSyncEnabled())
157 return; 157 return;
158 if (sync_service_->HasSyncSetupCompleted()) { 158 if (sync_service_->HasSyncSetupCompleted()) {
159 sync_service_->ShowErrorUI(NULL); 159 sync_service_->ShowErrorUI();
160 DictionaryValue value; 160 DictionaryValue value;
161 value.SetString("syncEnabledMessage", 161 value.SetString("syncEnabledMessage",
162 l10n_util::GetStringFUTF16(IDS_SYNC_NTP_SYNCED_TO, 162 l10n_util::GetStringFUTF16(IDS_SYNC_NTP_SYNCED_TO,
163 sync_service_->GetAuthenticatedUsername())); 163 sync_service_->GetAuthenticatedUsername()));
164 web_ui_->CallJavascriptFunction("syncAlreadyEnabled", value); 164 web_ui_->CallJavascriptFunction("syncAlreadyEnabled", value);
165 } else { 165 } else {
166 // User clicked the 'Start now' link to begin syncing. 166 // User clicked the 'Start now' link to begin syncing.
167 ProfileSyncService::SyncEvent(ProfileSyncService::START_FROM_NTP); 167 ProfileSyncService::SyncEvent(ProfileSyncService::START_FROM_NTP);
168 sync_service_->ShowLoginDialog(NULL); 168 sync_service_->ShowLoginDialog();
169 } 169 }
170 } 170 }
171 171
172 void NewTabPageSyncHandler::OnStateChanged() { 172 void NewTabPageSyncHandler::OnStateChanged() {
173 // Don't do anything if the page has not yet loaded. 173 // Don't do anything if the page has not yet loaded.
174 if (waiting_for_initial_page_load_) 174 if (waiting_for_initial_page_load_)
175 return; 175 return;
176 BuildAndSendSyncStatus(); 176 BuildAndSendSyncStatus();
177 } 177 }
178 178
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 if (linkurl.empty()) { 211 if (linkurl.empty()) {
212 value.SetBoolean("linkurlisset", false); 212 value.SetBoolean("linkurlisset", false);
213 } else { 213 } else {
214 value.SetBoolean("linkurlisset", true); 214 value.SetBoolean("linkurlisset", true);
215 value.SetString("linkurl", linkurl); 215 value.SetString("linkurl", linkurl);
216 } 216 }
217 } 217 }
218 } 218 }
219 web_ui_->CallJavascriptFunction("syncMessageChanged", value); 219 web_ui_->CallJavascriptFunction("syncMessageChanged", value);
220 } 220 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc ('k') | chrome/browser/ui/webui/options/personal_options_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698