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

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

Issue 777143003: Clean up straggler classes to use embedded signin in page in the new profiles world. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } 124 }
125 125
126 void NewTabPageSyncHandler::HandleSyncLinkClicked(const base::ListValue* args) { 126 void NewTabPageSyncHandler::HandleSyncLinkClicked(const base::ListValue* args) {
127 DCHECK(!waiting_for_initial_page_load_); 127 DCHECK(!waiting_for_initial_page_load_);
128 if (!sync_service_ || !sync_service_->IsSyncEnabled()) 128 if (!sync_service_ || !sync_service_->IsSyncEnabled())
129 return; 129 return;
130 Browser* browser = 130 Browser* browser =
131 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents()); 131 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents());
132 if (!browser || browser->IsAttemptingToCloseBrowser()) 132 if (!browser || browser->IsAttemptingToCloseBrowser())
133 return; 133 return;
134 chrome::ShowBrowserSignin(browser, signin::SOURCE_NTP_LINK); 134 chrome::ShowBrowserSignin(browser, signin_metrics::SOURCE_NTP_LINK);
135 135
136 if (sync_service_->HasSyncSetupCompleted()) { 136 if (sync_service_->HasSyncSetupCompleted()) {
137 base::string16 user = base::UTF8ToUTF16(SigninManagerFactory::GetForProfile( 137 base::string16 user = base::UTF8ToUTF16(SigninManagerFactory::GetForProfile(
138 Profile::FromWebUI(web_ui()))->GetAuthenticatedUsername()); 138 Profile::FromWebUI(web_ui()))->GetAuthenticatedUsername());
139 base::DictionaryValue value; 139 base::DictionaryValue value;
140 value.SetString("syncEnabledMessage", 140 value.SetString("syncEnabledMessage",
141 l10n_util::GetStringFUTF16(IDS_SYNC_NTP_SYNCED_TO, 141 l10n_util::GetStringFUTF16(IDS_SYNC_NTP_SYNCED_TO,
142 user)); 142 user));
143 web_ui()->CallJavascriptFunction("ntp.syncAlreadyEnabled", value); 143 web_ui()->CallJavascriptFunction("ntp.syncAlreadyEnabled", value);
144 } else { 144 } else {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 if (linkurl.empty()) { 195 if (linkurl.empty()) {
196 value.SetBoolean("linkurlisset", false); 196 value.SetBoolean("linkurlisset", false);
197 } else { 197 } else {
198 value.SetBoolean("linkurlisset", true); 198 value.SetBoolean("linkurlisset", true);
199 value.SetString("linkurl", linkurl); 199 value.SetString("linkurl", linkurl);
200 } 200 }
201 } 201 }
202 } 202 }
203 web_ui()->CallJavascriptFunction("ntp.syncMessageChanged", value); 203 web_ui()->CallJavascriptFunction("ntp.syncMessageChanged", value);
204 } 204 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698