Only grant permissions to new extensions from sync if they have the expected version
[chromium-blink-merge.git] / android_webview / browser / net / aw_http_user_agent_settings.cc
blob6f855f4b0ad2bd25c9a810738f34f0878e0f4d16
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "android_webview/browser/net/aw_http_user_agent_settings.h"
7 #include "android_webview/browser/aw_content_browser_client.h"
8 #include "android_webview/common/aw_content_client.h"
9 #include "content/public/browser/browser_thread.h"
10 #include "net/http/http_util.h"
12 namespace android_webview {
14 AwHttpUserAgentSettings::AwHttpUserAgentSettings() {
15 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
18 AwHttpUserAgentSettings::~AwHttpUserAgentSettings() {
19 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
22 std::string AwHttpUserAgentSettings::GetAcceptLanguage() const {
23 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
24 std::string new_aw_accept_language =
25 AwContentBrowserClient::GetAcceptLangsImpl();
26 if (new_aw_accept_language != last_aw_accept_language_) {
27 last_http_accept_language_ =
28 net::HttpUtil::GenerateAcceptLanguageHeader(new_aw_accept_language);
29 last_aw_accept_language_ = new_aw_accept_language;
31 return last_http_accept_language_;
34 std::string AwHttpUserAgentSettings::GetUserAgent() const {
35 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
36 return android_webview::GetUserAgent();
39 } // namespace android_webview