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 #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 Loading... |
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 } |
OLD | NEW |