OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** | 7 /** |
8 * @fileoverview This extension manages communications between Chrome, | 8 * @fileoverview This extension manages communications between Chrome, |
9 * Google.com pages and the Chrome Hotword extension. | 9 * Google.com pages and the Chrome Hotword extension. |
10 * | 10 * |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 168 |
169 // More URLs will be added in the future so leaving this as an array. | 169 // More URLs will be added in the future so leaving this as an array. |
170 var baseUrls = [ | 170 var baseUrls = [ |
171 'chrome://newtab' | 171 'chrome://newtab' |
172 ]; | 172 ]; |
173 var baseGoogleUrls = [ | 173 var baseGoogleUrls = [ |
174 'https://www.google.', | 174 'https://www.google.', |
175 'https://encrypted.google.' | 175 'https://encrypted.google.' |
176 ]; | 176 ]; |
177 var tlds = [ | 177 var tlds = [ |
178 'com', | 178 'com' |
179 'co.uk', | |
180 'de', | |
181 'fr', | |
182 'ru' | |
183 ]; | 179 ]; |
184 | 180 |
185 // Check URLs which do not have locale-based TLDs first. | 181 // Check URLs which do not have locale-based TLDs first. |
186 if (this.checkEligibleUrl(url, baseUrls[0])) | 182 if (this.checkEligibleUrl(url, baseUrls[0])) |
187 return true; | 183 return true; |
188 | 184 |
189 // Check URLs with each type of local-based TLD. | 185 // Check URLs with each type of local-based TLD. |
190 for (var i = 0; i < baseGoogleUrls.length; i++) { | 186 for (var i = 0; i < baseGoogleUrls.length; i++) { |
191 for (var j = 0; j < tlds.length; j++) { | 187 for (var j = 0; j < tlds.length; j++) { |
192 var base = baseGoogleUrls[i] + tlds[j]; | 188 var base = baseGoogleUrls[i] + tlds[j]; |
(...skipping 12 matching lines...) Expand all Loading... |
205 // TODO(rlp): Possibly remove the next line. It's proably not used, but | 201 // TODO(rlp): Possibly remove the next line. It's proably not used, but |
206 // leaving for now to be safe. We should remove it once all messsage | 202 // leaving for now to be safe. We should remove it once all messsage |
207 // relaying is removed form the content scripts. | 203 // relaying is removed form the content scripts. |
208 chrome.runtime.onMessage.addListener(this.handleMessage_.bind(this)); | 204 chrome.runtime.onMessage.addListener(this.handleMessage_.bind(this)); |
209 chrome.runtime.onMessageExternal.addListener( | 205 chrome.runtime.onMessageExternal.addListener( |
210 this.handleMessage_.bind(this)); | 206 this.handleMessage_.bind(this)); |
211 }; | 207 }; |
212 | 208 |
213 | 209 |
214 new OptInManager().initialize(); | 210 new OptInManager().initialize(); |
OLD | NEW |