zhangqd / chromiumembedded

Automatically exported from code.google.com/p/chromiumembedded
0 stars 1 forks source link

Allow setting of locale and Accept-Language header per browser window #318

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The value returned by CefSettings.locale is considered the "default" locale by 
WebKit. It is initialized once by the system and cannot be changed on a 
per-browser basis. It would be nice if there was a way to set the locale value 
on a per-browser basis.

Original issue reported on code.google.com by magreenb...@gmail.com on 30 Aug 2011 at 3:46

GoogleCodeExporter commented 9 years ago
It might also be helpful to allow customization of the currently hard-coded 
Accept-Language and Accept-Charset header request values in 
browser_request_context.cc.

Original comment by magreenb...@gmail.com on 5 Sep 2011 at 2:15

GoogleCodeExporter commented 9 years ago
Has anything been done to support customization of the Accept-Language and 
Accept-Charset header request values in browser_request_context.cc? We really 
need to support language settings as our web application supports 19 languages. 
Is there another way to support it with the existing code?

Original comment by rodolfo....@gmail.com on 18 Aug 2014 at 2:40

GoogleCodeExporter commented 9 years ago
Issue 1357 has been merged into this issue.

Original comment by magreenb...@gmail.com on 11 Feb 2015 at 7:34

GoogleCodeExporter commented 9 years ago

Original comment by magreenb...@gmail.com on 11 Feb 2015 at 7:35

GoogleCodeExporter commented 9 years ago
This patch against 2272 branch allows to specify global (CefSettings) or/and 
per-browser (CefBrowserSettings) Accept-Language header.

Original comment by ajax16...@gmail.com on 17 Feb 2015 at 6:28

GoogleCodeExporter commented 9 years ago
@#5: Thanks for the patch. Some comments:

1. Wrap all lines at 80 characters.

2. Add a unit test to verify that both cases work (global setting and 
per-browser setting). For example, send the request to a custom scheme handler 
and have the custom scheme handler verify that the header is correct.

Original comment by magreenb...@gmail.com on 17 Feb 2015 at 7:10

GoogleCodeExporter commented 9 years ago
Fixed patch

Original comment by ajax16...@gmail.com on 17 Feb 2015 at 11:49

Attachments:

GoogleCodeExporter commented 9 years ago
@#7: Thanks, added in trunk revision 2033 with some changes:

1. Use HttpUtil::GenerateAcceptLanguageHeader with the value from both 
CefBrowserSettings and CefSettings.
2. Sort include headers alphabetically.
3. Indent code blocks 2 spaces instead of 4.
4. Modify ClientSchemeHandler::ProcessRequest to also test for the value set 
via CefSettings.
5. Use EXPECT_STREQ() when comparing string values in tests.
6. Simplify the changes to urlrequest_unittest.cc since the value is only set 
via CefSettings.
7. Improve documentation.

Original comment by magreenb...@gmail.com on 18 Feb 2015 at 5:29

GoogleCodeExporter commented 9 years ago
1. there is no need to call net::HttpUtil::GenerateAcceptLanguageHeader before 
"new CefHttpUserAgentSettings()", cause it's constructor already has it.
  explicit CefHttpUserAgentSettings(const std::string& raw_language_list)
      : http_accept_language_(net::HttpUtil::GenerateAcceptLanguageHeader(
            raw_language_list)) {

So double GenerateAcceptLanguageHeader call will produce wrong string. Original 
patch version should produce right string:

std::string accept_language = (settings.accept_language_list.length > 0) ? 
CefString(&settings.accept_language_list).ToString() : "en-US,en";
storage_->set_http_user_agent_settings(new 
CefHttpUserAgentSettings(accept_language));

Original comment by ajax16...@gmail.com on 18 Feb 2015 at 6:03

GoogleCodeExporter commented 9 years ago
Thanks for fixing 2-7 issues

Original comment by ajax16...@gmail.com on 18 Feb 2015 at 6:11

GoogleCodeExporter commented 9 years ago
@#9: Thanks, fixed in trunk revision 2034.

Original comment by magreenb...@gmail.com on 18 Feb 2015 at 6:11

GoogleCodeExporter commented 9 years ago
CEF is transitioning from Google Code to Bitbucket project hosting. If you 
would like to continue receiving notifications on this issue please add 
yourself as a Watcher at the new location: 
https://bitbucket.org/chromiumembedded/cef/issue/318

Original comment by magreenb...@gmail.com on 14 Mar 2015 at 3:21