Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DISCOVERY_EXTENSION_SUGGESTED_LINKS_MANAGE R_H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_DISCOVERY_EXTENSION_SUGGESTED_LINKS_MANAGE R_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <map> | |
| 10 | |
| 11 #include "chrome/browser/extensions/api/discovery/extension_suggested_link.h" | |
| 12 #include "chrome/browser/profiles/profile_keyed_service.h" | |
| 13 #include "content/public/browser/browser_thread.h" | |
| 14 | |
| 15 // This class keeps track of links suggested by an extension using the discovery | |
| 16 // API. | |
| 17 class ExtensionSuggestedLinksManager | |
|
Aaron Boodman
2012/05/15 00:07:43
extensions::SuggestedLinkManager. Also rename file
beaudoin
2012/05/16 16:56:16
Done.
| |
| 18 : public ProfileKeyedService { | |
| 19 public: | |
| 20 ExtensionSuggestedLinksManager(); | |
| 21 | |
| 22 // Takes ownership of |item| in all cases. | |
| 23 void Add(const std::string& extension_id, ExtensionSuggestedLink* item); | |
|
Aaron Boodman
2012/05/15 00:07:43
You can declare item as scoped_ptr<ExtensionSugges
beaudoin
2012/05/16 16:56:16
Not sure I did that correctly, in particular I'm n
Aaron Boodman
2012/05/17 00:05:29
release() is appropriate here. Pass() is for when
| |
| 24 | |
| 25 const ExtensionSuggestedLinkList* GetAll( | |
|
Aaron Boodman
2012/05/15 00:07:43
Comment.
beaudoin
2012/05/16 16:56:16
Done.
| |
| 26 const std::string& extension_id) const; | |
| 27 | |
| 28 void Clear(const std::string& extension_id, const std::string& linkUrl); | |
|
Aaron Boodman
2012/05/15 00:07:43
Comment.
Aaron Boodman
2012/05/15 00:07:43
link_url
beaudoin
2012/05/16 16:56:16
Done.
beaudoin
2012/05/16 16:56:16
Done.
| |
| 29 | |
| 30 // Clears all suggested links for |extension_id|. | |
| 31 void ClearAll(const std::string& extension_id); | |
| 32 | |
| 33 private: | |
| 34 // Maps extension id to a list of notifications for that extension. | |
| 35 typedef std::map<std::string, ExtensionSuggestedLinkList> SuggestedLinksMap; | |
| 36 | |
| 37 virtual ~ExtensionSuggestedLinksManager(); | |
| 38 | |
| 39 // Gets suggested links for a given extension id. | |
| 40 ExtensionSuggestedLinkList& GetAllInternal(const std::string& extension_id); | |
| 41 | |
| 42 SuggestedLinksMap suggested_links_; | |
| 43 | |
| 44 DISALLOW_COPY_AND_ASSIGN(ExtensionSuggestedLinksManager); | |
| 45 }; | |
| 46 | |
| 47 #endif // CHROME_BROWSER_EXTENSIONS_API_DISCOVERY_EXTENSION_SUGGESTED_LINKS_MAN AGER_H_ | |
| OLD | NEW |