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

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

Issue 10264023: Revert 134625 - 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, 7 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/renderer_host/chrome_resource_dispatcher_host_delegate.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 3266 matching lines...) Expand 10 before | Expand all | Expand 10 after
3277 // and thus won't ever string-compare successfully against |url|. 3277 // and thus won't ever string-compare successfully against |url|.
3278 return (url == google.search_url) ? &google : NULL; 3278 return (url == google.search_url) ? &google : NULL;
3279 } 3279 }
3280 3280
3281 // For all other cases, check using origins, in order to more aggressively 3281 // For all other cases, check using origins, in order to more aggressively
3282 // match search engine types for data imported from other browsers. 3282 // match search engine types for data imported from other browsers.
3283 // 3283 //
3284 // First special-case Google, because the prepopulate URL for it will not 3284 // First special-case Google, because the prepopulate URL for it will not
3285 // convert to a GURL and thus won't have an origin. Instead see if the 3285 // convert to a GURL and thus won't have an origin. Instead see if the
3286 // incoming URL's host is "[*.]google.<TLD>". 3286 // incoming URL's host is "[*.]google.<TLD>".
3287 if (google_util::IsGoogleHostname(as_gurl.host(), 3287 if (google_util::IsGoogleHostname(as_gurl.host()))
3288 google_util::DISALLOW_SUBDOMAIN))
3289 return &google; 3288 return &google;
3290 3289
3291 // Now check the rest of the prepopulate data. 3290 // Now check the rest of the prepopulate data.
3292 GURL origin(as_gurl.GetOrigin()); 3291 GURL origin(as_gurl.GetOrigin());
3293 for (size_t i = 0; i < arraysize(kAllEngines); ++i) { 3292 for (size_t i = 0; i < arraysize(kAllEngines); ++i) {
3294 GURL engine_url(kAllEngines[i]->search_url); 3293 GURL engine_url(kAllEngines[i]->search_url);
3295 if (engine_url.is_valid() && (origin == engine_url.GetOrigin())) 3294 if (engine_url.is_valid() && (origin == engine_url.GetOrigin()))
3296 return kAllEngines[i]; 3295 return kAllEngines[i];
3297 } 3296 }
3298 3297
3299 return NULL; 3298 return NULL;
3300 } 3299 }
3301 3300
3302 string16 GetEngineName(const std::string& url) { 3301 string16 GetEngineName(const std::string& url) {
3303 const PrepopulatedEngine* engine = GetEngineForURL(url); 3302 const PrepopulatedEngine* engine = GetEngineForURL(url);
3304 if (engine) 3303 if (engine)
3305 return WideToUTF16(engine->name); 3304 return WideToUTF16(engine->name);
3306 GURL as_gurl(url); 3305 GURL as_gurl(url);
3307 return (as_gurl.is_valid() && !as_gurl.host().empty()) ? 3306 return (as_gurl.is_valid() && !as_gurl.host().empty()) ?
3308 UTF8ToUTF16(as_gurl.host()) : 3307 UTF8ToUTF16(as_gurl.host()) :
3309 l10n_util::GetStringUTF16(IDS_UNKNOWN_SEARCH_ENGINE_NAME); 3308 l10n_util::GetStringUTF16(IDS_UNKNOWN_SEARCH_ENGINE_NAME);
3310 } 3309 }
3311 3310
3312 SearchEngineType GetEngineType(const std::string& url) { 3311 SearchEngineType GetEngineType(const std::string& url) {
3313 const PrepopulatedEngine* engine = GetEngineForURL(url); 3312 const PrepopulatedEngine* engine = GetEngineForURL(url);
3314 return engine ? engine->type : SEARCH_ENGINE_OTHER; 3313 return engine ? engine->type : SEARCH_ENGINE_OTHER;
3315 } 3314 }
3316 3315
3317 } // namespace TemplateURLPrepopulateData 3316 } // namespace TemplateURLPrepopulateData
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698