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

Side by Side Diff: chrome/browser/ui/webui/ntp/suggestions_source_discovery.cc

Issue 10647003: Discovery API supports specifying a tile in a URL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed nits Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "chrome/browser/ui/webui/ntp/suggestions_source_discovery.h" 5 #include "chrome/browser/ui/webui/ntp/suggestions_source_discovery.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 const SuggestedLinkList* list = registry->GetAll(extension_id_); 69 const SuggestedLinkList* list = registry->GetAll(extension_id_);
70 70
71 items_.clear(); 71 items_.clear();
72 for (SuggestedLinkList::const_iterator it = list->begin(); 72 for (SuggestedLinkList::const_iterator it = list->begin();
73 it != list->end(); ++it) { 73 it != list->end(); ++it) {
74 DictionaryValue* page_value = new DictionaryValue(); 74 DictionaryValue* page_value = new DictionaryValue();
75 NewTabUI::SetURLTitleAndDirection(page_value, 75 NewTabUI::SetURLTitleAndDirection(page_value,
76 ASCIIToUTF16((*it)->link_text()), 76 ASCIIToUTF16((*it)->link_text()),
77 GURL((*it)->link_url())); 77 GURL((*it)->link_url()));
78 page_value->SetDouble("score", (*it)->score()); 78 page_value->SetDouble("score", (*it)->score());
79 const std::string& url_image = (*it)->url_image();
80 if (url_image.length() > 0)
81 page_value->SetString("urlImage", url_image);
79 items_.push_back(page_value); 82 items_.push_back(page_value);
80 } 83 }
81 combiner_->OnItemsReady(); 84 combiner_->OnItemsReady();
82 } 85 }
83 86
84 void SuggestionsSourceDiscovery::SetCombiner(SuggestionsCombiner* combiner) { 87 void SuggestionsSourceDiscovery::SetCombiner(SuggestionsCombiner* combiner) {
85 DCHECK(!combiner_); 88 DCHECK(!combiner_);
86 combiner_ = combiner; 89 combiner_ = combiner;
87 } 90 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/ntp4/suggestions_page.js ('k') | chrome/common/extensions/api/experimental_discovery.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698