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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 }; | 76 }; |
77 | 77 |
78 this.newTabPage = new function() { | 78 this.newTabPage = new function() { |
79 | 79 |
80 // ======================================================================= | 80 // ======================================================================= |
81 // Private functions | 81 // Private functions |
82 // ======================================================================= | 82 // ======================================================================= |
83 native function CheckIsUserSignedInToChromeAs(); | 83 native function CheckIsUserSignedInToChromeAs(); |
84 native function DeleteMostVisitedItem(); | 84 native function DeleteMostVisitedItem(); |
85 native function GetAppLauncherEnabled(); | 85 native function GetAppLauncherEnabled(); |
| 86 native function GetDispositionFromClick(); |
86 native function GetMostVisitedItems(); | 87 native function GetMostVisitedItems(); |
87 native function GetThemeBackgroundInfo(); | 88 native function GetThemeBackgroundInfo(); |
88 native function IsInputInProgress(); | 89 native function IsInputInProgress(); |
89 native function LogEvent(); | 90 native function LogEvent(); |
90 native function LogImpression(); | 91 native function LogMostVisitedImpression(); |
| 92 native function LogMostVisitedNavigation(); |
91 native function NavigateContentWindow(); | 93 native function NavigateContentWindow(); |
92 native function UndoAllMostVisitedDeletions(); | 94 native function UndoAllMostVisitedDeletions(); |
93 native function UndoMostVisitedDeletion(); | 95 native function UndoMostVisitedDeletion(); |
94 | 96 |
95 function GetMostVisitedItemsWrapper() { | 97 function GetMostVisitedItemsWrapper() { |
96 var mostVisitedItems = GetMostVisitedItems(); | 98 var mostVisitedItems = GetMostVisitedItems(); |
97 for (var i = 0, item; item = mostVisitedItems[i]; ++i) { | 99 for (var i = 0, item; item = mostVisitedItems[i]; ++i) { |
98 item.faviconUrl = GenerateFaviconURL(item.renderViewId, item.rid); | 100 item.faviconUrl = GenerateFaviconURL(item.renderViewId, item.rid); |
99 // These properties are private data and should not be returned to | 101 // These properties are private data and should not be returned to |
100 // the page. They are only accessible via getMostVisitedItemData(). | 102 // the page. They are only accessible via getMostVisitedItemData(). |
(...skipping 17 matching lines...) Expand all Loading... |
118 // ======================================================================= | 120 // ======================================================================= |
119 this.__defineGetter__('appLauncherEnabled', GetAppLauncherEnabled); | 121 this.__defineGetter__('appLauncherEnabled', GetAppLauncherEnabled); |
120 this.__defineGetter__('isInputInProgress', IsInputInProgress); | 122 this.__defineGetter__('isInputInProgress', IsInputInProgress); |
121 this.__defineGetter__('mostVisited', GetMostVisitedItemsWrapper); | 123 this.__defineGetter__('mostVisited', GetMostVisitedItemsWrapper); |
122 this.__defineGetter__('themeBackgroundInfo', GetThemeBackgroundInfo); | 124 this.__defineGetter__('themeBackgroundInfo', GetThemeBackgroundInfo); |
123 | 125 |
124 this.deleteMostVisitedItem = function(restrictedId) { | 126 this.deleteMostVisitedItem = function(restrictedId) { |
125 DeleteMostVisitedItem(restrictedId); | 127 DeleteMostVisitedItem(restrictedId); |
126 }; | 128 }; |
127 | 129 |
| 130 this.getDispositionFromClick = function(middle_button, |
| 131 alt_key, |
| 132 ctrl_key, |
| 133 meta_key, |
| 134 shift_key) { |
| 135 return GetDispositionFromClick(middle_button, |
| 136 alt_key, |
| 137 ctrl_key, |
| 138 meta_key, |
| 139 shift_key); |
| 140 }; |
| 141 |
128 this.checkIsUserSignedIntoChromeAs = function(identity) { | 142 this.checkIsUserSignedIntoChromeAs = function(identity) { |
129 CheckIsUserSignedInToChromeAs(identity); | 143 CheckIsUserSignedInToChromeAs(identity); |
130 }; | 144 }; |
131 | 145 |
132 // This method is restricted to chrome-search://most-visited pages by | 146 // This method is restricted to chrome-search://most-visited pages by |
133 // checking the invoking context's origin in searchbox_extension.cc. | 147 // checking the invoking context's origin in searchbox_extension.cc. |
134 this.logEvent = function(histogram_name) { | 148 this.logEvent = function(histogram_name) { |
135 LogEvent(histogram_name); | 149 LogEvent(histogram_name); |
136 }; | 150 }; |
137 | 151 |
138 // This method is restricted to chrome-search://most-visited pages by | 152 // This method is restricted to chrome-search://most-visited pages by |
139 // checking the invoking context's origin in searchbox_extension.cc. | 153 // checking the invoking context's origin in searchbox_extension.cc. |
140 this.logImpression = function(position, provider) { | 154 this.logMostVisitedImpression = function(position, provider) { |
141 LogImpression(position, provider); | 155 LogMostVisitedImpression(position, provider); |
| 156 }; |
| 157 |
| 158 // This method is restricted to chrome-search://most-visited pages by |
| 159 // checking the invoking context's origin in searchbox_extension.cc. |
| 160 this.logMostVisitedNavigation = function(position, provider) { |
| 161 LogMostVisitedNavigation(position, provider); |
142 }; | 162 }; |
143 | 163 |
144 this.navigateContentWindow = function(destination, disposition) { | 164 this.navigateContentWindow = function(destination, disposition) { |
145 NavigateContentWindow(destination, disposition); | 165 NavigateContentWindow(destination, disposition); |
146 }; | 166 }; |
147 | 167 |
148 this.undoAllMostVisitedDeletions = function() { | 168 this.undoAllMostVisitedDeletions = function() { |
149 UndoAllMostVisitedDeletions(); | 169 UndoAllMostVisitedDeletions(); |
150 }; | 170 }; |
151 | 171 |
152 this.undoMostVisitedDeletion = function(restrictedId) { | 172 this.undoMostVisitedDeletion = function(restrictedId) { |
153 UndoMostVisitedDeletion(restrictedId); | 173 UndoMostVisitedDeletion(restrictedId); |
154 }; | 174 }; |
155 | 175 |
156 this.onsignedincheckdone = null; | 176 this.onsignedincheckdone = null; |
157 this.oninputcancel = null; | 177 this.oninputcancel = null; |
158 this.oninputstart = null; | 178 this.oninputstart = null; |
159 this.onmostvisitedchange = null; | 179 this.onmostvisitedchange = null; |
160 this.onthemechange = null; | 180 this.onthemechange = null; |
161 }; | 181 }; |
162 | 182 |
163 // TODO(jered): Remove when google no longer expects this object. | 183 // TODO(jered): Remove when google no longer expects this object. |
164 chrome.searchBox = this.searchBox; | 184 chrome.searchBox = this.searchBox; |
165 }; | 185 }; |
166 } | 186 } |
OLD | NEW |