| 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_DISCOVERY_SUGGESTED_LINKS_REGISTRY_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DISCOVERY_SUGGESTED_LINKS_REGISTRY_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_DISCOVERY_SUGGESTED_LINKS_REGISTRY_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_DISCOVERY_SUGGESTED_LINKS_REGISTRY_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 // A list of ExtensionSuggestedLink's. | 21 // A list of ExtensionSuggestedLink's. |
| 22 typedef std::vector<linked_ptr<extensions::SuggestedLink> > SuggestedLinkList; | 22 typedef std::vector<linked_ptr<extensions::SuggestedLink> > SuggestedLinkList; |
| 23 | 23 |
| 24 SuggestedLinksRegistry(); | 24 SuggestedLinksRegistry(); |
| 25 | 25 |
| 26 // Adds a suggested link from |extension_id|. Takes ownership of |item| in all | 26 // Adds a suggested link from |extension_id|. Takes ownership of |item| in all |
| 27 // cases. | 27 // cases. |
| 28 void Add(const std::string& extension_id, | 28 void Add(const std::string& extension_id, |
| 29 scoped_ptr<extensions::SuggestedLink> item); | 29 scoped_ptr<extensions::SuggestedLink> item); |
| 30 | 30 |
| 31 // Returns all the extension ids that have at least one suggestion. |
| 32 scoped_ptr<std::vector<std::string> > GetExtensionIds() const; |
| 33 |
| 31 // Returns all the links suggested by |extension_id|. | 34 // Returns all the links suggested by |extension_id|. |
| 32 const SuggestedLinkList* GetAll(const std::string& extension_id) const; | 35 const SuggestedLinkList* GetAll(const std::string& extension_id) const; |
| 33 | 36 |
| 34 // Remove a specific link suggested by |extension_id|. | 37 // Remove a specific link suggested by |extension_id|. |
| 35 void Remove(const std::string& extension_id, const std::string& link_url); | 38 void Remove(const std::string& extension_id, const std::string& link_url); |
| 36 | 39 |
| 37 // Clears all suggested links for |extension_id|. | 40 // Clears all suggested links for |extension_id|. |
| 38 void ClearAll(const std::string& extension_id); | 41 void ClearAll(const std::string& extension_id); |
| 39 | 42 |
| 40 private: | 43 private: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 51 // An empty list of suggestions that can be returned for non-existing | 54 // An empty list of suggestions that can be returned for non-existing |
| 52 // extensions. | 55 // extensions. |
| 53 SuggestedLinkList empty_list_; | 56 SuggestedLinkList empty_list_; |
| 54 | 57 |
| 55 DISALLOW_COPY_AND_ASSIGN(SuggestedLinksRegistry); | 58 DISALLOW_COPY_AND_ASSIGN(SuggestedLinksRegistry); |
| 56 }; | 59 }; |
| 57 | 60 |
| 58 } // namespace extensions | 61 } // namespace extensions |
| 59 | 62 |
| 60 #endif // CHROME_BROWSER_EXTENSIONS_API_DISCOVERY_SUGGESTED_LINKS_REGISTRY_H_ | 63 #endif // CHROME_BROWSER_EXTENSIONS_API_DISCOVERY_SUGGESTED_LINKS_REGISTRY_H_ |
| OLD | NEW |