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