Closed Bug 1102297 Opened 5 years ago Closed 5 years ago
Investigate whether we can get country data from Windows APIs
+++ This bug was initially created as a clone of Bug #1102295 +++ In order to target the new Yahoo! search default, we'd like to be able to change the default of users within the US but not some other countries (particularly asian countries). Our base plan is to do this by time zone, but we'd like to investigate targeting this a little more carefully by country based on information already contained in the OS. Jim, can you provide an overview what other information we can obtain from Windows about the user's country, and the APIs? This is extremely urgent, if you can't provide info by today please let me know.
Getting actual regional location probably isn't possible without hitting the network, but win32 does have the concept of a language locale, which includes information about language regions. (for example en-US, en-ZA, ..). Would this suffice? here's nice page on apis available: https://www.globalyzer.com/gzserver/help/reference/localeSensitiveMethods/winlocalefunc.html
I suspect that data will not be good enough for the use case. Is there anything that will let us distinguish between nothern-hemisphere and southern-hemisphere (by time zone setting, for example)?
(In reply to Benjamin Smedberg [:bsmedberg] from comment #2) > I suspect that data will not be good enough for the use case. > Is there anything that will let us distinguish between nothern-hemisphere > and southern-hemisphere (by time zone setting, for example)? Time zones might work although it looks like we'll be dealing with strings vs. an identifier, which could be problematic since the strings are also localized. GetTimeZoneInformation: http://msdn.microsoft.com/en-us/library/windows/desktop/ms724421%28v=vs.85%29.aspx http://msdn.microsoft.com/en-us/library/windows/desktop/ms725481%28v=vs.85%29.aspx I also found GetUserGeoID which works on XP and up - api: http://msdn.microsoft.com/en-us/library/dd318138.aspx ids: http://msdn.microsoft.com/en-us/library/dd374073.aspx I've never worked with this api so I'm not sure how reliable it is. We could add a telemetry probe to pick this up, see what we get..
don't think we can trust this data enough to do anything for 34. I'm going to leave this open for the future, but it's not an immediate priority. Thanks for the research.
GetUserGeoID() will take the value from the [Location] tab of the [Region] control panel applet. http://www.integration.co.nz/images/win7-locale.png
Or [PC Settings]-[Time and language]-[Region and language]-[Country or region]. http://www.7tutorials.com/files/img/win8_keyb_input/keyboard_language20.png
GetUserGeoID sounds like what we want. Looks to be supported on XP and later. We can combine that with a call to GetGeoInfo (with GeoType=GEO_ISO2) to map the GEOID to a 2-letter country code. Benjamin, can someone on your team take this and get it uplifted to 36? I'd like to get this and bug 1102295 used instead of the timezone fallback in that release. We can use the interface added in bug 1102295 to expose this for now.
I don't think we should actually use this until we've proofed it, probably by including the value in the telemetry ping and cross-checking it against geoIP for mismatches. But yes, I will find somebody to get the API added.
Taking in account comment #8, we probably have this feature ready for 36. Tracking for 37.
Assignee: nobody → aklotz
Status: NEW → ASSIGNED
Is this a dup or superseded by bug 1109120?
It's not a dup, but I don't know whether it's still wanted. This was Gavin's request.
Flags: needinfo?(benjamin) → needinfo?(gavin.sharp)
We still want bug 1115106 as a followup/supplement to bug 1109120. This bug blocks bug 1115106.
This uses the same interface that smichaud used for the Mac in bug 1102295 and adds Windows support.
Attachment #8561099 - Flags: review?(jmathies)
I don't think this should be in nsIGfxInfo, it has nothing to do with graphics.
Gavin, shouldn't this move? Maybe we were in a rush or something in bug 1102295?
Yes, we were in a rush in bug 1102295. And we may want to uplift this still, actually, so I think we should put it in nsIGfxInfo2 now, and we can clean both up later.
> and we can clean both up later. yeah right! :)
Comment on attachment 8561099 [details] [diff] [review] Obtain the user GEOID Review of attachment 8561099 [details] [diff] [review]: ----------------------------------------------------------------- ::: widget/windows/GfxInfo.cpp @@ +28,5 @@ > > #ifdef DEBUG > NS_IMPL_ISUPPORTS_INHERITED(GfxInfo, GfxInfoBase, nsIGfxInfoDebug) > +#else > +NS_IMPL_ISUPPORTS_INHERITED(GfxInfo, GfxInfoBase, nsIGfxInfo2) aren't you skipping adding support for the new interface in debug builds?
Attachment #8561099 - Flags: review?(jmathies) → review+
(In reply to Jim Mathies [:jimm] from comment #18) > Comment on attachment 8561099 [details] [diff] [review] > Obtain the user GEOID > > Review of attachment 8561099 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: widget/windows/GfxInfo.cpp > @@ +28,5 @@ > > > > #ifdef DEBUG > > NS_IMPL_ISUPPORTS_INHERITED(GfxInfo, GfxInfoBase, nsIGfxInfoDebug) > > +#else > > +NS_IMPL_ISUPPORTS_INHERITED(GfxInfo, GfxInfoBase, nsIGfxInfo2) > > aren't you skipping adding support for the new interface in debug builds? Good catch, fixed before landing. https://hg.mozilla.org/integration/fx-team/rev/f74a7a410dd3
(In reply to Jim Mathies [:jimm] from comment #17) > > and we can clean both up later. > > yeah right! :) Filed bug 1131325 ;-)
Component: XPCOM → Widget: Win32
Comment on attachment 8561701 [details] [diff] [review] Obtain the user GEOID (r2) Approval Request Comment [Feature/regressing bug #]: Platform support for country id [User impact if declined]: Chrome code won't be able to query for system country id on Windows. [Describe test coverage new/current, TreeHerder]: Manually [Risks and why]: None; code is self contained, uses existing interfaces already used by Mac implementation. [String/UUID change made/needed]: None
Gavin, you confirm that you want this patch in 36?
Not needed for 36, but we should get it on 37.
Comment on attachment 8561701 [details] [diff] [review] Obtain the user GEOID (r2) OK, thanks. Taking it for aurora only then
Unified_cpp_widget0.cpp Unified_cpp_widget1.cpp Unified_cpp_manager_boot_src0.cpp c:\t1\hg\comm-central\mozilla\widget\GfxInfoBase.h(13) : fatal error C1083: Cannot open include file: 'nsIGfxInfo2.h': No such file or directory c:/t1/hg/comm-central/mozilla/config/rules.mk:930: recipe for target 'Unified_cpp_widget0.obj' failed mozmake: *** [Unified_cpp_widget0.obj] Error 2
I landed a trivial mingw fixup: https://hg.mozilla.org/integration/mozilla-inbound/rev/5e50387c02f1
You need to log in before you can comment on or make changes to this bug.