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 var chrome; | 5 var chrome; |
6 if (!chrome) | 6 if (!chrome) |
7 chrome = {}; | 7 chrome = {}; |
8 | 8 |
9 if (!chrome.embeddedSearch) { | 9 if (!chrome.embeddedSearch) { |
10 chrome.embeddedSearch = new function() { | 10 chrome.embeddedSearch = new function() { |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 // ======================================================================= | 251 // ======================================================================= |
252 // Private functions | 252 // Private functions |
253 // ======================================================================= | 253 // ======================================================================= |
254 native function GetMostVisitedItems(); | 254 native function GetMostVisitedItems(); |
255 native function GetThemeBackgroundInfo(); | 255 native function GetThemeBackgroundInfo(); |
256 native function DeleteMostVisitedItem(); | 256 native function DeleteMostVisitedItem(); |
257 native function UndoAllMostVisitedDeletions(); | 257 native function UndoAllMostVisitedDeletions(); |
258 native function UndoMostVisitedDeletion(); | 258 native function UndoMostVisitedDeletion(); |
259 native function NavigateNewTabPage(); | 259 native function NavigateNewTabPage(); |
260 native function IsInputInProgress(); | 260 native function IsInputInProgress(); |
| 261 native function LogEvent(); |
261 | 262 |
262 function GetMostVisitedItemsWrapper() { | 263 function GetMostVisitedItemsWrapper() { |
263 var mostVisitedItems = GetMostVisitedItems(); | 264 var mostVisitedItems = GetMostVisitedItems(); |
264 for (var i = 0, item; item = mostVisitedItems[i]; ++i) { | 265 for (var i = 0, item; item = mostVisitedItems[i]; ++i) { |
265 // These properties are private data and should not be returned to | 266 // These properties are private data and should not be returned to |
266 // the page. They are only accessible via getMostVisitedItemData(). | 267 // the page. They are only accessible via getMostVisitedItemData(). |
267 item.url = null; | 268 item.url = null; |
268 item.title = null; | 269 item.title = null; |
269 item.domain = null; | 270 item.domain = null; |
270 item.direction = null; | 271 item.direction = null; |
(...skipping 12 matching lines...) Expand all Loading... |
283 DeleteMostVisitedItem(restrictedId); | 284 DeleteMostVisitedItem(restrictedId); |
284 }; | 285 }; |
285 this.undoAllMostVisitedDeletions = function() { | 286 this.undoAllMostVisitedDeletions = function() { |
286 UndoAllMostVisitedDeletions(); | 287 UndoAllMostVisitedDeletions(); |
287 }; | 288 }; |
288 this.undoMostVisitedDeletion = function(restrictedId) { | 289 this.undoMostVisitedDeletion = function(restrictedId) { |
289 UndoMostVisitedDeletion(restrictedId); | 290 UndoMostVisitedDeletion(restrictedId); |
290 }; | 291 }; |
291 this.navigateContentWindow = function(destination, disposition) { | 292 this.navigateContentWindow = function(destination, disposition) { |
292 NavigateNewTabPage(destination, disposition); | 293 NavigateNewTabPage(destination, disposition); |
293 } | 294 }; |
| 295 // This method is restricted to chrome-search://most-visited pages by |
| 296 // checking the invoking context's origin in searchbox_extension.cc. |
| 297 this.logEvent = function(name, value, opt_boundary) { |
| 298 LogEvent(name, value, opt_boundary); |
| 299 }; |
294 | 300 |
295 this.onmostvisitedchange = null; | 301 this.onmostvisitedchange = null; |
296 this.onthemechange = null; | 302 this.onthemechange = null; |
297 this.oninputstart = null; | 303 this.oninputstart = null; |
298 this.oninputcancel = null; | 304 this.oninputcancel = null; |
299 }; | 305 }; |
300 | 306 |
301 // Export legacy searchbox API. | 307 // Export legacy searchbox API. |
302 // TODO: Remove this when Instant Extended is fully launched. | 308 // TODO: Remove this when Instant Extended is fully launched. |
303 chrome.searchBox = this.searchBox; | 309 chrome.searchBox = this.searchBox; |
304 }; | 310 }; |
305 } | 311 } |
OLD | NEW |