Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Unified Diff: chrome/browser/ui/webui/ntp/suggestions_combiner.cc

Issue 10438004: Hooking the discovery API to the NTP. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added OWNERS for experimental discovery api. Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/ntp/suggestions_combiner.cc
diff --git a/chrome/browser/ui/webui/ntp/suggestions_combiner.cc b/chrome/browser/ui/webui/ntp/suggestions_combiner.cc
index cdc71b3534a3f55c565819413cd47cf95cf584c6..0e6137ca1b8e7fe3fb387ec64248a5c1d7e0b442 100644
--- a/chrome/browser/ui/webui/ntp/suggestions_combiner.cc
+++ b/chrome/browser/ui/webui/ntp/suggestions_combiner.cc
@@ -7,6 +7,8 @@
#include <algorithm>
#include "base/values.h"
+#include "chrome/browser/extensions/api/discovery/suggested_links_registry.h"
+#include "chrome/browser/extensions/api/discovery/suggested_links_registry_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/ntp/suggestions_page_handler.h"
#include "chrome/browser/ui/webui/ntp/suggestions_source.h"
@@ -61,10 +63,18 @@ void SuggestionsCombiner::SetSuggestionsCount(size_t suggestions_count) {
// static
SuggestionsCombiner* SuggestionsCombiner::Create(
- SuggestionsCombiner::Delegate* delegate) {
+ SuggestionsCombiner::Delegate* delegate, Profile* profile) {
SuggestionsCombiner* combiner = new SuggestionsCombiner(delegate);
combiner->AddSource(new SuggestionsSourceTopSites());
- combiner->AddSource(new SuggestionsSourceDiscovery());
+
+ extensions::SuggestedLinksRegistry* registry =
+ extensions::SuggestedLinksRegistryFactory::GetForProfile(profile);
+ scoped_ptr<std::vector<std::string> > list = registry->GetExtensionIds();
+ for (std::vector<std::string>::iterator it = list->begin();
+ it != list->end(); ++it) {
+ combiner->AddSource(new SuggestionsSourceDiscovery(*it));
+ }
+
return combiner;
}
« no previous file with comments | « chrome/browser/ui/webui/ntp/suggestions_combiner.h ('k') | chrome/browser/ui/webui/ntp/suggestions_page_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698