Chromium Code Reviews| Index: chrome/browser/extensions/api/discovery/extension_suggested_links_manager.h |
| diff --git a/chrome/browser/extensions/api/discovery/extension_suggested_links_manager.h b/chrome/browser/extensions/api/discovery/extension_suggested_links_manager.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e4d62cd95715a964ce323730cf08f1d937603e02 |
| --- /dev/null |
| +++ b/chrome/browser/extensions/api/discovery/extension_suggested_links_manager.h |
| @@ -0,0 +1,47 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_EXTENSIONS_API_DISCOVERY_EXTENSION_SUGGESTED_LINKS_MANAGER_H_ |
| +#define CHROME_BROWSER_EXTENSIONS_API_DISCOVERY_EXTENSION_SUGGESTED_LINKS_MANAGER_H_ |
| +#pragma once |
| + |
| +#include <map> |
| + |
| +#include "chrome/browser/extensions/api/discovery/extension_suggested_link.h" |
| +#include "chrome/browser/profiles/profile_keyed_service.h" |
| +#include "content/public/browser/browser_thread.h" |
| + |
| +// This class keeps track of links suggested by an extension using the discovery |
| +// API. |
| +class ExtensionSuggestedLinksManager |
|
Aaron Boodman
2012/05/15 00:07:43
extensions::SuggestedLinkManager. Also rename file
beaudoin
2012/05/16 16:56:16
Done.
|
| + : public ProfileKeyedService { |
| + public: |
| + ExtensionSuggestedLinksManager(); |
| + |
| + // Takes ownership of |item| in all cases. |
| + 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
|
| + |
| + const ExtensionSuggestedLinkList* GetAll( |
|
Aaron Boodman
2012/05/15 00:07:43
Comment.
beaudoin
2012/05/16 16:56:16
Done.
|
| + const std::string& extension_id) const; |
| + |
| + 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.
|
| + |
| + // Clears all suggested links for |extension_id|. |
| + void ClearAll(const std::string& extension_id); |
| + |
| + private: |
| + // Maps extension id to a list of notifications for that extension. |
| + typedef std::map<std::string, ExtensionSuggestedLinkList> SuggestedLinksMap; |
| + |
| + virtual ~ExtensionSuggestedLinksManager(); |
| + |
| + // Gets suggested links for a given extension id. |
| + ExtensionSuggestedLinkList& GetAllInternal(const std::string& extension_id); |
| + |
| + SuggestedLinksMap suggested_links_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ExtensionSuggestedLinksManager); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_EXTENSIONS_API_DISCOVERY_EXTENSION_SUGGESTED_LINKS_MANAGER_H_ |