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/extensions/api/storage/settings_namespace.h" | 5 #include "extensions/browser/api/storage/settings_namespace.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace extensions { | 9 namespace extensions { |
10 | 10 |
11 namespace settings_namespace { | 11 namespace settings_namespace { |
12 | 12 |
13 namespace { | 13 namespace { |
14 const char kLocalNamespace[] = "local"; | 14 const char kLocalNamespace[] = "local"; |
15 const char kSyncNamespace[] = "sync"; | 15 const char kSyncNamespace[] = "sync"; |
16 const char kManagedNamespace[] = "managed"; | 16 const char kManagedNamespace[] = "managed"; |
17 } // namespace | 17 } // namespace |
18 | 18 |
19 std::string ToString(Namespace settings_namespace) { | 19 std::string ToString(Namespace settings_namespace) { |
20 switch (settings_namespace) { | 20 switch (settings_namespace) { |
21 case LOCAL: return kLocalNamespace; | 21 case LOCAL: |
22 case SYNC: return kSyncNamespace; | 22 return kLocalNamespace; |
23 case MANAGED: return kManagedNamespace; | 23 case SYNC: |
24 case INVALID: break; | 24 return kSyncNamespace; |
| 25 case MANAGED: |
| 26 return kManagedNamespace; |
| 27 case INVALID: |
| 28 break; |
25 } | 29 } |
26 NOTREACHED(); | 30 NOTREACHED(); |
27 return std::string(); | 31 return std::string(); |
28 } | 32 } |
29 | 33 |
30 Namespace FromString(const std::string& namespace_string) { | 34 Namespace FromString(const std::string& namespace_string) { |
31 if (namespace_string == kLocalNamespace) | 35 if (namespace_string == kLocalNamespace) |
32 return LOCAL; | 36 return LOCAL; |
33 if (namespace_string == kSyncNamespace) | 37 if (namespace_string == kSyncNamespace) |
34 return SYNC; | 38 return SYNC; |
35 if (namespace_string == kManagedNamespace) | 39 if (namespace_string == kManagedNamespace) |
36 return MANAGED; | 40 return MANAGED; |
37 return INVALID; | 41 return INVALID; |
38 } | 42 } |
39 | 43 |
40 } // namespace settings_namespace | 44 } // namespace settings_namespace |
41 | 45 |
42 } // namespace extensions | 46 } // namespace extensions |
OLD | NEW |