| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 | 767 |
| 768 scoped_ptr<base::DictionaryValue> PeopleHandler::GetSyncStateDictionary() { | 768 scoped_ptr<base::DictionaryValue> PeopleHandler::GetSyncStateDictionary() { |
| 769 // The items which are to be written into |sync_status| are also described in | 769 // The items which are to be written into |sync_status| are also described in |
| 770 // chrome/browser/resources/options/browser_options.js in @typedef | 770 // chrome/browser/resources/options/browser_options.js in @typedef |
| 771 // for SyncStatus. Please update it whenever you add or remove any keys here. | 771 // for SyncStatus. Please update it whenever you add or remove any keys here. |
| 772 scoped_ptr<base::DictionaryValue> sync_status(new base::DictionaryValue); | 772 scoped_ptr<base::DictionaryValue> sync_status(new base::DictionaryValue); |
| 773 if (profile_->IsGuestSession()) { | 773 if (profile_->IsGuestSession()) { |
| 774 // Cannot display signin status when running in guest mode on chromeos | 774 // Cannot display signin status when running in guest mode on chromeos |
| 775 // because there is no SigninManager. | 775 // because there is no SigninManager. |
| 776 sync_status->SetBoolean("signinAllowed", false); | 776 sync_status->SetBoolean("signinAllowed", false); |
| 777 return sync_status.Pass(); | 777 return sync_status; |
| 778 } | 778 } |
| 779 | 779 |
| 780 sync_status->SetBoolean("supervisedUser", profile_->IsSupervised()); | 780 sync_status->SetBoolean("supervisedUser", profile_->IsSupervised()); |
| 781 sync_status->SetBoolean("childUser", profile_->IsChild()); | 781 sync_status->SetBoolean("childUser", profile_->IsChild()); |
| 782 | 782 |
| 783 bool signout_prohibited = false; | 783 bool signout_prohibited = false; |
| 784 #if !defined(OS_CHROMEOS) | 784 #if !defined(OS_CHROMEOS) |
| 785 // Signout is not allowed if the user has policy (crbug.com/172204). | 785 // Signout is not allowed if the user has policy (crbug.com/172204). |
| 786 signout_prohibited = | 786 signout_prohibited = |
| 787 SigninManagerFactory::GetForProfile(profile_)->IsSignoutProhibited(); | 787 SigninManagerFactory::GetForProfile(profile_)->IsSignoutProhibited(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 814 sync_status->SetBoolean("signedIn", signin->IsAuthenticated()); | 814 sync_status->SetBoolean("signedIn", signin->IsAuthenticated()); |
| 815 sync_status->SetBoolean("hasUnrecoverableError", | 815 sync_status->SetBoolean("hasUnrecoverableError", |
| 816 service && service->HasUnrecoverableError()); | 816 service && service->HasUnrecoverableError()); |
| 817 | 817 |
| 818 std::string name; | 818 std::string name; |
| 819 std::string icon_url; | 819 std::string icon_url; |
| 820 GetAccountNameAndIcon(*profile_, &name, &icon_url); | 820 GetAccountNameAndIcon(*profile_, &name, &icon_url); |
| 821 sync_status->SetString("name", name); | 821 sync_status->SetString("name", name); |
| 822 sync_status->SetString("iconURL", icon_url); | 822 sync_status->SetString("iconURL", icon_url); |
| 823 | 823 |
| 824 return sync_status.Pass(); | 824 return sync_status; |
| 825 } | 825 } |
| 826 | 826 |
| 827 bool PeopleHandler::IsExistingWizardPresent() { | 827 bool PeopleHandler::IsExistingWizardPresent() { |
| 828 LoginUIService* service = GetLoginUIService(); | 828 LoginUIService* service = GetLoginUIService(); |
| 829 DCHECK(service); | 829 DCHECK(service); |
| 830 return service->current_login_ui() != nullptr; | 830 return service->current_login_ui() != nullptr; |
| 831 } | 831 } |
| 832 | 832 |
| 833 bool PeopleHandler::FocusExistingWizardIfPresent() { | 833 bool PeopleHandler::FocusExistingWizardIfPresent() { |
| 834 if (!IsExistingWizardPresent()) | 834 if (!IsExistingWizardPresent()) |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 968 void PeopleHandler::UpdateSyncState() { | 968 void PeopleHandler::UpdateSyncState() { |
| 969 web_ui()->CallJavascriptFunction("settings.SyncPrivateApi.sendSyncStatus", | 969 web_ui()->CallJavascriptFunction("settings.SyncPrivateApi.sendSyncStatus", |
| 970 *GetSyncStateDictionary()); | 970 *GetSyncStateDictionary()); |
| 971 } | 971 } |
| 972 | 972 |
| 973 void PeopleHandler::OnSigninAllowedPrefChange() { | 973 void PeopleHandler::OnSigninAllowedPrefChange() { |
| 974 UpdateSyncState(); | 974 UpdateSyncState(); |
| 975 } | 975 } |
| 976 | 976 |
| 977 } // namespace settings | 977 } // namespace settings |
| OLD | NEW |