| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/renderer/searchbox/searchbox_extension.h" | 5 #include "chrome/renderer/searchbox/searchbox_extension.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 thumbs->Set(0, | 176 thumbs->Set(0, |
| 177 GenerateThumbnailURL(isolate, render_view_id, restricted_id)); | 177 GenerateThumbnailURL(isolate, render_view_id, restricted_id)); |
| 178 obj->Set(v8::String::NewFromUtf8(isolate, "thumbnailUrls"), thumbs); | 178 obj->Set(v8::String::NewFromUtf8(isolate, "thumbnailUrls"), thumbs); |
| 179 } | 179 } |
| 180 | 180 |
| 181 // If the suggestion already has a favicon, we populate the element with it. | 181 // If the suggestion already has a favicon, we populate the element with it. |
| 182 if (!mv_item.favicon.spec().empty()) { | 182 if (!mv_item.favicon.spec().empty()) { |
| 183 obj->Set(v8::String::NewFromUtf8(isolate, "faviconUrl"), | 183 obj->Set(v8::String::NewFromUtf8(isolate, "faviconUrl"), |
| 184 UTF8ToV8String(isolate, mv_item.favicon.spec())); | 184 UTF8ToV8String(isolate, mv_item.favicon.spec())); |
| 185 } | 185 } |
| 186 // If the suggestion has an impression url, we populate the element with it. | |
| 187 if (!mv_item.impression_url.spec().empty()) { | |
| 188 obj->Set(v8::String::NewFromUtf8(isolate, "impressionUrl"), | |
| 189 UTF8ToV8String(isolate, mv_item.impression_url.spec())); | |
| 190 } | |
| 191 // If the suggestion has a click url, we populate the element with it. | |
| 192 if (!mv_item.click_url.spec().empty()) { | |
| 193 obj->Set(v8::String::NewFromUtf8(isolate, "pingUrl"), | |
| 194 UTF8ToV8String(isolate, mv_item.click_url.spec())); | |
| 195 } | |
| 196 | 186 |
| 197 if (IsIconNTPEnabled()) { | 187 if (IsIconNTPEnabled()) { |
| 198 // Update website http://www.chromium.org/embeddedsearch when we make this | 188 // Update website http://www.chromium.org/embeddedsearch when we make this |
| 199 // permanent. | 189 // permanent. |
| 200 // Large icon size is 48px * window.devicePixelRatio. This is easier to set | 190 // Large icon size is 48px * window.devicePixelRatio. This is easier to set |
| 201 // from JS, where IsIconNTPEnabled() is not available. So we add stubs | 191 // from JS, where IsIconNTPEnabled() is not available. So we add stubs |
| 202 // here, and let JS fill in details. | 192 // here, and let JS fill in details. |
| 203 obj->Set(v8::String::NewFromUtf8(isolate, "largeIconUrl"), | 193 obj->Set(v8::String::NewFromUtf8(isolate, "largeIconUrl"), |
| 204 v8::String::NewFromUtf8(isolate, "chrome-search://large-icon/")); | 194 v8::String::NewFromUtf8(isolate, "chrome-search://large-icon/")); |
| 205 obj->Set(v8::String::NewFromUtf8(isolate, "fallbackIconUrl"), | 195 obj->Set(v8::String::NewFromUtf8(isolate, "fallbackIconUrl"), |
| (...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1114 ThrowInvalidParameters(args); | 1104 ThrowInvalidParameters(args); |
| 1115 return; | 1105 return; |
| 1116 } | 1106 } |
| 1117 | 1107 |
| 1118 DVLOG(1) << render_view << " UndoMostVisitedDeletion"; | 1108 DVLOG(1) << render_view << " UndoMostVisitedDeletion"; |
| 1119 SearchBox::Get(render_view) | 1109 SearchBox::Get(render_view) |
| 1120 ->UndoMostVisitedDeletion(args[0]->ToInteger()->Value()); | 1110 ->UndoMostVisitedDeletion(args[0]->ToInteger()->Value()); |
| 1121 } | 1111 } |
| 1122 | 1112 |
| 1123 } // namespace extensions_v8 | 1113 } // namespace extensions_v8 |
| OLD | NEW |