| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/net/onc_utils.h" | 5 #include "chrome/browser/chromeos/net/onc_utils.h" |
| 6 | 6 |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 public: | 154 public: |
| 155 explicit UserStringSubstitution(const user_manager::User* user) | 155 explicit UserStringSubstitution(const user_manager::User* user) |
| 156 : user_(user) {} | 156 : user_(user) {} |
| 157 ~UserStringSubstitution() override {} | 157 ~UserStringSubstitution() override {} |
| 158 | 158 |
| 159 bool GetSubstitute(const std::string& placeholder, | 159 bool GetSubstitute(const std::string& placeholder, |
| 160 std::string* substitute) const override { | 160 std::string* substitute) const override { |
| 161 if (placeholder == ::onc::substitutes::kLoginIDField) | 161 if (placeholder == ::onc::substitutes::kLoginIDField) |
| 162 *substitute = user_->GetAccountName(false); | 162 *substitute = user_->GetAccountName(false); |
| 163 else if (placeholder == ::onc::substitutes::kEmailField) | 163 else if (placeholder == ::onc::substitutes::kEmailField) |
| 164 *substitute = user_->email(); | 164 *substitute = user_->GetUserID().GetUserEmail(); |
| 165 else | 165 else |
| 166 return false; | 166 return false; |
| 167 return true; | 167 return true; |
| 168 } | 168 } |
| 169 | 169 |
| 170 private: | 170 private: |
| 171 const user_manager::User* user_; | 171 const user_manager::User* user_; |
| 172 | 172 |
| 173 DISALLOW_COPY_AND_ASSIGN(UserStringSubstitution); | 173 DISALLOW_COPY_AND_ASSIGN(UserStringSubstitution); |
| 174 }; | 174 }; |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 const PrefService* local_state_prefs, | 452 const PrefService* local_state_prefs, |
| 453 const NetworkState& network) { | 453 const NetworkState& network) { |
| 454 ::onc::ONCSource ignored_onc_source; | 454 ::onc::ONCSource ignored_onc_source; |
| 455 const base::DictionaryValue* policy = onc::GetPolicyForNetwork( | 455 const base::DictionaryValue* policy = onc::GetPolicyForNetwork( |
| 456 profile_prefs, local_state_prefs, network, &ignored_onc_source); | 456 profile_prefs, local_state_prefs, network, &ignored_onc_source); |
| 457 return policy != NULL; | 457 return policy != NULL; |
| 458 } | 458 } |
| 459 | 459 |
| 460 } // namespace onc | 460 } // namespace onc |
| 461 } // namespace chromeos | 461 } // namespace chromeos |
| OLD | NEW |