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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 | 150 |
151 // This class defines which string placeholders of ONC are replaced by which | 151 // This class defines which string placeholders of ONC are replaced by which |
152 // user attribute. | 152 // user attribute. |
153 class UserStringSubstitution : public chromeos::onc::StringSubstitution { | 153 class UserStringSubstitution : public chromeos::onc::StringSubstitution { |
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 virtual ~UserStringSubstitution() {} | 157 virtual ~UserStringSubstitution() {} |
158 | 158 |
159 virtual bool GetSubstitute(const std::string& placeholder, | 159 virtual 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_->email(); |
165 else | 165 else |
166 return false; | 166 return false; |
167 return true; | 167 return true; |
168 } | 168 } |
169 | 169 |
170 private: | 170 private: |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 const PrefService* local_state_prefs, | 450 const PrefService* local_state_prefs, |
451 const NetworkState& network) { | 451 const NetworkState& network) { |
452 ::onc::ONCSource ignored_onc_source; | 452 ::onc::ONCSource ignored_onc_source; |
453 const base::DictionaryValue* policy = onc::GetPolicyForNetwork( | 453 const base::DictionaryValue* policy = onc::GetPolicyForNetwork( |
454 profile_prefs, local_state_prefs, network, &ignored_onc_source); | 454 profile_prefs, local_state_prefs, network, &ignored_onc_source); |
455 return policy != NULL; | 455 return policy != NULL; |
456 } | 456 } |
457 | 457 |
458 } // namespace onc | 458 } // namespace onc |
459 } // namespace chromeos | 459 } // namespace chromeos |
OLD | NEW |