Chromium Code Reviews| Index: chrome/renderer/searchbox/searchbox_extension.cc |
| diff --git a/chrome/renderer/searchbox/searchbox_extension.cc b/chrome/renderer/searchbox/searchbox_extension.cc |
| index 17e7bf15a118c7bc1cc64b0afbdc8239a520900a..5dac68e71fa6b221d9002715f9bec734417a3404 100644 |
| --- a/chrome/renderer/searchbox/searchbox_extension.cc |
| +++ b/chrome/renderer/searchbox/searchbox_extension.cc |
| @@ -152,8 +152,30 @@ v8::Local<v8::Object> GenerateMostVisitedItem( |
| v8::Int32::New(isolate, render_view_id)); |
| obj->Set(v8::String::NewFromUtf8(isolate, "rid"), |
| v8::Int32::New(isolate, restricted_id)); |
| - obj->Set(v8::String::NewFromUtf8(isolate, "thumbnailUrl"), |
| - GenerateThumbnailURL(isolate, render_view_id, restricted_id)); |
| + |
| + // If the suggestion already has a suggested thumbnail, we create an thumbnail |
| + // array with both the local thumbnail and the proposed one. |
| + // Otherwise, we just create an array with the generated one. |
| + if (!mv_item.thumbnail.spec().empty()) { |
| + v8::Local<v8::Array> thumbs = v8::Array::New(isolate, 2); |
| + thumbs->Set(0, UTF8ToV8String(isolate, base::StringPrintf( |
|
kmadhusu
2015/07/31 21:05:45
nit: Create a helper function to generate this thu
fserb
2015/08/05 14:56:26
Done.
|
| + "chrome-search://thumb2/%s", |
| + mv_item.url.spec().c_str()))); |
| + thumbs->Set(1, UTF8ToV8String(isolate, mv_item.thumbnail.spec())); |
| + obj->Set(v8::String::NewFromUtf8(isolate, "thumbnailUrls"), thumbs); |
| + } else { |
| + v8::Local<v8::Array> thumbs = v8::Array::New(isolate, 1); |
| + thumbs->Set(0, |
| + GenerateThumbnailURL(isolate, render_view_id, restricted_id)); |
| + obj->Set(v8::String::NewFromUtf8(isolate, "thumbnailUrls"), thumbs); |
| + } |
| + |
| + // If the suggestion already has a favicon, we populate the element with it. |
| + if (!mv_item.favicon.spec().empty()) { |
| + obj->Set(v8::String::NewFromUtf8(isolate, "faviconUrl"), |
| + UTF8ToV8String(isolate, mv_item.favicon.spec())); |
| + } |
| + |
| if (IsIconNTPEnabled()) { |
| // Update website http://www.chromium.org/embeddedsearch when we make this |
| // permanent. |