Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: chrome/browser/search_engines/template_url_prepopulate_data.cc

Issue 10107009: Revert 132479 - Transmit a X-Chrome-UMA-Enabled bit to Google domains from clients that have UMA en… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/protector/protector_service.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/browser/search_engines/template_url_prepopulate_data.h" 5 #include "chrome/browser/search_engines/template_url_prepopulate_data.h"
6 6
7 #if defined(OS_POSIX) && !defined(OS_MACOSX) 7 #if defined(OS_POSIX) && !defined(OS_MACOSX)
8 #include <locale.h> 8 #include <locale.h>
9 #endif 9 #endif
10 10
(...skipping 3263 matching lines...) Expand 10 before | Expand all | Expand 10 after
3274 // and thus won't ever string-compare successfully against |url|. 3274 // and thus won't ever string-compare successfully against |url|.
3275 return (url == google.search_url) ? &google : NULL; 3275 return (url == google.search_url) ? &google : NULL;
3276 } 3276 }
3277 3277
3278 // For all other cases, check using origins, in order to more aggressively 3278 // For all other cases, check using origins, in order to more aggressively
3279 // match search engine types for data imported from other browsers. 3279 // match search engine types for data imported from other browsers.
3280 // 3280 //
3281 // First special-case Google, because the prepopulate URL for it will not 3281 // First special-case Google, because the prepopulate URL for it will not
3282 // convert to a GURL and thus won't have an origin. Instead see if the 3282 // convert to a GURL and thus won't have an origin. Instead see if the
3283 // incoming URL's host is "[*.]google.<TLD>". 3283 // incoming URL's host is "[*.]google.<TLD>".
3284 if (google_util::IsGoogleHostname(as_gurl.host(), 3284 if (google_util::IsGoogleHostname(as_gurl.host()))
3285 google_util::DISALLOW_SUBDOMAIN)) {
3286 return &google; 3285 return &google;
3287 }
3288 3286
3289 // Now check the rest of the prepopulate data. 3287 // Now check the rest of the prepopulate data.
3290 GURL origin(as_gurl.GetOrigin()); 3288 GURL origin(as_gurl.GetOrigin());
3291 for (size_t i = 0; i < arraysize(kAllEngines); ++i) { 3289 for (size_t i = 0; i < arraysize(kAllEngines); ++i) {
3292 GURL engine_url(kAllEngines[i]->search_url); 3290 GURL engine_url(kAllEngines[i]->search_url);
3293 if (engine_url.is_valid() && (origin == engine_url.GetOrigin())) 3291 if (engine_url.is_valid() && (origin == engine_url.GetOrigin()))
3294 return kAllEngines[i]; 3292 return kAllEngines[i];
3295 } 3293 }
3296 3294
3297 return NULL; 3295 return NULL;
3298 } 3296 }
3299 3297
3300 string16 GetEngineName(const std::string& url) { 3298 string16 GetEngineName(const std::string& url) {
3301 const PrepopulatedEngine* engine = GetEngineForURL(url); 3299 const PrepopulatedEngine* engine = GetEngineForURL(url);
3302 if (engine) 3300 if (engine)
3303 return WideToUTF16(engine->name); 3301 return WideToUTF16(engine->name);
3304 GURL as_gurl(url); 3302 GURL as_gurl(url);
3305 return (as_gurl.is_valid() && !as_gurl.host().empty()) ? 3303 return (as_gurl.is_valid() && !as_gurl.host().empty()) ?
3306 UTF8ToUTF16(as_gurl.host()) : 3304 UTF8ToUTF16(as_gurl.host()) :
3307 l10n_util::GetStringUTF16(IDS_UNKNOWN_SEARCH_ENGINE_NAME); 3305 l10n_util::GetStringUTF16(IDS_UNKNOWN_SEARCH_ENGINE_NAME);
3308 } 3306 }
3309 3307
3310 SearchEngineType GetEngineType(const std::string& url) { 3308 SearchEngineType GetEngineType(const std::string& url) {
3311 const PrepopulatedEngine* engine = GetEngineForURL(url); 3309 const PrepopulatedEngine* engine = GetEngineForURL(url);
3312 return engine ? engine->type : SEARCH_ENGINE_OTHER; 3310 return engine ? engine->type : SEARCH_ENGINE_OTHER;
3313 } 3311 }
3314 3312
3315 } // namespace TemplateURLPrepopulateData 3313 } // namespace TemplateURLPrepopulateData
OLDNEW
« no previous file with comments | « chrome/browser/protector/protector_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698