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

Unified Diff: android_webview/browser/net/aw_http_user_agent_settings.cc

Issue 1172093002: Implement HttpUserAgentSettings delegate for Android WebView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: android_webview/browser/net/aw_http_user_agent_settings.cc
diff --git a/android_webview/browser/net/aw_http_user_agent_settings.cc b/android_webview/browser/net/aw_http_user_agent_settings.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6f855f4b0ad2bd25c9a810738f34f0878e0f4d16
--- /dev/null
+++ b/android_webview/browser/net/aw_http_user_agent_settings.cc
@@ -0,0 +1,39 @@
+// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "android_webview/browser/net/aw_http_user_agent_settings.h"
+
+#include "android_webview/browser/aw_content_browser_client.h"
+#include "android_webview/common/aw_content_client.h"
+#include "content/public/browser/browser_thread.h"
+#include "net/http/http_util.h"
+
+namespace android_webview {
+
+AwHttpUserAgentSettings::AwHttpUserAgentSettings() {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+}
+
+AwHttpUserAgentSettings::~AwHttpUserAgentSettings() {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
+}
+
+std::string AwHttpUserAgentSettings::GetAcceptLanguage() const {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
+ std::string new_aw_accept_language =
+ AwContentBrowserClient::GetAcceptLangsImpl();
+ if (new_aw_accept_language != last_aw_accept_language_) {
+ last_http_accept_language_ =
+ net::HttpUtil::GenerateAcceptLanguageHeader(new_aw_accept_language);
+ last_aw_accept_language_ = new_aw_accept_language;
+ }
+ return last_http_accept_language_;
+}
+
+std::string AwHttpUserAgentSettings::GetUserAgent() const {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
+ return android_webview::GetUserAgent();
+}
+
+} // namespace android_webview
« no previous file with comments | « android_webview/browser/net/aw_http_user_agent_settings.h ('k') | android_webview/browser/net/aw_url_request_context_getter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698