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

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

Issue 3855001: Move scoped_cftyperef from base to base/mac, use the new namespace, and name ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 2 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/scoped_vector.h" 12 #include "base/scoped_vector.h"
13 #include "base/string16.h" 13 #include "base/string16.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "base/stl_util-inl.h" 15 #include "base/stl_util-inl.h"
16 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
17 #include "chrome/browser/prefs/pref_service.h" 17 #include "chrome/browser/prefs/pref_service.h"
18 #include "chrome/browser/search_engines/template_url.h" 18 #include "chrome/browser/search_engines/template_url.h"
19 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
20 #include "chrome/common/pref_names.h" 20 #include "chrome/common/pref_names.h"
21 #include "grit/theme_resources.h" 21 #include "grit/theme_resources.h"
22 22
23 #if defined(OS_WIN) 23 #if defined(OS_WIN)
24 #undef IN // On Windows, windef.h defines this, which screws up "India" cases. 24 #undef IN // On Windows, windef.h defines this, which screws up "India" cases.
25 #elif defined(OS_MACOSX) 25 #elif defined(OS_MACOSX)
26 #include "base/scoped_cftyperef.h" 26 #include "base/mac/scoped_cftyperef.h"
27 #endif 27 #endif
28 28
29 using base::Time; 29 using base::Time;
30 30
31 namespace { 31 namespace {
32 32
33 // NOTE: See comments in GetDataVersion() below! You should probably not change 33 // NOTE: See comments in GetDataVersion() below! You should probably not change
34 // the data in this file without changing the result of that function! 34 // the data in this file without changing the result of that function!
35 35
36 // Engine definitions ////////////////////////////////////////////////////////// 36 // Engine definitions //////////////////////////////////////////////////////////
(...skipping 2819 matching lines...) Expand 10 before | Expand all | Expand 10 after
2856 2856
2857 int GetCurrentCountryID() { 2857 int GetCurrentCountryID() {
2858 GEOID geo_id = GetUserGeoID(GEOCLASS_NATION); 2858 GEOID geo_id = GetUserGeoID(GEOCLASS_NATION);
2859 2859
2860 return GeoIDToCountryID(geo_id); 2860 return GeoIDToCountryID(geo_id);
2861 } 2861 }
2862 2862
2863 #elif defined(OS_MACOSX) 2863 #elif defined(OS_MACOSX)
2864 2864
2865 int GetCurrentCountryID() { 2865 int GetCurrentCountryID() {
2866 scoped_cftyperef<CFLocaleRef> locale(CFLocaleCopyCurrent()); 2866 base::mac::ScopedCFTypeRef<CFLocaleRef> locale(CFLocaleCopyCurrent());
2867 CFStringRef country = (CFStringRef)CFLocaleGetValue(locale.get(), 2867 CFStringRef country = (CFStringRef)CFLocaleGetValue(locale.get(),
2868 kCFLocaleCountryCode); 2868 kCFLocaleCountryCode);
2869 if (!country) 2869 if (!country)
2870 return kCountryIDUnknown; 2870 return kCountryIDUnknown;
2871 2871
2872 UniChar isobuf[2]; 2872 UniChar isobuf[2];
2873 CFRange char_range = CFRangeMake(0, 2); 2873 CFRange char_range = CFRangeMake(0, 2);
2874 CFStringGetCharacters(country, char_range, isobuf); 2874 CFStringGetCharacters(country, char_range, isobuf);
2875 2875
2876 return CountryCharsToCountryIDWithUpdate(static_cast<char>(isobuf[0]), 2876 return CountryCharsToCountryIDWithUpdate(static_cast<char>(isobuf[0]),
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
3455 // the first one. 3455 // the first one.
3456 GetPrepopulatedEngines(prefs, &loaded_urls.get(), &default_search_index); 3456 GetPrepopulatedEngines(prefs, &loaded_urls.get(), &default_search_index);
3457 if (default_search_index < loaded_urls.size()) { 3457 if (default_search_index < loaded_urls.size()) {
3458 default_search_provider = loaded_urls[default_search_index]; 3458 default_search_provider = loaded_urls[default_search_index];
3459 loaded_urls.weak_erase(loaded_urls.begin() + default_search_index); 3459 loaded_urls.weak_erase(loaded_urls.begin() + default_search_index);
3460 } 3460 }
3461 return default_search_provider; 3461 return default_search_provider;
3462 } 3462 }
3463 3463
3464 } // namespace TemplateURLPrepopulateData 3464 } // namespace TemplateURLPrepopulateData
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/render_widget_host_view_mac.mm ('k') | chrome/common/font_loader_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698