Add version checking to webview library loads.
[chromium-blink-merge.git] / android_webview / browser / net / aw_http_user_agent_settings.h
blob6718c3b806d1510cb1fbf0eca552a2c77f928111
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 #ifndef ANDROID_WEBVIEW_BROWSER_NET_AW_HTTP_USER_AGENT_SETTINGS_H_
6 #define ANDROID_WEBVIEW_BROWSER_NET_AW_HTTP_USER_AGENT_SETTINGS_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "net/url_request/http_user_agent_settings.h"
14 namespace android_webview {
16 // An implementation of |HttpUserAgentSettings| that provides HTTP header
17 // Accept-Language value that tracks aw accept language.
18 class AwHttpUserAgentSettings : public net::HttpUserAgentSettings {
19 public:
20 // Must be called on the UI thread.
21 AwHttpUserAgentSettings();
22 // Must be called on the IO thread.
23 ~AwHttpUserAgentSettings() override;
25 // net::HttpUserAgentSettings implementation
26 std::string GetAcceptLanguage() const override;
27 std::string GetUserAgent() const override;
29 private:
30 // Avoid re-processing by caching the last value from the locale and the
31 // last result of processing via net::HttpUtil::GenerateAccept*Header().
32 mutable std::string last_aw_accept_language_;
33 mutable std::string last_http_accept_language_;
35 DISALLOW_COPY_AND_ASSIGN(AwHttpUserAgentSettings);
38 } // namespace android_webview
40 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_HTTP_USER_AGENT_SETTINGS_H_