OLD | NEW |
---|---|
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" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
145 void ParseConfigurationArguments(const base::ListValue* args, | 145 void ParseConfigurationArguments(const base::ListValue* args, |
146 SyncConfigInfo* config, | 146 SyncConfigInfo* config, |
147 const base::Value** callback_id) { | 147 const base::Value** callback_id) { |
148 std::string json; | 148 std::string json; |
149 if (args->Get(0, callback_id) && args->GetString(1, &json) && !json.empty()) | 149 if (args->Get(0, callback_id) && args->GetString(1, &json) && !json.empty()) |
150 CHECK(GetConfiguration(json, config)); | 150 CHECK(GetConfiguration(json, config)); |
151 else | 151 else |
152 NOTREACHED(); | 152 NOTREACHED(); |
153 } | 153 } |
154 | 154 |
155 std::string getSyncErrorAction(sync_ui_util::ActionType actionType) { | |
156 switch (actionType) { | |
157 case sync_ui_util::REAUTHENTICATE: | |
158 return std::string("reauthenticate"); | |
tommycli
2016/10/28 21:21:09
nit: are you sure it's necessary to wrap all these
Moe
2016/11/01 19:44:01
Done.
| |
159 case sync_ui_util::UPGRADE_CLIENT: | |
160 return std::string("upgradeClient"); | |
161 case sync_ui_util::ENTER_PASSPHRASE: | |
162 return std::string("enterPassphrase"); | |
163 default: | |
164 return std::string("noAction"); | |
165 } | |
166 } | |
167 | |
155 } // namespace | 168 } // namespace |
156 | 169 |
157 namespace settings { | 170 namespace settings { |
158 | 171 |
159 // static | 172 // static |
160 const char PeopleHandler::kSpinnerPageStatus[] = "spinner"; | 173 const char PeopleHandler::kSpinnerPageStatus[] = "spinner"; |
161 const char PeopleHandler::kConfigurePageStatus[] = "configure"; | 174 const char PeopleHandler::kConfigurePageStatus[] = "configure"; |
162 const char PeopleHandler::kTimeoutPageStatus[] = "timeout"; | 175 const char PeopleHandler::kTimeoutPageStatus[] = "timeout"; |
163 const char PeopleHandler::kDonePageStatus[] = "done"; | 176 const char PeopleHandler::kDonePageStatus[] = "done"; |
164 const char PeopleHandler::kPassphraseFailedPageStatus[] = "passphraseFailed"; | 177 const char PeopleHandler::kPassphraseFailedPageStatus[] = "passphraseFailed"; |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
724 sync_status->SetBoolean("signinAllowed", signin->IsSigninAllowed()); | 737 sync_status->SetBoolean("signinAllowed", signin->IsSigninAllowed()); |
725 sync_status->SetBoolean("syncSystemEnabled", (service != nullptr)); | 738 sync_status->SetBoolean("syncSystemEnabled", (service != nullptr)); |
726 sync_status->SetBoolean("setupCompleted", | 739 sync_status->SetBoolean("setupCompleted", |
727 service && service->IsFirstSetupComplete()); | 740 service && service->IsFirstSetupComplete()); |
728 sync_status->SetBoolean( | 741 sync_status->SetBoolean( |
729 "setupInProgress", | 742 "setupInProgress", |
730 service && !service->IsManaged() && service->IsFirstSetupInProgress()); | 743 service && !service->IsManaged() && service->IsFirstSetupInProgress()); |
731 | 744 |
732 base::string16 status_label; | 745 base::string16 status_label; |
733 base::string16 link_label; | 746 base::string16 link_label; |
747 sync_ui_util::ActionType actionType(sync_ui_util::NO_ACTION); | |
734 bool status_has_error = | 748 bool status_has_error = |
735 sync_ui_util::GetStatusLabels(profile_, service, *signin, | 749 sync_ui_util::GetStatusLabels(profile_, service, *signin, |
736 sync_ui_util::PLAIN_TEXT, &status_label, | 750 sync_ui_util::PLAIN_TEXT, &status_label, |
737 &link_label) == sync_ui_util::SYNC_ERROR; | 751 &link_label, &actionType) == |
752 sync_ui_util::SYNC_ERROR; | |
738 sync_status->SetString("statusText", status_label); | 753 sync_status->SetString("statusText", status_label); |
739 sync_status->SetString("actionLinkText", link_label); | |
740 sync_status->SetBoolean("hasError", status_has_error); | 754 sync_status->SetBoolean("hasError", status_has_error); |
755 sync_status->SetString("statusAction", getSyncErrorAction(actionType)); | |
741 | 756 |
742 sync_status->SetBoolean("managed", service && service->IsManaged()); | 757 sync_status->SetBoolean("managed", service && service->IsManaged()); |
743 sync_status->SetBoolean("signedIn", signin->IsAuthenticated()); | 758 sync_status->SetBoolean("signedIn", signin->IsAuthenticated()); |
744 sync_status->SetString("signedInUsername", | 759 sync_status->SetString("signedInUsername", |
745 signin_ui_util::GetAuthenticatedUsername(signin)); | 760 signin_ui_util::GetAuthenticatedUsername(signin)); |
746 sync_status->SetBoolean("hasUnrecoverableError", | 761 sync_status->SetBoolean("hasUnrecoverableError", |
747 service && service->HasUnrecoverableError()); | 762 service && service->HasUnrecoverableError()); |
748 | 763 |
749 return sync_status; | 764 return sync_status; |
750 } | 765 } |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
901 base::FilePath profile_file_path = profile_->GetPath(); | 916 base::FilePath profile_file_path = profile_->GetPath(); |
902 ProfileMetrics::LogProfileSyncSignIn(profile_file_path); | 917 ProfileMetrics::LogProfileSyncSignIn(profile_file_path); |
903 | 918 |
904 // We're done configuring, so notify ProfileSyncService that it is OK to | 919 // We're done configuring, so notify ProfileSyncService that it is OK to |
905 // start syncing. | 920 // start syncing. |
906 sync_blocker_.reset(); | 921 sync_blocker_.reset(); |
907 service->SetFirstSetupComplete(); | 922 service->SetFirstSetupComplete(); |
908 } | 923 } |
909 | 924 |
910 } // namespace settings | 925 } // namespace settings |
OLD | NEW |