Chromium Code Reviews| 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 MOJO_SERVICES_CATALOG_ENTRY_H_ | 5 #ifndef MOJO_SERVICES_CATALOG_ENTRY_H_ |
| 6 #define MOJO_SERVICES_CATALOG_ENTRY_H_ | 6 #define MOJO_SERVICES_CATALOG_ENTRY_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | |
| 10 #include "mojo/shell/public/cpp/capabilities.h" | 11 #include "mojo/shell/public/cpp/capabilities.h" |
| 11 | 12 |
| 13 namespace base { | |
| 14 class DictionaryValue; | |
| 15 } | |
| 16 | |
| 12 namespace catalog { | 17 namespace catalog { |
| 13 | 18 |
| 14 // Static information about an application package known to the Catalog. | 19 // Static information about an application package known to the Catalog. |
| 15 struct Entry { | 20 class Entry { |
| 21 public: | |
| 22 enum class DeserializeResult { | |
| 23 SUCCESS, | |
| 24 INVALID_DICTIONARY, | |
| 25 INVALID_NAME | |
| 26 }; | |
| 27 | |
| 16 Entry(); | 28 Entry(); |
| 17 Entry(const Entry& other); | 29 explicit Entry(const Entry& other); |
| 18 ~Entry(); | 30 ~Entry(); |
| 19 | 31 |
| 32 scoped_ptr<base::DictionaryValue> Serialize() const; | |
| 33 static DeserializeResult Deserialize(const base::DictionaryValue& value, | |
|
sky
2016/03/22 15:10:03
It seems like you only check the return value for
| |
| 34 Entry* entry); | |
| 35 | |
| 20 bool operator==(const Entry& other) const; | 36 bool operator==(const Entry& other) const; |
| 21 | 37 |
| 22 std::string name; | 38 const std::string& name() const { return name_; } |
| 23 std::string qualifier; | 39 void set_name(const std::string& name) { name_ = name; } |
| 24 std::string display_name; | 40 const std::string& qualifier() const { return qualifier_; } |
| 25 mojo::CapabilitySpec capabilities; | 41 void set_qualifier(const std::string& qualifier) { qualifier_ = qualifier; } |
| 42 const std::string& display_name() const { return display_name_; } | |
| 43 void set_display_name(const std::string& display_name) { | |
| 44 display_name_ = display_name; | |
| 45 } | |
| 46 const mojo::CapabilitySpec& capabilities() const { return capabilities_; } | |
| 47 void set_capabilities(const mojo::CapabilitySpec& capabilities) { | |
| 48 capabilities_ = capabilities; | |
| 49 } | |
| 50 | |
| 51 private: | |
| 52 std::string name_; | |
| 53 std::string qualifier_; | |
| 54 std::string display_name_; | |
| 55 mojo::CapabilitySpec capabilities_; | |
| 26 }; | 56 }; |
| 27 | 57 |
| 28 } // namespace catalog | 58 } // namespace catalog |
| 29 | 59 |
| 30 #endif // MOJO_SERVICES_CATALOG_ENTRY_H_ | 60 #endif // MOJO_SERVICES_CATALOG_ENTRY_H_ |
| OLD | NEW |