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 action_type) { |
| 156 switch (action_type) { |
| 157 case sync_ui_util::REAUTHENTICATE: |
| 158 return "reauthenticate"; |
| 159 case sync_ui_util::UPGRADE_CLIENT: |
| 160 return "upgradeClient"; |
| 161 case sync_ui_util::ENTER_PASSPHRASE: |
| 162 return "enterPassphrase"; |
| 163 default: |
| 164 return "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 action_type = 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, &action_type) == |
| 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(action_type)); |
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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 base::FilePath profile_file_path = profile_->GetPath(); | 913 base::FilePath profile_file_path = profile_->GetPath(); |
899 ProfileMetrics::LogProfileSyncSignIn(profile_file_path); | 914 ProfileMetrics::LogProfileSyncSignIn(profile_file_path); |
900 | 915 |
901 // We're done configuring, so notify ProfileSyncService that it is OK to | 916 // We're done configuring, so notify ProfileSyncService that it is OK to |
902 // start syncing. | 917 // start syncing. |
903 sync_blocker_.reset(); | 918 sync_blocker_.reset(); |
904 service->SetFirstSetupComplete(); | 919 service->SetFirstSetupComplete(); |
905 } | 920 } |
906 | 921 |
907 } // namespace settings | 922 } // namespace settings |
OLD | NEW |