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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
9 #include "base/json/string_escape.h" | 9 #include "base/json/string_escape.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 v8::Local<v8::String> GenerateThumbnailURL( | 110 v8::Local<v8::String> GenerateThumbnailURL( |
111 v8::Isolate* isolate, | 111 v8::Isolate* isolate, |
112 int render_view_id, | 112 int render_view_id, |
113 InstantRestrictedID most_visited_item_id) { | 113 InstantRestrictedID most_visited_item_id) { |
114 return UTF8ToV8String( | 114 return UTF8ToV8String( |
115 isolate, | 115 isolate, |
116 base::StringPrintf( | 116 base::StringPrintf( |
117 "chrome-search://thumb/%d/%d", render_view_id, most_visited_item_id)); | 117 "chrome-search://thumb/%d/%d", render_view_id, most_visited_item_id)); |
118 } | 118 } |
119 | 119 |
120 v8::Local<v8::String> GenerateThumb2URL(v8::Isolate* isolate, std::string url) { | 120 v8::Local<v8::String> GenerateThumb2URL(v8::Isolate* isolate, |
| 121 const std::string& url) { |
121 return UTF8ToV8String( | 122 return UTF8ToV8String( |
122 isolate, base::StringPrintf("chrome-search://thumb2/%s", url.c_str())); | 123 isolate, base::StringPrintf("chrome-search://thumb2/%s", url.c_str())); |
123 } | 124 } |
124 | 125 |
125 // Populates a Javascript MostVisitedItem object from |mv_item|. | 126 // Populates a Javascript MostVisitedItem object from |mv_item|. |
126 // NOTE: Includes "url", "title" and "domain" which are private data, so should | 127 // NOTE: Includes "url", "title" and "domain" which are private data, so should |
127 // not be returned to the Instant page. These should be erased before returning | 128 // not be returned to the Instant page. These should be erased before returning |
128 // the object. See GetMostVisitedItemsWrapper() in searchbox_api.js. | 129 // the object. See GetMostVisitedItemsWrapper() in searchbox_api.js. |
129 v8::Local<v8::Object> GenerateMostVisitedItem( | 130 v8::Local<v8::Object> GenerateMostVisitedItem( |
130 v8::Isolate* isolate, | 131 v8::Isolate* isolate, |
(...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1308 if (!render_view) return; | 1309 if (!render_view) return; |
1309 | 1310 |
1310 bool display_instant_results = | 1311 bool display_instant_results = |
1311 SearchBox::Get(render_view)->display_instant_results(); | 1312 SearchBox::Get(render_view)->display_instant_results(); |
1312 DVLOG(1) << render_view << " GetDisplayInstantResults" << | 1313 DVLOG(1) << render_view << " GetDisplayInstantResults" << |
1313 display_instant_results; | 1314 display_instant_results; |
1314 args.GetReturnValue().Set(display_instant_results); | 1315 args.GetReturnValue().Set(display_instant_results); |
1315 } | 1316 } |
1316 | 1317 |
1317 } // namespace extensions_v8 | 1318 } // namespace extensions_v8 |
OLD | NEW |