| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 SyncConfigInfo::SyncConfigInfo() | 91 SyncConfigInfo::SyncConfigInfo() |
| 92 : encrypt_all(false), | 92 : encrypt_all(false), |
| 93 sync_everything(false), | 93 sync_everything(false), |
| 94 sync_nothing(false), | 94 sync_nothing(false), |
| 95 passphrase_is_gaia(false) {} | 95 passphrase_is_gaia(false) {} |
| 96 | 96 |
| 97 SyncConfigInfo::~SyncConfigInfo() {} | 97 SyncConfigInfo::~SyncConfigInfo() {} |
| 98 | 98 |
| 99 bool GetConfiguration(const std::string& json, SyncConfigInfo* config) { | 99 bool GetConfiguration(const std::string& json, SyncConfigInfo* config) { |
| 100 scoped_ptr<base::Value> parsed_value = base::JSONReader::Read(json); | 100 std::unique_ptr<base::Value> parsed_value = base::JSONReader::Read(json); |
| 101 base::DictionaryValue* result; | 101 base::DictionaryValue* result; |
| 102 if (!parsed_value || !parsed_value->GetAsDictionary(&result)) { | 102 if (!parsed_value || !parsed_value->GetAsDictionary(&result)) { |
| 103 DLOG(ERROR) << "GetConfiguration() not passed a Dictionary"; | 103 DLOG(ERROR) << "GetConfiguration() not passed a Dictionary"; |
| 104 return false; | 104 return false; |
| 105 } | 105 } |
| 106 | 106 |
| 107 if (!result->GetBoolean("syncAllDataTypes", &config->sync_everything)) { | 107 if (!result->GetBoolean("syncAllDataTypes", &config->sync_everything)) { |
| 108 DLOG(ERROR) << "GetConfiguration() not passed a syncAllDataTypes value"; | 108 DLOG(ERROR) << "GetConfiguration() not passed a syncAllDataTypes value"; |
| 109 return false; | 109 return false; |
| 110 } | 110 } |
| (...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 const base::FilePath& /* profile_path */, | 813 const base::FilePath& /* profile_path */, |
| 814 const base::string16& /* old_profile_name */) { | 814 const base::string16& /* old_profile_name */) { |
| 815 HandleGetProfileInfo(nullptr); | 815 HandleGetProfileInfo(nullptr); |
| 816 } | 816 } |
| 817 | 817 |
| 818 void PeopleHandler::OnProfileAvatarChanged( | 818 void PeopleHandler::OnProfileAvatarChanged( |
| 819 const base::FilePath& /* profile_path */) { | 819 const base::FilePath& /* profile_path */) { |
| 820 HandleGetProfileInfo(nullptr); | 820 HandleGetProfileInfo(nullptr); |
| 821 } | 821 } |
| 822 | 822 |
| 823 scoped_ptr<base::DictionaryValue> PeopleHandler::GetSyncStateDictionary() { | 823 std::unique_ptr<base::DictionaryValue> PeopleHandler::GetSyncStateDictionary() { |
| 824 // The items which are to be written into |sync_status| are also described in | 824 // The items which are to be written into |sync_status| are also described in |
| 825 // chrome/browser/resources/options/browser_options.js in @typedef | 825 // chrome/browser/resources/options/browser_options.js in @typedef |
| 826 // for SyncStatus. Please update it whenever you add or remove any keys here. | 826 // for SyncStatus. Please update it whenever you add or remove any keys here. |
| 827 scoped_ptr<base::DictionaryValue> sync_status(new base::DictionaryValue); | 827 std::unique_ptr<base::DictionaryValue> sync_status(new base::DictionaryValue); |
| 828 if (profile_->IsGuestSession()) { | 828 if (profile_->IsGuestSession()) { |
| 829 // Cannot display signin status when running in guest mode on chromeos | 829 // Cannot display signin status when running in guest mode on chromeos |
| 830 // because there is no SigninManager. | 830 // because there is no SigninManager. |
| 831 sync_status->SetBoolean("signinAllowed", false); | 831 sync_status->SetBoolean("signinAllowed", false); |
| 832 return sync_status; | 832 return sync_status; |
| 833 } | 833 } |
| 834 | 834 |
| 835 sync_status->SetBoolean("supervisedUser", profile_->IsSupervised()); | 835 sync_status->SetBoolean("supervisedUser", profile_->IsSupervised()); |
| 836 sync_status->SetBoolean("childUser", profile_->IsChild()); | 836 sync_status->SetBoolean("childUser", profile_->IsChild()); |
| 837 | 837 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 void PeopleHandler::UpdateSyncState() { | 1017 void PeopleHandler::UpdateSyncState() { |
| 1018 web_ui()->CallJavascriptFunction("settings.SyncPrivateApi.sendSyncStatus", | 1018 web_ui()->CallJavascriptFunction("settings.SyncPrivateApi.sendSyncStatus", |
| 1019 *GetSyncStateDictionary()); | 1019 *GetSyncStateDictionary()); |
| 1020 } | 1020 } |
| 1021 | 1021 |
| 1022 void PeopleHandler::OnSigninAllowedPrefChange() { | 1022 void PeopleHandler::OnSigninAllowedPrefChange() { |
| 1023 UpdateSyncState(); | 1023 UpdateSyncState(); |
| 1024 } | 1024 } |
| 1025 | 1025 |
| 1026 } // namespace settings | 1026 } // namespace settings |
| OLD | NEW |