OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CHROMEOS_IME_INPUT_METHOD_WHITELIST_H_ | 5 #ifndef CHROMEOS_NETWORK_POLICY_UTIL_H_ |
6 #define CHROMEOS_IME_INPUT_METHOD_WHITELIST_H_ | 6 #define CHROMEOS_NETWORK_POLICY_UTIL_H_ |
7 | 7 |
8 #include <set> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | |
11 | 10 |
12 #include "base/basictypes.h" | |
13 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
14 #include "chromeos/chromeos_export.h" | 12 |
| 13 namespace base { |
| 14 class DictionaryValue; |
| 15 } |
15 | 16 |
16 namespace chromeos { | 17 namespace chromeos { |
17 namespace input_method { | |
18 | 18 |
19 class InputMethodDescriptor; | 19 struct NetworkProfile; |
20 typedef std::vector<InputMethodDescriptor> InputMethodDescriptors; | |
21 | 20 |
22 // A class which has white listed input method list. The list is generated by | 21 namespace policy_util { |
23 // gen_input_methods.py from input_methods.txt. | |
24 class CHROMEOS_EXPORT InputMethodWhitelist { | |
25 public: | |
26 InputMethodWhitelist(); | |
27 ~InputMethodWhitelist(); | |
28 | 22 |
29 // Returns true if |input_method_id| is whitelisted. | 23 typedef std::map<std::string, const base::DictionaryValue*> GuidToPolicyMap; |
30 bool InputMethodIdIsWhitelisted(const std::string& input_method_id) const; | |
31 | 24 |
32 // Returns all input methods that are supported, including ones not active. | 25 // Creates a Shill property dictionary from the given arguments. The resulting |
33 // This function never returns NULL. Note that input method extensions are not | 26 // dictionary will be sent to Shill by the caller. Depending on the profile |
34 // included in the result. | 27 // type, |policy| is interpreted as the user or device policy and |settings| as |
35 scoped_ptr<InputMethodDescriptors> GetSupportedInputMethods() const; | 28 // the user or shared settings. |policy| or |settings| can be NULL, but not |
| 29 // both. |
| 30 scoped_ptr<base::DictionaryValue> CreateShillConfiguration( |
| 31 const NetworkProfile& profile, |
| 32 const std::string& guid, |
| 33 const base::DictionaryValue* policy, |
| 34 const base::DictionaryValue* settings); |
36 | 35 |
37 private: | 36 // Returns the policy from |policies| matching |actual_network|, if any exists. |
38 std::set<std::string> supported_input_methods_; | 37 // Returns NULL otherwise. |actual_network| must be part of a ONC |
| 38 // NetworkConfiguration. |
| 39 const base::DictionaryValue* FindMatchingPolicy( |
| 40 const GuidToPolicyMap& policies, |
| 41 const base::DictionaryValue& actual_network); |
39 | 42 |
40 DISALLOW_COPY_AND_ASSIGN(InputMethodWhitelist); | 43 } // namespace policy_util |
41 }; | |
42 | 44 |
43 } // namespace input_method | |
44 } // namespace chromeos | 45 } // namespace chromeos |
45 | 46 |
46 #endif // CHROMEOS_IME_INPUT_METHOD_WHITELIST_H_ | 47 #endif // CHROMEOS_NETWORK_POLICY_UTIL_H_ |
OLD | NEW |