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

Side by Side Diff: chrome/renderer/searchbox/searchbox_extension.cc

Issue 1010783002: [Icons NTP] Working prototype to fetch, store, and display big icons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweaks and unit test fix. Created 5 years, 9 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
« no previous file with comments | « chrome/renderer/searchbox/searchbox.cc ('k') | chrome/renderer/searchbox/searchbox_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/json/string_escape.h" 8 #include "base/json/string_escape.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 if (title.empty()) 157 if (title.empty())
158 title = base::UTF8ToUTF16(mv_item.url.spec()); 158 title = base::UTF8ToUTF16(mv_item.url.spec());
159 159
160 v8::Handle<v8::Object> obj = v8::Object::New(isolate); 160 v8::Handle<v8::Object> obj = v8::Object::New(isolate);
161 obj->Set(v8::String::NewFromUtf8(isolate, "renderViewId"), 161 obj->Set(v8::String::NewFromUtf8(isolate, "renderViewId"),
162 v8::Int32::New(isolate, render_view_id)); 162 v8::Int32::New(isolate, render_view_id));
163 obj->Set(v8::String::NewFromUtf8(isolate, "rid"), 163 obj->Set(v8::String::NewFromUtf8(isolate, "rid"),
164 v8::Int32::New(isolate, restricted_id)); 164 v8::Int32::New(isolate, restricted_id));
165 obj->Set(v8::String::NewFromUtf8(isolate, "thumbnailUrl"), 165 obj->Set(v8::String::NewFromUtf8(isolate, "thumbnailUrl"),
166 GenerateThumbnailURL(isolate, render_view_id, restricted_id)); 166 GenerateThumbnailURL(isolate, render_view_id, restricted_id));
167 obj->Set(v8::String::NewFromUtf8(isolate, "isIconNtpEnabled"),
168 UTF8ToV8String(isolate, IsIconNTPEnabled() ? "true" : "false"));
167 if (IsIconNTPEnabled()) { 169 if (IsIconNTPEnabled()) {
168 // Update website http://www.chromium.org/embeddedsearch when we make this 170 // Update website http://www.chromium.org/embeddedsearch when we make this
169 // permanent. 171 // permanent.
170 obj->Set(v8::String::NewFromUtf8(isolate, "largeIconUrl"), 172 obj->Set(v8::String::NewFromUtf8(isolate, "largeIconUrl"),
171 GenerateLargeIconURL(isolate, render_view_id, restricted_id)); 173 GenerateLargeIconURL(isolate, render_view_id, restricted_id));
172 obj->Set(v8::String::NewFromUtf8(isolate, "fallbackIconUrl"), 174 obj->Set(v8::String::NewFromUtf8(isolate, "fallbackIconUrl"),
173 GenerateFallbackIconURL(isolate, render_view_id, restricted_id)); 175 GenerateFallbackIconURL(isolate, render_view_id, restricted_id));
174 } 176 }
175 obj->Set(v8::String::NewFromUtf8(isolate, "title"), 177 obj->Set(v8::String::NewFromUtf8(isolate, "title"),
176 UTF16ToV8String(isolate, title)); 178 UTF16ToV8String(isolate, title));
(...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 if (!render_view) return; 1282 if (!render_view) return;
1281 1283
1282 bool display_instant_results = 1284 bool display_instant_results =
1283 SearchBox::Get(render_view)->display_instant_results(); 1285 SearchBox::Get(render_view)->display_instant_results();
1284 DVLOG(1) << render_view << " GetDisplayInstantResults" << 1286 DVLOG(1) << render_view << " GetDisplayInstantResults" <<
1285 display_instant_results; 1287 display_instant_results;
1286 args.GetReturnValue().Set(display_instant_results); 1288 args.GetReturnValue().Set(display_instant_results);
1287 } 1289 }
1288 1290
1289 } // namespace extensions_v8 1291 } // namespace extensions_v8
OLDNEW
« no previous file with comments | « chrome/renderer/searchbox/searchbox.cc ('k') | chrome/renderer/searchbox/searchbox_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698