| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 SERVICES_CATALOG_STORE_H_ | 5 #ifndef SERVICES_CATALOG_STORE_H_ |
| 6 #define SERVICES_CATALOG_STORE_H_ | 6 #define SERVICES_CATALOG_STORE_H_ |
| 7 | 7 |
| 8 #include <memory> | |
| 9 | |
| 10 #include "base/values.h" | |
| 11 | |
| 12 namespace catalog { | 8 namespace catalog { |
| 13 | 9 |
| 14 // Implemented by an object that provides storage for the service catalog | 10 // TODO(rockot): Clean this up now that it's only a namespace for constants. |
| 15 // (e.g. in Chrome, preferences). The Catalog is the canonical owner of the | 11 // Alternatively, re-introduce a Store interface once it makes sense to do so. |
| 16 // contents of the store, so no one else must modify its contents. | |
| 17 class Store { | 12 class Store { |
| 18 public: | 13 public: |
| 19 // Value is a string. | 14 // Value is a string. |
| 20 static const char kNameKey[]; | 15 static const char kNameKey[]; |
| 21 // Value is a string. | 16 // Value is a string. |
| 22 static const char kQualifierKey[]; | 17 static const char kQualifierKey[]; |
| 23 // Value is a string. | 18 // Value is a string. |
| 24 static const char kDisplayNameKey[]; | 19 static const char kDisplayNameKey[]; |
| 25 // Value is a dictionary. | 20 // Value is a dictionary. |
| 26 static const char kInterfaceProviderSpecsKey[]; | 21 static const char kInterfaceProviderSpecsKey[]; |
| 27 // Value is a dictionary. | 22 // Value is a dictionary. |
| 28 static const char kInterfaceProviderSpecs_ProvidesKey[]; | 23 static const char kInterfaceProviderSpecs_ProvidesKey[]; |
| 29 // Value is a dictionary. | 24 // Value is a dictionary. |
| 30 static const char kInterfaceProviderSpecs_RequiresKey[]; | 25 static const char kInterfaceProviderSpecs_RequiresKey[]; |
| 31 // Value is a list. | 26 // Value is a list. |
| 32 static const char kServicesKey[]; | 27 static const char kServicesKey[]; |
| 33 | |
| 34 virtual ~Store() {} | |
| 35 | |
| 36 // Called during initialization to construct the Catalog's catalog. | |
| 37 // Returns a serialized list of the services. Each entry in the returned list | |
| 38 // corresponds to an app (as a dictionary). Each dictionary has a name, | |
| 39 // display name and capabilities. The return value is owned by the caller. | |
| 40 virtual const base::ListValue* GetStore() = 0; | |
| 41 | |
| 42 // Write the catalog to the store. Called when the Catalog learns of a newly | |
| 43 // encountered service. | |
| 44 virtual void UpdateStore(std::unique_ptr<base::ListValue> store) = 0; | |
| 45 }; | 28 }; |
| 46 | 29 |
| 47 } // namespace catalog | 30 } // namespace catalog |
| 48 | 31 |
| 49 #endif // SERVICES_CATALOG_STORE_H_ | 32 #endif // SERVICES_CATALOG_STORE_H_ |
| OLD | NEW |