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

Unified Diff: chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc

Issue 9456031: Remove PSS::ShowLoginDialog() and obsolete IDC_SYNC_BOOKMARKS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed review feedback. Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/toolbar/wrench_menu_model.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc
diff --git a/chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc b/chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc
index aba9c8f7f53f7e81d04935c2e94250b8b6d99127..05d75d48693c127dd40130d3fed039774abc7b9b 100644
--- a/chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc
+++ b/chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc
@@ -15,8 +15,14 @@
#include "chrome/browser/net/chrome_url_request_context.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/signin/signin_manager.h"
+#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/webui/signin/login_ui_service.h"
+#include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
#include "chrome/common/pref_names.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/public/browser/web_ui.h"
@@ -116,19 +122,22 @@ void NewTabPageSyncHandler::HandleSyncLinkClicked(const ListValue* args) {
DCHECK(sync_service_);
if (!sync_service_->IsSyncEnabled())
return;
+ Browser* browser =
+ BrowserList::FindBrowserWithWebContents(web_ui()->GetWebContents());
+ if (!browser || browser->IsAttemptingToCloseBrowser())
+ return;
+ browser->ShowSyncSetup();
+
if (sync_service_->HasSyncSetupCompleted()) {
- sync_service_->ShowErrorUI();
- string16 user = UTF8ToUTF16(sync_service_->profile()->GetPrefs()->GetString(
- prefs::kGoogleServicesUsername));
+ string16 user = UTF8ToUTF16(SigninManagerFactory::GetForProfile(
+ Profile::FromWebUI(web_ui()))->GetAuthenticatedUsername());
DictionaryValue value;
value.SetString("syncEnabledMessage",
l10n_util::GetStringFUTF16(IDS_SYNC_NTP_SYNCED_TO,
user));
web_ui()->CallJavascriptFunction("syncAlreadyEnabled", value);
} else {
- // User clicked the 'Start now' link to begin syncing.
ProfileSyncService::SyncEvent(ProfileSyncService::START_FROM_NTP);
- sync_service_->ShowLoginDialog();
}
}
« no previous file with comments | « chrome/browser/ui/toolbar/wrench_menu_model.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698