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

Side by Side Diff: chrome/browser/ui/webui/settings/people_handler.cc

Issue 2393643004: [MD Settings][People] Updates positions of username and sync status message (Closed)
Patch Set: Addressed comments Created 4 years, 2 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/settings/people_handler.h" 5 #include "chrome/browser/ui/webui/settings/people_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/i18n/time_formatting.h" 13 #include "base/i18n/time_formatting.h"
14 #include "base/json/json_reader.h" 14 #include "base/json/json_reader.h"
15 #include "base/json/json_writer.h" 15 #include "base/json/json_writer.h"
16 #include "base/metrics/histogram_macros.h" 16 #include "base/metrics/histogram_macros.h"
17 #include "base/values.h" 17 #include "base/values.h"
18 #include "build/build_config.h" 18 #include "build/build_config.h"
19 #include "chrome/browser/lifetime/application_lifetime.h" 19 #include "chrome/browser/lifetime/application_lifetime.h"
20 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/profiles/profile_metrics.h" 21 #include "chrome/browser/profiles/profile_metrics.h"
22 #include "chrome/browser/profiles/profile_window.h" 22 #include "chrome/browser/profiles/profile_window.h"
23 #include "chrome/browser/signin/chrome_signin_helper.h" 23 #include "chrome/browser/signin/chrome_signin_helper.h"
24 #include "chrome/browser/signin/signin_error_controller_factory.h" 24 #include "chrome/browser/signin/signin_error_controller_factory.h"
25 #include "chrome/browser/signin/signin_manager_factory.h" 25 #include "chrome/browser/signin/signin_manager_factory.h"
26 #include "chrome/browser/signin/signin_promo.h" 26 #include "chrome/browser/signin/signin_promo.h"
27 #include "chrome/browser/signin/signin_ui_util.h"
27 #include "chrome/browser/sync/profile_sync_service_factory.h" 28 #include "chrome/browser/sync/profile_sync_service_factory.h"
28 #include "chrome/browser/sync/sync_ui_util.h" 29 #include "chrome/browser/sync/sync_ui_util.h"
29 #include "chrome/browser/ui/browser_finder.h" 30 #include "chrome/browser/ui/browser_finder.h"
30 #include "chrome/browser/ui/browser_window.h" 31 #include "chrome/browser/ui/browser_window.h"
31 #include "chrome/browser/ui/singleton_tabs.h" 32 #include "chrome/browser/ui/singleton_tabs.h"
32 #include "chrome/browser/ui/user_manager.h" 33 #include "chrome/browser/ui/user_manager.h"
33 #include "chrome/browser/ui/webui/profile_helper.h" 34 #include "chrome/browser/ui/webui/profile_helper.h"
34 #include "chrome/browser/ui/webui/signin/login_ui_service.h" 35 #include "chrome/browser/ui/webui/signin/login_ui_service.h"
35 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" 36 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
36 #include "chrome/common/chrome_switches.h" 37 #include "chrome/common/chrome_switches.h"
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 bool status_has_error = 734 bool status_has_error =
734 sync_ui_util::GetStatusLabels(profile_, service, *signin, 735 sync_ui_util::GetStatusLabels(profile_, service, *signin,
735 sync_ui_util::PLAIN_TEXT, &status_label, 736 sync_ui_util::PLAIN_TEXT, &status_label,
736 &link_label) == sync_ui_util::SYNC_ERROR; 737 &link_label) == sync_ui_util::SYNC_ERROR;
737 sync_status->SetString("statusText", status_label); 738 sync_status->SetString("statusText", status_label);
738 sync_status->SetString("actionLinkText", link_label); 739 sync_status->SetString("actionLinkText", link_label);
739 sync_status->SetBoolean("hasError", status_has_error); 740 sync_status->SetBoolean("hasError", status_has_error);
740 741
741 sync_status->SetBoolean("managed", service && service->IsManaged()); 742 sync_status->SetBoolean("managed", service && service->IsManaged());
742 sync_status->SetBoolean("signedIn", signin->IsAuthenticated()); 743 sync_status->SetBoolean("signedIn", signin->IsAuthenticated());
744 sync_status->SetString("username",
tommycli 2016/10/05 19:37:37 can we make this variable name something else? Lik
Moe 2016/10/05 21:08:24 Done.
745 signin_ui_util::GetAuthenticatedUsername(signin));
743 sync_status->SetBoolean("hasUnrecoverableError", 746 sync_status->SetBoolean("hasUnrecoverableError",
744 service && service->HasUnrecoverableError()); 747 service && service->HasUnrecoverableError());
745 748
746 return sync_status; 749 return sync_status;
747 } 750 }
748 751
749 void PeopleHandler::PushSyncPrefs() { 752 void PeopleHandler::PushSyncPrefs() {
750 #if !defined(OS_CHROMEOS) 753 #if !defined(OS_CHROMEOS)
751 // Early exit if the user has not signed in yet. 754 // Early exit if the user has not signed in yet.
752 if (!SigninManagerFactory::GetForProfile(profile_)->IsAuthenticated() || 755 if (!SigninManagerFactory::GetForProfile(profile_)->IsAuthenticated() ||
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 base::FilePath profile_file_path = profile_->GetPath(); 901 base::FilePath profile_file_path = profile_->GetPath();
899 ProfileMetrics::LogProfileSyncSignIn(profile_file_path); 902 ProfileMetrics::LogProfileSyncSignIn(profile_file_path);
900 903
901 // We're done configuring, so notify ProfileSyncService that it is OK to 904 // We're done configuring, so notify ProfileSyncService that it is OK to
902 // start syncing. 905 // start syncing.
903 sync_blocker_.reset(); 906 sync_blocker_.reset();
904 service->SetFirstSetupComplete(); 907 service->SetFirstSetupComplete();
905 } 908 }
906 909
907 } // namespace settings 910 } // namespace settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698