Chromium Code Reviews| Index: chrome/browser/policy/policy_error_map.h |
| diff --git a/chrome/browser/policy/policy_error_map.h b/chrome/browser/policy/policy_error_map.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..47358c12e473c468bca504a3d32975de24216fc2 |
| --- /dev/null |
| +++ b/chrome/browser/policy/policy_error_map.h |
| @@ -0,0 +1,50 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_POLICY_POLICY_ERROR_MAP_H_ |
| +#define CHROME_BROWSER_POLICY_POLICY_ERROR_MAP_H_ |
| +#pragma once |
| + |
| +#include <map> |
| + |
| +#include "base/values.h" |
| +#include "policy/configuration_policy_type.h" |
| + |
| +namespace policy { |
| + |
| +// Wrapper class around a std::multimap<ConfigurationPolicyType, StringValue*> |
| +// used to associate policies with error messages generated when a policy fails |
| +// to be applied. |
| +class PolicyErrorMap { |
| + public: |
| + typedef std::multimap<ConfigurationPolicyType, StringValue*> PolicyMapType; |
|
Mattias Nissler (ping if slow)
2011/09/20 13:12:25
Why is this a StringValue* instead of a plain stri
simo
2011/09/22 11:43:26
For some reason I was thinking I needed to put Str
|
| + typedef PolicyMapType::const_iterator const_iterator; |
| + |
| + PolicyErrorMap(); |
| + virtual ~PolicyErrorMap(); |
| + |
| + // Takes ownership of |error_message|. |
| + void AddError(ConfigurationPolicyType policy, StringValue* error_message); |
| + |
| + // Returns a list of all the error messages stored for |policy|. The caller |
| + // acquires ownership of the returned ListValue pointer. |
| + ListValue* GetErrors(ConfigurationPolicyType policy) const; |
| + |
| + bool empty() const; |
| + size_t size() const; |
| + |
| + const_iterator begin() const; |
| + const_iterator end() const; |
| + |
| + void Clear(); |
| + |
| + private: |
| + PolicyMapType map_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(PolicyErrorMap); |
|
Mattias Nissler (ping if slow)
2011/09/20 13:12:25
#include "base/basic_types.h"
simo
2011/09/22 11:43:26
I couldn't find "base/basic_types.h" but I include
|
| +}; |
| + |
| +} // namespace policy |
| + |
| +#endif // CHROME_BROWSER_POLICY_POLICY_ERROR_MAP_H_ |